Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the version of OpenMP on Linux

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

I don't know where it is installed either.

like image 217
Tim Avatar asked Aug 20 '09 06:08

Tim


People also ask

Where is OpenMP installed?

OpenMP comes under the shared memory concept. In this, different CPU's (processors) will have access to the same memory location. Since all CPU's connect to the same memory, memory access should be handled carefully. Here, each CPU(processor) will have its own memory location to access and use.

Is OpenMP included in GCC?

OpenMP 5.0 is partially supported for C and C++ since GCC 9 and extended in GCC 10. Since GCC 11, OpenMP 4.5 is fully supported for Fortran and OpenMP 5.0 support has been extended for C, C++ and Fortran. GCC 12 has the initial support of OpenMP 5.1 and extends the OpenMP 5.0 coverage.

What is OpenMP for GCC?

OpenMP (Open Multi-Processing) is an application programming interface (API) that supports multi-platform shared-memory multiprocessing programming in C, C++, and Fortran, on many platforms, instruction-set architectures and operating systems, including Solaris, AIX, FreeBSD, HP-UX, Linux, macOS, and Windows.


1 Answers

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.

like image 124
Brent Bradburn Avatar answered Oct 01 '22 06:10

Brent Bradburn