Using nvfortran with -cuda option

Hello, I’m using the NVIDIA HPC SDK 24.5 with CUDA 12.4.

I have some Fortran code that uses straight CUDA to offload two loops - all source files have “*.f” extension.
Everything compiles and runs successfully (albeit slower than expected) if I use the following compile options.

“-O3 -cpp -r8 -tp=cascadelake -target=gpu -cuda -mp=gpu -gpu=cuda12.4,cc70”

However, if I remove the “-mp=gpu” option, which shouldn’t need to be there as the code isn’t doing any OpenMP, I get the following errors.

“nvfortran-Warning-The -target option has no effect unless a language-specific option is used (e.g.: -acc, -mp, -stdpar, -cuda)”

The compiler doesn’t detect that the “-cuda” option is on the command line.
What’s going on here? Is this a bug in the nvfortran compiler?

I’m using NVIDIA V100 GPUs.

Best wishes,
Michael

Hi Michael,

I think it’s just a typo in the warning message. CUDA Fortran is being applied.

“-target” is only for OpenACC, OpenMP, and STDPAR since these can be compiled to target either the GPU or multicore CPU. However CUDA Fortran, i.e. “-cuda”, can only target GPUs. Hence, the warning is correct, just that “-cuda” shouldn’t be in the message.

I’ll report it.

-Mat

1 Like