OpenMP set_num_threads() is not working

前端 未结 5 1226
说谎
说谎 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 01:44

    According to the GCC manual for omp_get_num_threads:

    In a sequential section of the program omp_get_num_threads returns 1

    So this:

    cout<<"sum="<#pragma omp parallel
    {
        cout<<"sum="<
                                                            
提交回复
热议问题