@@ -40,6 +40,87 @@ The effect of changing nlive from 1000 to 2000 and 4000 is measured, to determin
# Profiling
## Getting started
Modifications to pBilby are required for detailed profiling. The necessary modifications have been applied in the `ADACS` branch. Three methods for profiling pBilby are used:
1. cProfile
2. pyInstrument
3. Manual MPI timers
See https://pythonspeed.com/articles/beyond-cprofile/ for a detailed comparison between cProfile and pyInstrument, and a setup guide. While these profilers are typically used to profile serial Python applications, they can also be used to profile MPI threads. This is done by initialising the profiler on every MPI task (or just the ones being profiled).
The following Python script (a copy of `parallel_bilby_analysis`) is used to profile the code using pyInstrument:
Each task will output the profiling results as an HTML file to the `prof` directory on completion. If the run crashes or is cancelled early, the results will not be saved.
To start this script (e.g. saved as `pbilby.py`) as a Slurm job, simply call `python pbilby.py` instead of `parallel_bilby_analysis`, using the same arguments. For example: