PGI compiler version macro?

Hi -

I need to programmatically query the Portland Group C compiler version in order to conditionally compile code which uses the new inline assembly support added in version 6.1.

I cannot find a version query macro anywhere in the PGI documentation or verbose compile output - is there a macro hiding somewhere that can be used to check the compiler version? (eg gcc has GNUC, GNUC_MINOR, GNUC_PATCHLEVEL, etc)

Thanks…

No, it doesn’t appear that we do. But that’s a good idea. I’ve entered a feature request, and for your tracking purposes, it is TPR 3791

No, it doesn’t appear that we do. But that’s a good idea. I’ve entered a
feature request, and for your tracking purposes, it is TPR 3791

Thanks - having that in future versions would definitely be helpful, but it obviously doesn’t help me with my immediate problem (especially since I’m trying to detect the difference between 6.1 and releases before 6.1).

Is there any other way to detect from the preprocessor whether I’m using 6.1 or newer? (eg any other random predefined preprocessor tokens that happen to first appear in 6.1?)

In our 6.1-5 compilers, we have now started supporting these version query macros: PGIC, PGIC_MINOR, and PGIC_PATCHLEVEL

Sorry, I can’t think of anything right off hand to help with previous compilers…

In our 6.1-5 compilers, we have now started supporting these version
query macros: PGIC, PGIC_MINOR, and
PGIC_PATCHLEVEL


Cool - thanks.

Sorry, I can’t think of anything right off hand to help with previous compilers…

I devised the following filthy hack to detect PGI versions supporting the full gcc asm syntax (the critical piece of info I needed):

#include “omp.h”
#if defined(_PGOMP_H)
/* 6.1.1 or newer /
#else
/
6.0.8 or older */
#endif

I’ll definitely use your new version macros in cases where they’re available.

I see in the version 6.2-3 release that these compiler versioning macros are NOT available for the c++ compiler. Is that an oversight, or is there a reason not to? I could really use this facility in the c++ compiler as well.

Hi Paul,

Thanks for pointed this out. This was an oversite. I’ve reopened the feature request (TPR#3791) have have asked our compiler engineers to add these macros to C++.

  • Mat