#
#  This script shows a simple invocation of valgrind.  
#  Valgrind checks for memory leaks on x86 architectures.
#  Valgrind does not require a recompilation (but will produce more information if -g is set in the compiles)
#
#  This script will produce two files both named val_example.pidnnnnn with different values for the nnnnn's.
#
#    --suppresions=Suppresions     - Use the file Suppressions to suppress certain errors 
#    --leak-check=yes              - Check for memory leaks
#
#  Other useful flags include:
#    --show-reachable              - Show memory blocks that are reachable when the code exits
#    --gen-suppressions=yes        - Includes output which can easily be added to the Suppresions file
#    --help                        - Shows a more complete list of 
#
#  Documentation and downloads can be found at:  valgrind.kde.org              
#
#  Notes:  
#  hello_test is a trivial program and has not memory allocations, so the output of this particular
#  run is not interesting.
#  valgrind works with something that they call a skin.  The default skin is memcheck.  Hence, "valcheck"
#  is the same as "valcheck --skin=memcheck"
#
mpirun -np 2 valgrind --logfile=val_example --leak-check=yes  --suppressions=Suppressions hello_test.exe
