OpenMP set_num_threads() is not working

前端 未结 5 1230
说谎
说谎 2020-11-30 01:01

I am writing a parallel program using OpenMP in C++.

I want to control the number of threads in the program using omp_set_num_threads(), but it does not

5条回答
  •  情歌与酒
    2020-11-30 02:03

    The omp_get_num_threads() function returns the number of threads that are currently in the team executing the parallel region from which it is called. You are calling it outside of the parallel region, which is why it returns 1.

提交回复
热议问题