Mixing OpenMP 2.5 and OpenMP 3

General OpenMP discussion

Mixing OpenMP 2.5 and OpenMP 3

Postby Tobias » Wed Jun 18, 2008 2:00 am

Hello,

I would like to use OpenMP 3.0 (which is e.g. supported by the developer releases of GCC (4.4.0)), but the program should be still be compilable with OpenMP 2.5 compilers.

What is the best way to do so that only the OpenMP-3 compiler sees the tasking directives? (Using the preprocessor CPP is fine.)

Tobias
Tobias
 

Re: Mixing OpenMP 2.5 and OpenMP 3

Postby ejd » Wed Aug 13, 2008 11:28 pm

From the OpenMP V3.0 spec, section 2.2 Conditional Compilation:

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.

Since using a preprocessor is okay with you, I would suggest using what is already there (and you shouldn't even have to specify anything more than the compile flag for OpenMP).
Code: Select all
#if _OPENMP == 200805L
    #pragma omp task
#endif
    {
      ...
    }
ejd
 
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am


Return to Using OpenMP

Who is online

Users browsing this forum: Majestic-12 [Bot] and 11 guests