Cuda-gdb scripting

I am wondering if cuda-gdb is able to execute a script of debug code as gdb. Is there any difference if it is able to?

Hi @Ziqi
cuda-gdb supports executing the debugging scripts (same as gdb).

Is there any difference if it is able to?

All gdb functionality is supported. Additionally CUDA specific command can be used in the scripts: CUDA-GDB

Thanks. Too many variables are optimized even thought -G is provided. This optimization for debug build really damages experience of cuda-gdb. Is there any plan to prevent unnecessary optimization in NVCC group?

We can pass along this information to the compiler group, but a specific use case would make it easier to triage. Do you have an example you can share?

Unfortunately, anything related to our source code cannot be revealed. The only thing I can share is our building info:

Compiling ../ArrayMPA/src/ to make object file ../ArrayMPA/Debug/mpa_utility.x86-64.o.
nvcc -x cu --compiler-options "-fPIC" --expt-relaxed-constexpr --gpu-architecture=sm_86 -Xcudafe --display_error_number -DPREFETCH=0 -DUSE_DCBX=0 -DX86 -D_LITTLE_ENDIAN_=1 -D__LITTLE_ENDIAN__=1  -DCPLUSPLUS_2011   -DDEBUG=2  -DDETECTION_DEBUG -DCHECKCUDAERROR -DGOOGLE_CUDA=1 -D_MWAITXINTRIN_H_INCLUDED -D_FORCE_INLINES -DUNIT_TEST=1  -g -G -O0  -I../../../../../../../../../../../../../usr/local/include  -I../ArrayMPA  -I../ArrayMPA/include  -I../../../../../../../../../../../../../usr/local/cuda/targets/x86_64-linux/include -I/usr/local/lib/python3.8/dist-packages/tensorflow/include -D_GLIBCXX_USE_CXX11_ABI=1 -DEIGEN_MAX_ALIGN_BYTES=64 -I ../../../../scripts/../3dparty/libpng -I ../../../../scripts/../3dparty/zlib -I../../../ops/CommonUtils//../..//shared -I../../../ops/CommonUtils//../..//ops/CommonUtils -I../../../ops/CommonUtils//../..//ops/CommonUtils/Png --keep --keep-dir ../ArrayMPA/Debug -c ../ArrayMPA/src/ -o ../ArrayMPA/Debug/mpa_utility.x86-64.o

Clearly I used -g -G -O0 in compilation. However, within cuda-gdb, as I printed a variable using p interpCtr, I got $1 = <optimized out>.

Maybe this is a project the NVCC group and the cuda-gdb group should collaborate on :) The collaboration will lead to good performance review :)

Surprisingly, I do not see many people complaining about the issue. Maybe not too many people really use cuda-gdb in development?