List of macros option for nvfortran like for nvc?

Like for GCC, you can use -dM with nvc to dump predefined macros. Is there a similar option for Fortran? (If not, as seems the case, will there be?)

It’s the same, though you do need to have preprocessing enabled, either via the flag “-Mpreprocess”, or by default when using capitols in the suffix like “.F90”.

% nvfortran hello.f90 -dM -Mpreprocess
#define __STDC_HOSTED__  1
#define __CHAR_UNSIGNED__  1
#define __arm64__  1
#define __aarch64__  1
#define __LP64__  1
#define __PGLLVM__  1
#define __NVCOMPILER_LLVM__  1
#define __extension__
#define __linux__  1
#define __linux  1
#define __ELF__  1
#define linux  1
#define unix  1
#define __ARM_ARCH_8__  1
#define __ARM_ARCH_8A__  1
#define __ARM_ARCH  8
#define __ARM_PCS_VFP  1
#define __VFP_FP__  1
#define __ARM_FEATURE_FMA  1
#define __ARM_NEON  1
#define __ARM_NEON__  1
#define __ARM_FP  0x0C
#define __LITTLE_ENDIAN__  1
#define __AARCH64EL__  1
#define __ARM_FEATURE_DIRECTED_ROUNDING  1
#define __ARM_FEATURE_SVE_MATMUL_INT8  1
#define __ARM_FEATURE_SVE_MATMUL_FP32  1
#define __ARM_FEATURE_SVE_MATMUL_FP64  1
#define __NVCOMPILER_GPU_SEPARATE_MEM  1
#define __PGI  1
#define __NVCOMPILER  1
#define __LINE__  0
#define __FILE__  1
#define __DATE__  "Sep 24 2024"
#define __TIME__  "11:37:24"
#define __STDC__  1
#define __PGIC__  24
#define __NVCOMPILER_MAJOR__  24
#define __PGIF90__  24
#define __PGIC_MINOR__  7
#define __NVCOMPILER_MINOR__  7
#define __PGIF90_MINOR__  7
#define __PGIC_PATCHLEVEL__  0
#define __NVCOMPILER_PATCHLEVEL__  0
#define __PGIF90_PATCHLEVEL__  0

Thanks, Mat! Embarrassing I didn’t make the preprocessor connection :)

Is there a way to #ifdef that it’s nvfortran? (Other than using the old PGI macros and presumably this will change in the not distant future)

I’d use “__NVCOMPILER”.

1 Like

OK, thanks. That’s what I was doing in the interim, anyway