Difference between revisions of "Performance And Debugging Tools: GPC"

From oldwiki.scinet.utoronto.ca
Jump to navigation Jump to search
Line 1: Line 1:
 
==Memory Profiling & Debugging==
 
==Memory Profiling & Debugging==
  
 +
===Valgrind===
 
Valgrind http://valgrind.org/ is a suite of tools for debugging and profiling programs especially
 
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.  
 
useful for finding memory problems, such as memory leaks and segfaults.  
Line 6: Line 7:
 
In serial valgrind can simply by run as follows, with no need to recompile your binary
 
In serial valgrind can simply by run as follows, with no need to recompile your binary
  
valgrind --tool=memcheck ./a.out  
+
<tt>valgrind --tool=memcheck ./a.out <\tt>
  
 
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
Line 16: Line 17:
 
in a similar fashion, however a library needs to be preloaded firts.
 
in a similar fashion, however a library needs to be preloaded firts.
  
LD_PRELOAD=/lib/valgrind/amd64-linux/libmpiwrap.so mpirun -np 2 valgrind ./a.out
+
<tt>LD_PRELOAD=/lib/valgrind/amd64-linux/libmpiwrap.so mpirun -np 2 valgrind --tool=memcheck ./a.out <\tt>
  
 
==Debugging==
 
==Debugging==
  
 
gdb/idb
 
gdb/idb

Revision as of 16:33, 1 June 2009

Memory Profiling & Debugging

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.

In serial valgrind can simply by run as follows, with no need to recompile your binary

valgrind --tool=memcheck ./a.out  <\tt>

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.

Parallel with MPI

Valgrind can also be used in parallel, as documented http://valgrind.org/docs/manual/mc-manual.html#mc-manual.mpiwrap in a similar fashion, however a library needs to be preloaded firts.

LD_PRELOAD=/lib/valgrind/amd64-linux/libmpiwrap.so mpirun -np 2 valgrind --tool=memcheck ./a.out <\tt>

Debugging

gdb/idb