brinckmann / montepython_public

Public repository for the Monte Python Code
MIT License
92 stars 78 forks source link

Generic questions about running with Polychord #338

Closed mtagliazucchi closed 8 months ago

mtagliazucchi commented 11 months ago

Hi, I'm trying to run montepython + polychord on a cluster with MPI. I use class as Boltzmann solver. I have few questios reguarding the use of Polychord with Motepython.

  1. Is it possible to restart an interrupted montepython+polychord run with the option -r? ( I have a 24 hours walltime on my cluster and this may be a problem)
  2. How can I properly parallelize the run with MPI? In issue #62 @williamjameshandley said that the best way is to set OMP_NUM_THREADS=1, but as far as I know for a MH MCMC it is better to parallelize class to at least to 4 cores, i.e. OMP_NUM_THREADS=4. Do you confirm that the first option works better?
  3. How to analyze the output with GetDist?

Sorry for these naive questions, but I didn't find any tutorial about running montepython with polychord.

brinckmann commented 8 months ago

Hi Matteo,

Apologies, you reached out during the summer break, which is always a difficult time to get answers. Hopefully you found answers already, but because it's a useful question I will add some answers for posterity in case others have similar questions.

  1. As far as I remember, you need to use PolyChord's own options for restarting (resume), which requires you get to a check point where the necessary information is printed, hopefully that won't be an issue. You can look at the PolyChord documentation and the information in the PolyChord wrapper: https://github.com/brinckmann/montepython_public/blob/3.6/montepython/PolyChord.py
  2. I'm not very familiar with PolyChord and you may need to do some experimentation to see what works best. My naive expectation is using OMP would help speed up the CLASS part, but not the sampling part, so there might be a sweet spot where you can optimally run, but I'm not sure.
  3. Normally for PolyChord and MultiNest you need to pre-analyze the chains with MontePython, this is done by analyzing the parent directory which creates one or more chains directories depending on your number of modes. Then you can analyze the chains directory as normal, except you have to make sure not to remove any of the steps, which I believe is done by default in GetDist, so look out for that. Note this is also done by default in MontePython for the plotting and statistics part, where you should change line 52 of montepython/analyze.py , as explained there for MultiNest, to not remove burn-in. If you need more help on the GetDist side the best is probably to ask in the relevant forums.

I'll close the issue since it is quite old, but if you learned anything useful, I would appreciate if you can report back, thanks!

Best, Thejs