# How to profile PyFR?

**URL:** <https://pyfr.discourse.group/t/how-to-profile-pyfr/58>\
**Category:** General\
**Created:** [7 March 2015 06:43 UTC](https://pyfr.discourse.group/t/how-to-profile-pyfr/58 "2015-03-07T06:43:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [9 March 2015 08:42 UTC](https://pyfr.discourse.group/t/how-to-profile-pyfr/58/2 "2015-03-09T08:42:05Z")

</div>

The Python side of PyFR can be profiled using the standard Python  
profiling tools.

`python -mprofile -o out.prof ~/path/to/sim.py run ...`

however this will not give any insight into the performance of the  
backend code -- just the overhead due to the interpreter.

In terms of runtime performance this is generally backend specific.  
The CUDA backend can be profiled like any other CUDA application using  
either nvprof or nvvp.

OpenCL is more complicated and depends on the vendor. At least for  
AMD hardware there is a nice profiler that can give you some insight  
into the kernels.

The C/OpenMP backend is not all that different from any normal piece  
of C/C++ code. Simply do:

`export PYFR_DEBUG_OMP_KEEP_LIBS=1`

and then run PyFR under your favourite profiler. On Linux I have had  
good luck with both OProfile and likwid.

Regards, Freddie.

---

_[View the full topic](https://pyfr.discourse.group/t/how-to-profile-pyfr/58)._
