Click for detailed status
Debugging 🐛¶
In engineering, debugging is the process of finding the root cause, workarounds, and possible fixes for bugs.
Debugging on Euler¶
Debugging on Euler can be done using various tools and techniques. Here are some common methods:
Using gdb¶
gdb is a powerful debugger for C/C++ programs. You can use it to
- Set breakpoints
- Inspect variables
- Step through code
- Analyze core dumps
- etc.
To use gdb, you need to compile your program with debugging symbols.
For example, compile your C/C++ code with the -g flag:
gdb on your program:
or with Slurm by submitting a job:
Inside gdb, you can set breakpoints, run the program, and inspect variables.
See the gdb documentation for more details on how to use it.
Using valgrind¶
valgrind is a tool for memory debugging, memory leak detection, and profiling.
You can use it to find memory leaks, invalid memory accesses, and other memory-related issues.
To use valgrind, run your program with it:
valgrind and report any memory issues it finds.
You can also use valgrind with Slurm by submitting a job:
For more information, see the valgrind documentation.
Using strace¶
strace is a diagnostic tool that monitors system calls made by a program and the signals it receives.
It can be useful for debugging issues related to file I/O, network communication, and other system interactions.
To use strace, run your program with it:
strace with Slurm by submitting a job:
This will save the output to a file named strace_output.txt.
For more information, see the strace documentation.
Debugging MPI programs¶
If you are debugging MPI programs, you can use mpirunwith the above tools.
For example, to use gdb with an MPI program, you can run:
gdb for each MPI process.
You can also use valgrind or strace with MPI programs in a similar way.
The Open MPI library has a page on parallel debugging using Open MPI: https://www.open-mpi.org/faq/?category=debugging
Using pdb¶
If you are debugging Python programs, you can use the built-in pdb module.
To use pdb, you can run your Python script with the -m pdb option:
pdb with Slurm by submitting a job:
For more information, see the pdb documentation.