According to Chapman, Yost, Van der Paas "Using OpenMP" p 47, OpenMP standard specifies ability to determine which OpenMP version is in effect by pre-processor macro, e.g.
#if defined _OPENMP && _OPENMP >= 200711
// OpenMP 3.1 is implemented; can use e.g. omp parallel reduction(max: )
// need workaround for old compilers such as MSVC or RedHat 5/6 gcc
This appears to work with ICL. On linux, however, icc takes _OPENMP from gcc, so such a macro will prevent icc from using OpenMP 3.1 unless a current gcc (newer than supported in RedHat/CentOS 6) is on PATH.
The situation worsens with the partial implementation of OpenMP 4.0. Even with gcc versions which implement more of 4.0 than icc does, we have available only _OPENMP >= 200711 to signify support for 3.1 and maybe parts of 4.0.
I'm not expecting acceptable solutions with autoconf or the like to deal with this, but I would like to know if there is a supported method to know the difference between gcc and icc, other than use of __INTEL_COMPILER version numbers. I've been able to cut back on use of gcc version numbers, but I fear that may be only temporary.
I was hoping to submit a problem report, but I confirmed that I am still excluded from submitting reports, since 10 weeks ago.