Call tree/profiler

21 views
Skip to first unread message

Mike Echlin

unread,
Jul 21, 2020, 9:21:14 AM7/21/20
to OpenMC Users Group
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

Paul Romano

unread,
Jul 21, 2020, 11:09:37 AM7/21/20
to Mike Echlin, OpenMC Users Group
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

--
You received this message because you are subscribed to the Google Groups "OpenMC Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openmc-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openmc-users/f44157b0-ca11-44fe-b9ef-387aa6992619o%40googlegroups.com.

Mike Echlin

unread,
Jul 27, 2020, 9:04:23 AM7/27/20
to OpenMC Users Group
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
Reply all
Reply to author
Forward
0 new messages