From the CUDA Fortran programming guide: > If CUDA Fortran is enabled in compilation, either by specifying -cuda on the command line, and pre-processing is enabled by either the -Mpreprocess compiler option or by using capital letters in the filename extension (.CUF, .F90, etc.) then the _CUDA macro is defined. Move the definition of `_CUDA` to the compiler invocation.