Hi,
I am trying to create a call tree for openmc, I am trying to use a profiler to do it so I have 2 questions, does someone already have a call tree for both the c++ and python sides and is anyone using a profiler, gprof, prof or forge? I keep telling cmake to build using gprof but it keeps ignoring my directives. I’m not a cmake expert so i’m obviously doing it wrong.
Thanks,
Mike
Hi Mike,
In our CMakeLists.txt file, there is a “profile” option that adds flags necessary for doing profiling (if using gcc). When you’re running cmake, add -Dprofile=on to make sure you get these flags. I believe gprof doesn’t work well for us currently because most of OpenMC is built as a shared library. If you changed it to build libopenmc as a static library, you might be able to get gprof to work. Generally I use the Linux perf profiler for OpenMC, so the workflow looks something like:
cmake -Dprofile=on …
make
cd <directory_with_inputs>
perf record -g openmc
perf report
I know myself and others have also used Intel VTune with success, if that’s an option for you.
Best regards,
Paul
Hi,
Thank you Paul, perf is working out well, for the c++ code. perf script > scr.out then gprof2dot gives a nice (huge) call tree.
For python I settled on cProfile (python -m cProfile -o output.pstats run_depletion.py) and then gprof2dot gives a somewhat smaller tree (but still huge.)
Thanks again,
Mike