I have C/C++ source files written with OMP instrumentation. For example, in a C++ class file:
#pragma omp parallel sections
{
#pragma omp section
cp = ModularSquareRoot(cp, m_p);
#pragma omp section
cq = ModularSquareRoot(cq, m_q);
}
For benchmarking and testing, I want to build the library with -fopenmp
but disable it on this particular class file. I hope I can add something like #pragma omp disable
or similar in the class's header file to disable it for the translation unit. But #pragma omp disable
was silently ignored.
I've looked through Using OpenMP: Portable Shared Memory Parallel Programming, but I have not seen how to do it. (I could well be missing it because I have not read it completely).
I'm trying to avoid modifying CXXFLAGS
, makefile recipes and Visual Studio project settings.
Is there a way to disable OMP in a particular translation unit at the source file?