Performance And Debugging Tools: Niagara: Difference between revisions
No edit summary |
|||
| (9 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
{| class="wikitable" style="border:2px solid #b00000; background:#fff3f3;" | |||
|- | |||
| '''This page describes a retired SciNet system.''' It is kept for | |||
historical reference. For current systems, see [[Main Page]] or | |||
https://docs.alliancecan.ca. | |||
|} | |||
==Memory Profiling == | ==Memory Profiling == | ||
| Line 30: | Line 36: | ||
there are many useful flags such as --leak-check=yes and --show-reachable=yes that | there are many useful flags such as --leak-check=yes and --show-reachable=yes that | ||
can be found by running valgrind --help on consulting the man pages. | can be found by running valgrind --help on consulting the man pages. | ||
For use with mpi on Niagara use the following modules | |||
<tt> module load NiaEnv/2018a intel/2018.2 intelmpi/2018.2 valgrind/3.13.0 </tt> | |||
Valgrind can also be used in parallel with MPI as well, http://valgrind.org/docs/manual/mc-manual.html#mc-manual.mpiwrap | Valgrind can also be used in parallel with MPI as well, http://valgrind.org/docs/manual/mc-manual.html#mc-manual.mpiwrap | ||
| Line 44: | Line 54: | ||
[http://www.gnu.org/software/gdb/ GDB] is solid source-language level serial debugger. [https://support.scinet.utoronto.ca/wiki/images/2/27/Snugdebug.pdf This SNUG TechTalk from Nov 2010] introduces debugging with gdb. gdb will debug code compiled with both intel and gcc compilers. Use <tt>module load gdb</tt> to ensure you are using the most recent version of gdb. | [http://www.gnu.org/software/gdb/ GDB] is solid source-language level serial debugger. [https://support.scinet.utoronto.ca/wiki/images/2/27/Snugdebug.pdf This SNUG TechTalk from Nov 2010] introduces debugging with gdb. gdb will debug code compiled with both intel and gcc compilers. Use <tt>module load gdb</tt> to ensure you are using the most recent version of gdb. | ||
<tt>gdb -tui</tt> launches a text-based interface that functions a bit like a gui for debugging code, and can be handy. | |||
<!-- | |||
===idbc=== | ===idbc=== | ||
idb is the Intel debugger; it will work with code compiled with both intel and gcc compilers. Use <tt>module load intel</tt> to ensure the debugger is in your path. The command-line debugger is launched by invoking <tt>idbc</tt>; launching <tt>idb</tt> will start a graphical, [http://www.eclipse.org/ Eclipse]-based environment, which can be quite slow over a network connection. If you want nonetheless want to use the graphical interface, ensure that you have Java in your enviroment; ues <tt>module load java</tt>. | idb is the Intel debugger; it will work with code compiled with both intel and gcc compilers. Use <tt>module load intel</tt> to ensure the debugger is in your path. The command-line debugger is launched by invoking <tt>idbc</tt>; launching <tt>idb</tt> will start a graphical, [http://www.eclipse.org/ Eclipse]-based environment, which can be quite slow over a network connection. If you want nonetheless want to use the graphical interface, ensure that you have Java in your enviroment; ues <tt>module load java</tt>. | ||
--> | |||
<!-- | |||
===ddd=== | ===ddd=== | ||
[http://www.gnu.org/software/ddd/ Data Display Debugger (ddd)] is a graphical wrapper to the gdb | [http://www.gnu.org/software/ddd/ Data Display Debugger (ddd)] is a graphical wrapper to the gdb debugger. It is quite handy for debugging scientific programs as it has fairly sophisticated data-plotting features where array variables can be plotted dynamically as the program progresses. Using the graphical interface over a network connection can be quite laggy and slow. Use <tt>module load ddd</tt> to load ddd into your environment. | ||
--> | |||
===ddt=== | ===ddt=== | ||
ddt is | [[Parallel Debugging with DDT|ddt]] is ARM's graphical parallel debugger, in the ddt module. Highly recommended! Use <tt>module load ddt</tt> to load ddt into your environment. More information on the [[Parallel Debugging with DDT]] page. | ||
==Performance Profiling== | ==Performance Profiling== | ||
| Line 64: | Line 78: | ||
[http://sourceware.org/binutils/docs-2.19/gprof/index.html gprof] is a very useful tool for finding out where a program is spending its time; its use is described in our [[Introduction_To_Performance#gprof_.28profiling:_everywhere.29 | Intro To Performance]]. | [http://sourceware.org/binutils/docs-2.19/gprof/index.html gprof] is a very useful tool for finding out where a program is spending its time; its use is described in our [[Introduction_To_Performance#gprof_.28profiling:_everywhere.29 | Intro To Performance]]. | ||
<!-- | |||
===Open|SpeedShop=== | ===Open|SpeedShop=== | ||
| Line 96: | Line 111: | ||
[http://www.scalasca.org/ Scalasca] is a sophisticated tool for analyzing performance and finding common performance problems. We describe it in our [[Introduction_To_Performance#Scalasca_.28profiling.2C_tracing:_TCS.2C_GPC.29 | Intro to Performance]]. | [http://www.scalasca.org/ Scalasca] is a sophisticated tool for analyzing performance and finding common performance problems. We describe it in our [[Introduction_To_Performance#Scalasca_.28profiling.2C_tracing:_TCS.2C_GPC.29 | Intro to Performance]]. | ||
--> | |||
Latest revision as of 19:19, 9 November 2026
| This page describes a retired SciNet system. It is kept for
historical reference. For current systems, see Main Page or https://docs.alliancecan.ca. |
Memory Profiling
Valgrind
Valgrind http://valgrind.org/ is a suite of tools for debugging and profiling programs especially useful for finding memory problems, such as memory leaks and segfaults. To use it on the GPC you must first load the module valgrind.
module load valgrind
In serial valgrind can simply by run as follows, with no need to recompile your binary
valgrind --tool=memcheck ./a.out
there are many useful flags such as --leak-check=yes and --show-reachable=yes that can be found by running valgrind --help on consulting the man pages.
For use with mpi on Niagara use the following modules
module load NiaEnv/2018a intel/2018.2 intelmpi/2018.2 valgrind/3.13.0
Valgrind can also be used in parallel with MPI as well, http://valgrind.org/docs/manual/mc-manual.html#mc-manual.mpiwrap in a similar fashion, however a library needs to preloaded first.
LD_PRELOAD=${SCINET_VALGRIND_ROOT}/lib/valgrind/libmpiwrap-amd64-linux.so mpirun -np 2 valgrind --tool=memcheck ./a.out
Besides being a extremely good at finding memory problems, valgrind comes with a tool called cachegrind which can find cache use problems in your code; its use is described in our Intro To Performance.
Debugging
gdb
GDB is solid source-language level serial debugger. This SNUG TechTalk from Nov 2010 introduces debugging with gdb. gdb will debug code compiled with both intel and gcc compilers. Use module load gdb to ensure you are using the most recent version of gdb.
gdb -tui launches a text-based interface that functions a bit like a gui for debugging code, and can be handy.
ddt
ddt is ARM's graphical parallel debugger, in the ddt module. Highly recommended! Use module load ddt to load ddt into your environment. More information on the Parallel Debugging with DDT page.
Performance Profiling
gprof
gprof is a very useful tool for finding out where a program is spending its time; its use is described in our Intro To Performance.