0

I would like the generated CUDA code to be saved in a file for examination. Is this possible with OpenAcc and PGI compilers?

Paul R
  • 208,748
  • 37
  • 389
  • 560

1 Answers1

3

You should be able to pass -ta=nvidia,keepgpu,keepptx to any of the PGI GPU compilers, which will retain the intermediate code emitted by the toolchain during the build.

Also refer to the command line help, e.g.:

pgcc -help

Note that PGI compilers have moved to a more integrated toolchain recently, which eliminates the generation of CUDA C intermediate source files, so the above approach works but gives you intermediate files that are not C code (they are llvm and ptx). If you want CUDA C intermediate code, you can also add the nollvm option:

-ta=nvidia,keepgpu,keepptx,nollvm

The "kept" files will generally have .gpu and .h extensions for llvm/CUDA C code, and .ptx extension for PTX.

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
talonmies
  • 70,661
  • 34
  • 192
  • 269