I have a piece of code where I would like to enforce the creation of tasks even for 1 thread.
Can I perform this in any way within the code or is there an environment variable I can set to make sure that tasks are created even for
a single thread in the icc & gcc compilers.
I have tried the following technique which does not seem to work:
- Code: Select all
#pragma omp parallel firstprivate(a, gap, waves) private(temp, wave, ii, i) shared(np, mp, elements)
#pragma omp master
-- do something --
#pragma omp task firstprivate(ii, np, mp, chunk, elements) if((num_th >= 1))
--- do something ---
#pragma omp taskwait
This is a performance test I wish to conduct for I want to judge the performance of the above code using just 1 thread.
Currently the icc and gcc compilers by default do not generate tasks when the code is running on a single thread.
Is there a way I can disable that and force it to create tasks even when operating on 1 thread as well.