Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to prevent <optimized out> values in cuda-gdb

how do I prevent cuda-gdb from optimizing out any value ( whether device or host, local or global )? I have checked nvidia forums but most of them are years old and there seems to be not a solution for old cuda versions, but is there one for the newest one (cuda 9.2 and sm 61)?

I am using flags described in nvidia's documentation:

-g - "Generate debug information for host code."

-G - "Generate debug information for device code. Turns off all optimizations. Don't use for profiling; use -lineinfo instead."

like image 656
Cucumber Mellon U. Avatar asked Aug 31 '25 18:08

Cucumber Mellon U.


1 Answers

how do I prevent cuda-gdb from optimizing out any value

The cuda-gdb is not optimizing anything; it is just interpreting the debug info that the compiler (nvcc) put into the binary.

If the compiler chose not to describe location of some variable, then there is nothing cuda-gdb can do to recover that info. This would generally be a quality of debugging info issue with nvcc.

It's possible that nvcc did describe the location you are after, but cuda-gdb is failing to handle that description, in which case it's a bug in cuda-gdb.

In either case, you can't really do anything about it, other than complaining to NVidia.

like image 176
Employed Russian Avatar answered Sep 02 '25 08:09

Employed Russian