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
omp_set_num_threads()
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="<
Should be changed to something like:
#pragma omp parallel { cout<<"sum="<
The code I use follows Hristo's advice of disabling dynamic teams, too.