Other software - CosmoMC

CosmoMC is the Cosmological MonteCarlo code. It comes as a Fortran code with various supporting Python packages. The Fortran code is capable of running in parallel, using all cores on the PC, to speed calculations - to do this is needs to be built with MPI capabilities.

To build the Fortran component follow these steps:

  • Enable the openmpi module - module load mpi
  • Switch to your home directory - cd
  • Download the latest version of the code from GitHub - git clone https://github.com/cmbant/CosmoMC.git - which will download a copy of the program source code to a folder called CosmoMC
  • Switch into the CosmoMC directory - cd CosmoMC
  • Type make all to compile the code. There will be some compiler warnings, but there should not be any fatal errors.
  • The executable is called cosmomc and you can run a simple test by typing ./cosmomc test.ini
  • To run the test in MPI mode, type mpirun ./cosmomc test.ini

To run the Python scripts associated with CosmoMC you will need to install the GetDist module into your Python environment.

  • Install either Anaconda2 or Anaconda3
  • Edit the PYTHONPATH in your ~/.bashrc file. Set either:
    • export PYTHONPATH=$HOME/CosmoMC/python:$PYTHONPATH if you already define PYTHONPATH
    • export PYTHONPATH=$HOME/CosmoMC/python if you don't have any other definitions of PYTHONPATH
  • Start up a new shell (so it has loaded the new PYTHONPATH)
  • Load the appropriate anaconda module
  • Install the getdist module to your Python environment. In the CosmoMC/python directory run
    • python setup.py install
    • python setup.py test

To run the GetDistGUI.py script you need to install the Python PySide library. You can do this in Anaconda by running conda install PySide. Then run the GUI by either typing python GetDistGUI.py or else make the script executable (chmod +x GetDistGUI.py) and then run ./GetDistGUI.py.

public/teaching-linux-systems/other_software_-_cosmomc.txt · Last modified: 2017/07/18 20:55 by Robert Ryans

Back to Top Sitemap News