CUDA-GDB: Variables are optimized out

Hello,
I am trying to debug some CUDA-Fortran code with CUDA-GDB. When trying to print out variables at a given breakpoint some of those are given as . In other forums I read that this is due to compiler optimization when several variables have the same value and if I do not want this to happen then I will have to turn off optimization with ‘-O0’.
As I read in the PGI Compiler User’s Guide the option ‘-g’ already implicitly sets the optimization level to zero. In any case, using ‘-g’ or ‘-g -O0’ does still not fix the issue of variables being optimized out.
Anything I can do to avoid this?

-Nils

I’m having the same issue right now. Any updates?

Thanks,
Ron

The issue needs more context. One thing the user can do is to add

-Mcuda=debug

and see if the behavior changes. But without an example, some information about whether the variables in question are GPU code variables or CPU code variables, and whether they are scalar or array type variables, is needed for an educated response.

Post an example that demonstrates variables ‘optimized out’ and how
you built and ran it with CUDA GDB. If you do not wish to make your example public, send it to trs@pgroup.com

dave