Using -cubin option in CUDA


I came to know while reading some literature in CUDA programming and code analysis that “The kernel can be compiled with -cubin to obtain the resource usage, which shows that each thread uses how many number of registers, and each block uses how much bytes of shared memory”

When I tried to run my sample Kernel code with -cubin option as

$nvcc -cubin

A file named sample.cubin has been created, which seems to be a binary file.

Can you please tell me how to get the resource usage data with this flag.

CUBIN files used to be human readable text files, but since CUDA 3.0, the toolchain has switched to a binary ELF based format. Pass -Xptxas="-v" to nvcc and the same kernel resource information will be echoed by the host code assembler.

Thanks Avidday for your suggstion. I have run with the option you have provided and getting the output like

[root@nvidia-ll076]# nvcc -Xptxas="-v" -cubin
ptxas info : Compiling entry function ‘_Z22incrementArrayOnDevicePfi’ for ‘sm_10’
ptxas info : Used 2 registers, 12+16 bytes smem

So, we can get only two information with this flag 1. No of registers used by kernel 2. Shared Memory Usage

or can we also get some other resources information ?

add the following after -cubin

--ptxas-options -v,

It also will show local memory usage when you actually have local memory references

Thanks for the replies! I have got the right flag.

I have forgot to mention that Flag --ptxas-options -v has given me all required information. Thanks again.