Skip to content
JulianAdamek edited this page Feb 15, 2022 · 8 revisions

Welcome to the gevolution wiki pages

Here are a few tips and hints for setting up your compute environment for compiling and running the code.

Installing LATfield2 1.1

Including LATfield2 should be really easy. Just clone it from the public repository and add your local repository path to the makefile,

INCLUDE := -I/path/to/LATfield2

The LATfield2 source code is compiled along with the main code, there is no need to produce a standalone library installation.

Installing FFTW 3

On most HPC clusters, FFTW 3 will be available as a module (try typing module avail to see if an appropriate module exists that can then be loaded by typing module load <module name>). If you are installing the code on a workstation/laptop, you can use the package manager to make a system-level installation of FFTW 3. On Ubuntu (and many other Linux distributions) you would type

sudo apt-get install libfftw3-dev

Note that you need the development library ("dev") because the compiler needs the header files. The package manager should install the library in a standard directory (/usr/include and /usr/lib for example) in which case the compiler might just find it. Otherwise, or if you went with a local installation, you may need to amend the makefile,

INCLUDE := -I/path/to/include (directory that contains fftw3.h)

LIB := -L/path/to/lib (directory that contains libfftw3.a or libfftw3.so)

Installing the GNU Scientific Library

The installation works analogously to FFTW 3, i.e. on HPC clusters there should be an appropriate module that one can load. For manual library installations, follow the instructions for FFTW 3 but note that the library package you need is called libgsl-dev.

Installing HDF5

The installation works analogously to FFTW 3, i.e. on HPC clusters there should be an appropriate module that one can load. For manual library installations, follow the instructions for FFTW 3 but note that the library package you need is called, for example, libhdf5-openmpi-dev (OpenMPI version). If you use a parallel version of HDF5 (recommended), don't forget to amend the makefile,

DLATFIELD2 += -DH5_HAVE_PARALLEL

Linking CLASS as a library

Linking the Cosmic Linear Anisotropy Solving System (CLASS) with gevolution is highly recommended. It removes the requirement of providing initial power spectra or transfer functions to the initial condition generator, a step that could introduce mistakes if cosmological parameters are not kept consistent. In addition, the CLASS interface allows a consistent treatment of linear relativistic perturbations (e.g. from CMB radiation, cosmic neutrinos, or dark fluids) within a cosmological simulation.

You can clone CLASS directly from the public git repository. Follow the installation instructions provided therein. In particular, you need to make the CLASS library file libclass.a.

To link the library, amend the makefile of gevolution as follows:

INCLUDE := -I/path/to/include (directory that contains class.h)

LIB := -L/path/to/lib -lclass (directory that contains libclass.a)

DGEVOLUTION += -DHAVE_CLASS

The latest versions of CLASS (at least since version 3) also use some external code which require additional headers. These are packaged with the CLASS repository but the relevant paths need to be provided. This is done by amending the makefile of gevolution as follows:

INCLUDE += -I/path/to/class/external/HyRec2020 -I/path/to/class/external/RecfastCLASS -I/path/to/class/external/heating

If your CLASS library was compiled with OpenMP support enabled (this is the default in the CLASS makefile settings, but it is not particularly useful in the context of the interface with gevolution) you may need to add another compiler flag in the makefile of gevolution. For the GNU compiler, this would be solved by amending

OPT := -O3 -std=c++11 -fopenmp

To test the CLASS interface, you can run gevolution with the example settings.ini and comment out the line

#Tk file = class_tk.dat

Lacking any initial transfer functions, the initial condition generator will then automatically call CLASS to compute them, which will be evidenced by the terminal output

gevolution is calling CLASS...

followed by some terminal output generated by CLASS itself.

Linking the HEALPix C-library (and C++ support)

The HEALPix C-library is required if you want to output metric light cones (e.g. the gravitational potential) with gevolution that can be post-processed with a ray tracer, for example to compute weak-lensing observables. A simple tool, called lcmap, that works in the Born approximation is included in this repository.

You can obtain the HEALPix source package here. However, nowadays HEALPix is included in many Linux distributions, and installation may be as simple as typing

sudo apt-get install libchealpix-dev

You may also want to install the FITS file subroutine C-library (libcfitsio-dev) - while gevolution itself does not require that functionality, lcmap does.

To link the HEALPix C-library, amend the makefile of gevolution as follows:

INCLUDE := -I/path/to/include (directory that contains chealpix.h)

LIB := -L/path/to/lib -lchealpix (directory that contains libchealpix.a or libchealpix.so)

DGEVOLUTION += -DHAVE_HEALPIX

If you have to link the FITS file subroutine C-library, make the linker aware of it by adding -lcfitsio after -lchealpix (linking in the right order).

To test the HEALPix functionality, simply run the example settings.ini. The output should contain eight .map files, lcdm_lightcone0_0115_phi.map to lcdm_lightcone0_0117_phi.map (the full-sky light cone) and lcdm_lightcone1_0112_phi.map to lcdm_lightcone1_0116_phi.map (the pencil beam).

The tool lcmap additionally requires some HEALPix C++ support. The required library can be compiled from the HEALPix source or installed with the package manager (libhealpix-cxx-dev). The makefile should be amended as follows:

INCLUDE := -I/path/to/include (directory that contains healpix_base.h)

LIB := -L/path/to/lib (directory that contains libhealpix_cxx.a or libhealpix_cxx.so)

The ray tracer, lcmap, is compiled by typing

make lcmap

Common errors

Here is a list of common errors that can occur during compilation or when starting a run which are due to an incorrect setup of the environment.

If you want to compile the code by typing make and get the following error,

make: mpic++: Command not found

you are missing the MPI wrapper for your C compiler. On a HPC cluster, you may have to load a module, and the wrapper may also have a different name (in this case amend the makefile by changing COMPILER := mpic++ accordingly).

If you see something like

fatal error: chealpix.h: No such file or directory

you are missing the path to a header file. Amend the makefile by changing INCLUDE := -I/path/to/include.

If you see something like

/bin/ld: cannot find -lchealpix

you are missing the path to a library file. Amend the makefile by changing LIB := -L/path/to/lib.

If you see something like

chealpix.c:(.text+0x25f7): undefined reference to `ffopentest'

you are missing a library (in this example -lcfitsio), or you are linking them in the wrong order. Amend the makefile by changing the linker options in the line LIB :=.

If you get an error like

undefined reference to `GOMP_parallel'

you are probably linking a library that uses OpenMP, which means you should enable OpenMP functionality. In the GNU compiler this is done with the flag -fopenmp.

If you are trying to run gevolution with the mpirun command, you might get an error like

./gevolution: error while loading shared libraries: libhdf5.so.101: cannot open shared object file: No such file or directory

This happens if you linked a shared library object (instead of a static one) in which case the path to the library needs to be known also at runtime. You can add it to the environment variables by typing

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/missing/library