HowTo Profiling

From OpenFOAMWiki
Revision as of 18:53, 16 November 2015 by Wyldckat (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.