I have #pragma omp parallel for
in multiple independent threads, but I am not sure that those parallel regions can run concurrently at the same time.
It would be inconvenient to change those regular threads to omp task regions.
So is it possible to execute two OpenMP parallel regions in two separate threads concurrently or may only one region run at a time?
Example:
void f1()// executed in thread 1
{
#pragma omp parallel for
for(...)
{/*do something*/}
}
void f2()//executed in thread 2
{
#pragma omp parallel for
for(...)
{/*do something else*/}
}
So my question is: will the parallel loops in f1()
and f2()
run concurrently at the same time having twice as many threads in total as OpenMP uses for one parallel region, or, it will run only one parallel block at a time and another will be waiting on a semaphore?