Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to output C/C++ annotated PTX in CUDA 4.1/4.2/5.0

Tags:

cuda

llvm

ptx

Does anybody know how to get PTX assembler annotated with C/C++ code with new LLVM back-end?

Can easily get it with CUDA 4.0 or earlier but NVCC rejects all my flags after upgrading CUDA toolkit to version 4.2.

like image 722
Andrey Kamaev Avatar asked Jul 13 '12 23:07

Andrey Kamaev


People also ask

How do I compile CUDA code?

In order to compile CUDA code files, you have to use nvcc compiler. Cuda codes can only be compiled and executed on node that have a GPU. Heracles has 4 Nvidia Tesla P100 GPUs on node18. Cuda Compiler is installed on node 18, so you need ssh to compile cuda programs.

What is PTX NVIDIA?

PTX is a low-level parallel-thread-execution virtual machine and ISA (Instruction Set Architecture). PTX can be output from multiple tools or written directly by developers. PTX is meant to be GPU-architecture independent, so that the same code can be reused for different GPU architectures.


2 Answers

nvcc from CUDA 6.0 preview supports option --source-in-ptx.

like image 119
geek Avatar answered Oct 21 '22 19:10

geek


Does nvcc.exe --opencc-options -LIST:source=on -ptx kernel.cu work? I have installed cuda 4.2 and this command generates *.ptx file with commented C code between ptx assembler lines.

like image 36
Insomnious Avatar answered Oct 21 '22 17:10

Insomnious