How to check the version of OpenMP on Linux

Tim picture Tim · Aug 20, 2009 · Viewed 59.8k times · Source

I wonder how to check the version of OpenMP on a Linux remote machine?

I don't know where it is installed either.

Answer

Brent Bradburn picture Brent Bradburn · Nov 28, 2012

It appears that the C/C++ specification for OpenMP provides no direct way of doing this programmatically. So you have to check the docs for your compiler version.

gcc --version ## get compiler version

For GCC, this is a good resource (does not mention newest versions of GCC): http://gcc.gnu.org/wiki/openmp:

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.


Edit

After trying a bit harder, I got the following to work. It at least gives an indication of the OpenMP version -- although it still requires you to look something up.

$ echo |cpp -fopenmp -dM |grep -i open
#define _OPENMP 200805

You can go here (http://www.openmp.org/specifications/) to discover the mapping between the date provided and the actual OpenMP version number.

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.