- Code needs to be compiled with debugging option
-g
- Compiler optimizations might complicate debugging (dead code
elimination, loop transformations, etc.), recommended to
compile without optimizations with
-O0
- Sometimes bugs show up only with optimizations
Set up VNC for smoother GUI performance:
module load lumi-vnc
start-vnc
Follow the instructions from the command output to set up SSH port forwarding and opening VNC on a browser.
Load module and start debugger in an interactive session:
module load ARMForge
export SLURM_OVERLAP=1
salloc -A project_465000536 --nodes=1 --ntasks-per-node=2 --time=00:30:00 --partition=debug
ddt srun ./buggy
The debugger GUI will open in VNC in the browser window.
Note: you can also skip the VNC step and use X11 forwarding for GUI (might be slow).
Launch a desktop session on a browser for smoother GUI performance (see the documentation for detailed instructions):
- Login to https://www.puhti.csc.fi or https://www.mahti.csc.fi
- Launch Desktop with 1 core
- Open a terminal window in the desktop session and proceed there
Load module and start debugger in an interactive session:
module load ddt
export SLURM_OVERLAP=1
salloc -A project_2007995 --nodes=1 --ntasks-per-node=2 --time=00:15:00 --partition=test
ddt srun ./buggy
Note: you can also skip the desktop session step and use X11 forwarding for GUI (might be slow).
These example codes can be built with make all
.
Debug the exchange.cpp code similar to the earlier exercise.
The following will be demoed with DDT:
- Launching DDT
- Examining per-process status
- Setting build configuration
- Fixing the code within DDT
Debug the collective.cpp code similar to the earlier exercise.
The following will be demoed with DDT:
- Setting breakpoints
- Stepping execution
- Using distributed array view
Memory debugging with sanitizer. On LUMI:
CC -g -fsanitize=address collective.cpp -o collective.exe
srun -A project_465000536 --nodes=1 --ntasks-per-node=4 --time=00:05:00 --partition=debug --label ./collective.exe
Note the --label
option that prepends task number to lines of stdout/err.
Memory debugging with valgrind4hpc. On LUMI:
module load valgrind4hpc
CC -g collective.cpp -o collective.exe
valgrind4hpc --num-ranks=4 --launcher-args="-A project_465000536 --nodes=1 --ntasks-per-node=4 --time=00:05:00 --partition=debug" ./collective.exe