- Set CUDA as Synchronous mode:
export CUDA_LAUNCH_BLOCKING=1
- Use CUDA GDB :
/usr/local/cuda/bin/cuda-gdb --arg foo arg1 arg2
Enable GDB option :
(cuda-gdb) set cuda api_failures stop
More details:
(cuda-gdb) help set cuda
Run your program:
(cuda-gdb) run
Once you hit an issue, check the backtrace
(cuda-gdb) bt
To avoid calling this everytime:
Create a .gdb file like ~/debug_setup.gdb
:
set confirm off
set cuda api_failures stop
run
then
cuda-gdb -x ~/debug_setup.gdb ./your_app