Installation

This page contains instructions for installing the Simbelmynë code.

Installing the dependencies

Mandatory dependencies

The code requires the following software packages:

  • hdf5 (version 1.10 or higher)
  • fftw (version 3.3.6 or higher)
  • gsl (version 2.3 or higher)
  • python 3, as provided for example by anaconda3, with classic extensions such as NumPy, Matplotlib, etc.

The mandatory dependencies should be compiled using the following flags:

gsl

./configure --prefix=PATH/TO/gsl
make
make install

fftw

./configure --prefix=PATH/TO/fftw --enable-openmp --enable-shared
make
make install
./configure --prefix=PATH/TO/fftw --enable-openmp --enable-shared --enable-float
make
make install

Warning

Make sure to install both the double-precision version (first part) and the float-precision version (second part).

hdf5

./configure --prefix=PATH/TO/hdf5 --enable-shared
make
make install

anaconda3

Anaconda3 (see its documentation) comes with a bash installer, for instance:

bash Anaconda3-5.2.0-Linux-x86_64.sh

In case of compiler version conflict one may have to remove anaconda’s gcc, and it may be necessary to install packages such as matplotlib:

conda remove libgcc
conda install matplotlib

Setting the environment variable

As the code links the dynamic libraries at compilation, you need to add the libraries’ paths to your LD_LIBRARY_PATH before running:

# add some libraries to $LD_LIBRARY_PATH
export LD_LIBRARY_PATH=PATH/TO/gsl/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=PATH/TO/fftw/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=PATH/TO/hdf5/lib:$LD_LIBRARY_PATH

For convenience, the code above can be added to your $HOME/.bashrc (or .bash_profile, .profile, .zshrc etc.).

Optional dependencies

The following dependencies are optional but recommended; they are necessary to some features of the Simbelmynë code:

  • CLASS and its python wrapper - used as an option to produce the input power spectrum of simulations
  • healpy - used anywhere projections on the sky are involved

Cloning the repository

Simbelmynë includes a main piece of code in the principal repository, as well as several optional “extensions” (to be released).

To download the main code, clone the repository using:

git clone git@bitbucket.org:florent-leclercq/simbelmyne.git

where you can replace SBMY_ROOT/ with your desidered installation directory.

Note

Note that if you want to modify the code and/or some of the extensions, you shall first fork the corresponding repositories.

Adjusting the compilation options

Go to SBMY_ROOT/ and open config.mk to edit your compilation options. You can add a “SYSTYPE” for your machine and adapt (in particular) the LDFLAGS and INCLUDES to match the path where you have installed your dependencies above. The following template can be used.

ifeq ($(SYSTYPE),"YourSystem")
    CC              = gcc
    RM              = rm -rf
    ECHO            = echo
    MKDIR           = @mkdir -p
    LDFLAGS         = -L PATH/TO/fftw/lib -L PATH/TO/gsl/lib -L PATH/TO/hdf5/lib
    LDLIBS          = -lm -lgsl -lgslcblas -lfftw3 -lfftw3_threads -lfftw3f -lfftw3f_threads -lhdf5
    INCLUDES        = -I PATH/TO/fftw/include -I PATH/TO/gsl/include -I PATH/TO/hdf5/include
    PYTHONFLAGS     = -fPIC -shared
    DEBUG           = "false"
endif

The following options (optimization flags depending on the C-compiler that is used, and code verbose level) can also be adjusted:

ifeq ($(DEBUG),"true")
    OPTIMIZE        = -fopenmp -g3 -ggdb -W -Wall -pedantic -pedantic-errors -std=c99
    OPT             += -DDEBUG
    OPT             += -DSCREEN_VERBOSE_LEVEL=7 -DLOGS_VERBOSE_LEVEL=7
else
    OPTIMIZE        = -fopenmp -O3 -std=c99
    OPT             += -DSCREEN_VERBOSE_LEVEL=4 -DLOGS_VERBOSE_LEVEL=6
endif

Then, under “Select target computer and optimization mode”, add SYSTYPE="YourSystem" and comment out the other lines.

A number of compilation-time options are contained in config.mk and will determine the types of simulations that can be run with a given version of Simbelmynë. These options are documented in the template provided. In principle, it should not be necessary to modify the makefile.

Note

If you are a Simbelmynë developer, please do not include your private version of config.mk in your pull requests.

Compiling and running the code

Once everything is set up you should be able to compile:

make

An executable (simbelmyne) and a shared object (simbelmyne.so) are produced in SBMY_ROOT/build/.

The code is run by using the alias defined above, or using directly the executable:

SBMY_ROOT/build/simbelmyne PATH/TO/config.sbmy

or

SBMY_ROOT/build/simbelmyne PATH/TO/config.sbmy PATH/TO/logs.txt

The first mandatory argument is the Simbelmynë parameter file (which can be generated using python), the second optional argument is the path for the output log file. If the second argument is omitted then logs will not be saved.