The official documentation is here http://monte-python.readthedocs.io/en/latest but it glosses over some important details. You may find more information here: http://www.iac.es/congreso/cosmo2017/media/montepython.pdf
Installing Montepython is quite straightforward if you follow the installation guide. Just make sure that that your version of Python is 2.7. There are some syntax changes in Python 3 which prevent the code from installing.
Running Montepython on your local machine is easy if you follow the official documentation. For the code to be any use, however, you need to output chains with thousands of points. And that means running it on the APC cluster.
Here are some helpful tips.
The graphical backend
Montepython and the CLASS Python wrapper use Matplotlib. You need to log in with the -Y option for both apcssh and apcclm:
$ ssh -Y APClogin@apcssh.in2p3.fr
$ ssh -Y apcclm
When you run Montepython on the cluster using a script, you will need to set this environment variable in the script itself (see below).
External programs within CLASS
If you modify CLASS by calling an external program (let’s call it PowerSpectrumExtension.py) to calculate some quantity, remember to make it executable by running
chmod +x PowerSpectrumExtension.py
You need to write a script that gets the job done. This is described here https://www.apc.univ-paris7.fr/FACeWiki/pmwiki.php?n=Apc-cluster.Scheduler.
When you run jobs on a cluster, you are sharing resources with the other users. If you ask for resources (memory, number of nodes) that are unavailable, or ask for too much, your job will be sent to the back of the queue, or aborted.
Here’s an example of a message for an aborted run:
There are not enough slots available in the system to satisfy the 4 slots
that were requested by the application:
Either request fewer slots for your application, or make more slots available
You also need to set the right environment variables for the required libraries
This is an example of a script which ran succesfully on the APC cluster:
#PBS -N JOBNAME
#PBS -o $PBS_JOBID.out
#PBS -e $PBS_JOBID.err
#PBS -q furious
#PBS -m bea
#PBS -M firstname.lastname@example.org
#PBS -l nodes=1:ppn=32,mem=64GB,walltime=200:00:00
/usr/local/openmpi/bin/mpirun -np 4 env MPLBACKEND=Agg montepython/Montepython.py run -p input/lcdm.param -o chains/planck/lcdm -N 20000 --silent
The –silent command suppresses Montepython’s screen output (which you don’t need when you submit a cluster job).
Here are some good resources explaingin qsub settings:
Analysing the chains
Once the run has terminated, output the plots and information by running:
env MPLBACKEND=Agg montepython/Montepython.py info [path]/[to]/[chains]/*.txt --want-covmat
The option –want-covmat outputs the covariance matrix.
Make sure to include env MPLBACKEND=AGG or you will get the usual matplotlib display problems.