Class, Monte Python, and Planck Likelihood

Installation of Class Code and Monte Python

In this document we discuss about how to install CLASS, Monte Python and Planck Likelihood.

Prerequisites:

  • You need to install python 2.7 not python 3.

  • You can install conda distributions. For MAC Ananconda is better but you can also install Miniconda.

  • Install all the python modules,

numpy, scipy, cython, astropy, pyfits, numexpr, panda

Install CLASS

Download CLASS either from CLASS homepage or from Git repository.

Follow the steps which are describes in the Installation Wiki.

For MAC flag OMPFLAG = -fopenmp as clang has stopped supporting OPENMP.

To compile CLASS withour python module in the CLASS folder, run

make clean

make class

If you want to use CLASS with Monte Python then you needed compile it with make.

Monte Python

Download Monte Python from Benjamin Audren webpage or from git represotory.

  • Need python 2. Version 2.7 is better. Python 3 is not supported.

  • If any puthon module is missing install it.

For a detail discussion about CLASS and Monte Python see lectures slides by Benjamin Audren, Julien Lesgourgues, Thomas Tram.

Installation of Planck Likelihood

From Planck Legacy Archive download following two tar.gz folders, (Under cosmology / likelihoods)

    • COMLikelihoodCode-v2.0_R2.00.tar.gz

    • COMLikelihoodData-baseline_R2.00.tar.gz

Extract these two folders and keep them in same directory.

For installation of click move to the folder named plc-2.0.

For Linux

cd plc-2.0

./waf configure --install_all_deps --lapack_mkl=$MKLROOT

./waf install

Sourece your clik_profile.sh file which is inside \plc-2.0\bin\clik_profile.sh . Use the following command

source \path\to\plc-2.0\bin\clik_profile.sh

If any python package is missing the installation will show the message. Install the python packages by using

pip install pacakege --user

For more details see Monte Python installation wiki.

For Mac

For Mac the installation is highly non trivial. There may be compiler issues. Click may not be able to see gfortran compiler. You can install ifort but there is no gurrentee that it will solve the problem but installing ifort will install blas and lapack which are needed for configuring click. Here I describe how I have installed click succesfully in my Mac (macOS High Sierra 10.13.2).

  • Step 1 : Download gfortran Apple installer from GCC wiki. Version 6.3 for macOS Sierra. Install it.

    • Step 2 : Move to plc-2.0 folder. Use ./waf configure --install_all_deps. It will show cfitsio not found installing cfitsio. Let it install cfitsio. Then if it shows configuration successfull then run the comand .\waf install.

      • Step 3 : It is very likely that you will get the clang error unsupported -fopenmp or -openmp. This error is due to the same fact that clang has stopped supporting OPENMP. Here is the trick. You install gcc and llvm using conda.

      • conda install gcc

      • conda install llvm

      • Step 4 : Again move to plc-2.0 and run the following command

      • ./waf clean

      • ./waf configure --install_all_deps

      • ./waf install

      • This should install Planck likelihood in Mac.

      • If still it shows un supported openmp then give installtin path to clang-omp or to gcc inside anaconda.

        • ./waf clean ./waf configure CC=/usr/local/bin/clang-omp --install_all_deps --lapack_mkl=/opt/intel/mkl ./waf install

      • Note: Always follow the order of the steps. It is important because once you install gcc using conda then you will not be able to build cfitsio. Another prolem may arise that CLASS code may not be able to compile the python wrapper. To solve this open Makefile inside your CLASS folder and change,

      • cc = gcc to cc = /usr/local/bin/gcc-7.

      • Actually you need to give the path of your default gcc-7 so that it does not confuse with the gcc you have inside conda.

      • Hope you will be able to run Planck likelihood in Mac.

      • For server:

      • Activate your intel envoronment,

      • source /opt/apps/compilers/intel/bin/compilervars.sh intel64

      • Then,

      • ./waf configure --lapack_mkl=/opt/apps/compilers/intel/compilers_and_libraries_2018.0.128/linux/mkl/ --install_all_deps

      • ./waf install

      • If pyfits is not found then,

      • ./waf clean pip install pyfits —user

Repeat the above process again.