I am having issues with using cuda-gdb to debug a Fortran program that uses OpenACC. Specifically, the problem is that I am unable to use cuda-gdb to inspect (print) any variables inside subroutines that run on device.
Specifically, I am able to advance to a breakpoint inside a device function, but once there, when I do ‘print myvar’, I always get ‘No symbol “myvar” in current context’, even if the variable was set in the previous statement.
The version of cuda-gdb I am using is 11.8, and I use nvfortran version “nvfortran 22.11-0 64-bit target on x86-64 Linux”. My understanding is that for device debugging to work I should use the “-g” flag when compiling. Indeed, I am doing this.
Currently, I am compiling with the following debug-related flags: -g -gopt -O0 -Mcuda=debug -gpu=debug"
Any ideas on how to fix this?
Hi! Is there any chance you can share a reproducer with us?
I don’t see any
-acc=gpu flags on the compile line. The
-Mcuda= flag should only be used with CUDA Fortran applications.
-gopt flag should not be passed as this will enable optimizations. This will omit .debug_info information for symbolic variables and result in a compilation mode that is similar to
-gpu=lineinfo. When you pass
-g -gopt the last flag will win.
Please try to use
-g -O0 -acc=gpu as your debug flags.
Hello, and thanks for your prompt response. Sorry, I did not post my full compile flags (only debug related), but I did have “-acc”.
As you suggested, I now compiled with “-g -O0 -acc=gpu”, but the problem persists.
The full compile flags are:
“-Wall -byteswapio -Mlarge_arrays -g -O0 -acc=gpu”
Can -Mlarge_arrays be the problem?
I will try to follow up with a simplified reproducer of the problem.
Have you solved your problem and anything else we can help ?
I was able to fix the issue I wanted to debug just by updating the NVIDIA Fortran compiler to version 23.7.
I have not tested the debugger anymore. But thanks for clarifying what are the necessary flags are.
Thanks for letting us know this !
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.