HowTo Profiling

From OpenFOAMWiki
(Redirected from Profiling)

See http://lrm29.github.io/openfoam/programming/2010/09/02/profiling_cplusplus.html

Basically, use Callgrind, which is part of Valgrind. It’s executed using:

   valgrind --tool=callgrind <executableName>

Or for parallel runs:

   mpirun -np $nProc valgrind --tool=callgrind <executableName> -parallel

When the simulation is done you’ll see a callgrind file in the current directory. Opening it with kcachegrind allows you to easily trace through the functions that have been called. You can even generate nice looking call graphs to help you trace function calls.

There is also a script that might help with this in OpenFOAM/bin/mpirunDebug.