I have C++ code with OpenMP pragmas inside. I want to test this code both for multithread mode (with OpenMP) and in single thread mode (no OpenMP).
For now, to swit
The way such things are usually handled (the general case) is with #defines and #ifdef:
#define
#ifdef
In your header file:
#ifndef SINGLETHREADED #pragma omp #endif
When you compile, add -DSINGLETHREADED to disable OpenMP:
cc -DSINGLETHREADED code.c