Compiling for Both OpenACC and CUDA Fortran

I’d like to mix OpenACC with CUDA Fortran code. My build system currently only has one set of flags for GPU compilation, so I tried to have a compiler call for both modes. Therefore I tried the following:

pgf90 -acc -Mcuda -ta=nvidia,cc3x -fast -c my_source.F90 -o my_source.o

Here’s what happens: With CUDA-only files and non accelerated files it works. As soon as I try it with a file that (only) has OpenACC kernels implemented, it prints usage information for ‘fatbinary’, so

Usage  : fatbinary [options]


--32    (-32)          
        Specify that this was a 32bit compile.

--64    (-64)          
        Specify that this was a 64bit compile.


Linking then fails with “nvlink fatal : Could not find fatbin in ‘my_source.o’”.

It seems to me I’ve stumbled upon a bug where PGI Accelerator calls ‘fatbinary’ with some wrong arguments.

My question: Is there already a supported way to have both CUDA and OpenACC enabled in the compiler?[/code]

Some update: The following compiler call works without error - so it seems like the info / neginfo options somehow influence what happens with the fatbinary generation - that or I’m just having some kind of heisenbug here.

pgf90 -acc -Minfo=accel,inline,ipa -Mneginfo -Mcuda=5.5,cc3x -ta=nvidia,cc3x -fast -c my_source.F90 -o my_source.o


Hi MuellerM,

Sorry you’re hitting this. It’s a known issue that occurs only when using OpenACC with the -Mcuda flag and no CUDA Fortran is actually in the code anywhere. The work around is to not use -Mcuda in this scenario or add a dummy CUDA Fortran kernel.

  • Mat

Thanks for the workaround.
Is there a tracking number for this? I’d like to comment my WAR so I know when it can be removed.

Hi Levi,

I was PGI Tracker #395 but no associated TPR#. Note that this issue was fixed in the 14.7 release.

  • Mat