Access ptx information, while running? I need to know if there is any API support for this


I’m running som code with the -V flag to get some information of my memory usage. It would be sweet if i could access this information in my code in order to do nice printouts of all the information. Is there a smooth way to do this?

I guess otherwise there must be some simple way to access VS output file info… Maybe write something to scan it an retrieve the needed info. Any tips?


In Linux, there is a tool called “objcopy” that can copy any file/data into your a.out (executable binary) as a separate ELF section.
Then, you can use the linker script to export symbols that stand for the Virtual Address of the begining of that section.
The app can refer those symbols, make a pointer to it and access the contents…during runtime.

There must be a way out there in windows. though, I have never used such tricks in windows.

Hey Saranath,

It just struck me that this information is printed during compile time… Hmm maybe i should look for a way to access the output file while running the prog.

I’ll just google it i guess, should be easy peasy :)



Note that the driver API supports loading CUBIN kernels at run-time (instead of the kernel launch using <<< >>> )

Check the driver API – It might have facility of querying the CUBIN. So, you can figure out how many smem,regs etc. for a particular kernel.
If it is not there, then we should ask for in the CUDA wish-list.

Good Luck,

Ok, sounds good, will have a check!

Hey guys,

I left this issue be for a few days… But today when looking through the reference manual i noticed that there is an API function called cudaGetDeviceInfo(…) . This returns a struct that contains all the good stuff you need to know :D

I haven’t had time to try it yet but it looks right.


cudaGetDeviceInfo() just tells you runtime information about the device you’re running on. It won’t give kernel memory usage information.

You could use cudaFuncGetAttribute:

ok, my mistake.

Thanks mfatica, I will try that!

Hi again,

I could only find a cuDeviceGetAttribute, this only returns static device information. It won’t help me see register usage…