How to get the assembly code of a CUDA kernel?
assembly, c, cuda, gpgpu, nvidia
Solution
As mentioned by turboscrew, the closest thing to assembly for CUDA is the PTX code. I thought it would be more useful to add to this answer the method of actually generating the PTX code.
This can be generated in the following way:
`nvcc -ptx -o kernel.ptx kernel.cu`
Where `kernel.cu` is your source file and `kernel.ptx` is the destination PTX file.
Also, here is a link to NVidia's PTX documentation:
http://docs.nvidia.com/cuda/parallel-thread-execution/index.html
If you have some assembly knowledge, most of it is fairly straightforward. There are some special functions that may be used where it would be useful to look them up for more details though.
Problem
I have some kernels that I have written in both OpenCL and CUDA. When running OpenCL programs in the AMD profiler, it allows me to view the assembly code of the kernel. I would like to compare this with the assembly code of the CUDA kernels to compare compiler optimizations between the two languages. I have been playing around with the Nvidia Profiler, but am still at a loss on how to get the assembly code of my kernels. How does one go about doing this?