Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nvcc -Xptxas –v compiler flag has no effect

Tags:

cuda

nvcc

I have a CUDA project. It consists of several .cpp files that contain my application logic and one .cu file that contains multiple kernels plus a __host__ function that invokes them.

Now I would like to determine the number of registers used by my kernel(s). My normal compiler call looks like this:

nvcc -arch compute_20 -link src/kernel.cu obj/..obj obj/..obj .. -o bin/..exe -l glew32 ...

Adding the "-Xptxas –v" compiler flag to this call unfortunately has no effect. The compiler still produces the same textual output as before. The compiled .exe also works the same way as before with one exception: My framerate jumps to 1800fps, up from 80fps.

like image 250
Dave O. Avatar asked Sep 15 '10 17:09

Dave O.


4 Answers

When using "-Xptxas -v", "-arch" together, we can not get verbose information(register num, etc.). If we want to see the verbose without losing the chance of assigning GPU architecture(-arch, -code) ahead, we can do the following steps: nvcc -arch compute_XX *.cu -keep then ptxas -v *.ptx. But we will obtain many processing files. Certainly, kogut's answer is to the point.

like image 95
Randy Young Avatar answered Nov 11 '22 08:11

Randy Young


I had the same problem, here is my solution:

  1. Compile *cu files into device only *ptx file, this will discard host code

    nvcc -ptx *.cu

  2. Compile *ptx file:

    ptxas -v *.ptx

The second step will show you number of used registers by kernel and amount of used shared memory.

like image 45
kokosing Avatar answered Nov 11 '22 06:11

kokosing


Convert the compute_20 to sm_20 in your compiler call. That should fix it.

like image 5
user2030440 Avatar answered Nov 11 '22 07:11

user2030440


when you compile

nvcc --ptxas-options=-v

like image 2
Anycorn Avatar answered Nov 11 '22 08:11

Anycorn