Can omp pragmas be used, such as critical, single, main, or a barrier outside of a parallel omp block? I have a function that can be called either from a parallel OMP block or not. If so, I need to attach a piece of code in the critical section. In other words, is this code good?
void myfunc(){ #pragma omp critical { } }
I did not mention this in the OpenMP documentation. I assume that the code should behave exactly the same as when executing 1 thread - and so it works with gcc. I would like to know if this behavior is portable, or is that what the specification does not define, and something to be expected.
c ++ c openmp
angainor
source share