看来OpenMP的C/C++规范没有直接的方法来编程。所以你必须检查你的编译器版本的文档。
gcc --version ## get compiler version
As of GCC 4.2, the compiler implements version 2.5 of the OpenMP standard and as of 4.4 it implements version 3.0 of the OpenMP standard. The OpenMP 3.1 is supported since GCC 4.7.
编辑:尝试了一下,我得到以下工作。它至少给出了OpenMP版本的指示 – 尽管它仍然需要你去看看。
$ echo |cpp -fopenmp -dM |grep -i open
#define _OPENMP 200805
In implementations that support a preprocessor, the _OPENMP macro name is defined to have the decimal value yyyymm where yyyy and mm are the year and month designations of the version of the OpenMP API that the implementation supports.