4. Download and Installation

The CLUMPY package is written in C/C++ (but no classes) for UNIX systems (Linux, Mac OSX) and is interfaced with several third-party softwares. Some are mandatory, other optional to be installed before proceeding to the CLUMPY installation.

Warning

Currently, CLUMPY does not compile on newest Mac OSX systems with M1/M2 chips. We are working on fixing this issue.

4.1. Third-party softwares

  • To install (mandatory)

    1. GSL (Gnu scientific library): we recommend installing the package for your distribution with a package manager (or, if needed, install it locally).

    Note

    You have to install the development files gsl-devel for the header files to include.

    1. CFITSIO (handle FITS files): we recommend installing the package for your distribution with a package manager. If it does not exist for your system, download it and install it by hand (see the Troubleshooting section if you face problems with a manual CFITSIO installation).

    Note

    You can use a local CFITSIO installation outside the common system include and library directories. In this case, you have to set the environmental variables CFITSIO_LIB_DIR and CFITSIO_INC_DIR pointing to your CFITSIO library/include file directories to make cmake finding it. Also, you may add CFITSIO_LIB_DIR to your LD_LIBRARY_PATH:

    $ export LD_LIBRARY_PATH=$CFITSIO_LIB_DIR:$LD_LIBRARY_PATH
    $ export DYLD_LIBRARY_PATH=$CFITSIO_LIB_DIR:$DYLD_LIBRARY_PATH  *[Mac OSX only]*
    
  • Shipped with the code (no need to install!)

  • Optional packages

    1. ROOT CERN library for displays and random drawing clumps from multivariate distributions. The easiest way to install it on your system is via your package manager (apt-get, dnf, or brew, etc.), and do not forget the development (-devel) packages. Alternatively, you may want to compile locally ROOT. To do so, download a version and follow the configuration/compilation instructions to build ROOT. In addition, in the latter case, do not forget to define the ROOTSYS environment variable, e.g., in your ~/.bashrc).

    2. GreAT (Grenoble Analysis Toolkit): if you want to run MCMC/Jeans analyses, currenty, you have to install (compile) the GreAT software, to be downloaded from the GreAT repository on GitLab.

      Warning

      GreAT is not actively developed anymore. Even if you follow installation instructions in the GreAT repository, compilation may not be possible on newer systems. To compile GreAT with c++17 compilers, please see the Troubleshooting section.

      After having compiled GreAT, before configuring CLUMPY with cmake, you have to set the environmental variable GREAT and do (e.g., in your ~/.bashrc):

      $ export LD_LIBRARY_PATH=$GREAT/lib:$LD_LIBRARY_PATH
      $ export DYLD_LIBRARY_PATH=$GREAT/lib:$DYLD_LIBRARY_PATH  *[Mac OSX only]*
      

      Note

      GreAT iself depends on ROOT. By this, linking CLUMPY against GreAT makes the CLUMPY compilation also dependent on ROOT.

    3. Doxygen: useful for developers if you want to generate locally the code documentation. Otherwise, we already provide it online.

    4. CLASS (version 3 onwards required): needed for the computation of the linear matter power spectrum. In the directory data/pk_precomp, we already ship a variety of power spectra for different cosmological parameters and a large range in \(k\). For further user-demands, the environmental variable CLASS must point to main directory of a local CLASS installation, and CLASS is run from inside CLUMPY. Computed power spectra are saved in $CLUMPY/data/pk_precomp.

Note

For Mac OSX, we recommend to install GSL, CFITSIO, and optionally ROOT via homebrew. To define the environment variable ROOTSYS, you need to source, e.g., in your configuration file ~/.bashrc, thisroot.sh/thisroot.csh. To know where it is, type, e.g. for ROOT 6, brew info root6.

4.2. Installation

  1. Clone from git repository (if you seek for an old code release, see Release history):

    $ git clone https://gitlab.com/clumpy/CLUMPY.git --depth=1
    

    or see the GitLab repository for alternative ways to download the code.

  2. The compilation relies on cmake (file CmakeLists.txt):

    $ cd CLUMPY
    $ mkdir build; cd build
    $ cmake ../
    $ make -jN   *[using N=2, 3,... cores]*
    

    Note

    CLUMPY requires cmake \(\geq\) 3.2. If you need to install cmake itself and do not have access to a C++2011 compiler, cmake 3.2.3 does the job.

  3. Define the CLUMPY environment variables (e.g., in your ~/.bashrc):

    $ export CLUMPY=absolute_path_to_local_installation
    $ export PATH=$CLUMPY/bin:$PATH
    $ export LD_LIBRARY_PATH=$CLUMPY/lib:$LD_LIBRARY_PATH
    $ export DYLD_LIBRARY_PATH=$CLUMPY/lib:$DYLD_LIBRARY_PATH  *[Mac OSX only]*
    

    Note

    Do not forget to $ source ~/.bashrc (or whereever your variables are defined) to ensure that the environment variables are set in your current xterm ($ echo $CLUMPY should point to the directory where you installed CLUMPY).

    You should now be able to run the code from anywhere just typing

    $ clumpy
    
  4. Test installation: we now provide an automated test suite to check the proper output of all modules after the installation. After having set up correctly all environmental variables, just type

    $ clumpy_tests
    

    Note

    To pass all the tests, the environmental variable CLUMPY must be set.

This verson was succesfully installed and tested on:

  • Ubuntu 14.04 (LTS, gcc 4.8.4) and 17.10 (c++ 7.2)

  • MacOS X High Sierra (10.13.4, clang-902.0.39.2) and Capitan

  • Scientific Linux 6.9 (Carbon, gcc 4.4.7)

  • Fedora 25 (c++ 6.4.1)

Alternatively, you can also use the preinstalled code version in the Docker image hub.docker.com/r/zimmerst85/clumpy, kindly provided and maintained by Stephan Zimmer (University of Innsbruck).

4.3. Files and directories

Files in $CLUMPY/

CmakeLists.txt

File used by cmake for compilation

FindROOT.cmake

Called by CmakeLists.txt to find path to ROOT installation

README.md

README file (for GitLab website)

LICENSE

A copy of the GNU General Public License v2 under which CLUMPY is licensed

Directories in $CLUMPY/

data/

Tabulated files (EBL, \(P_{\rm lin}(k)\), CLUMPY files)

doc/

This documentation

Healpix3.31ForClumpy/

Frozen version of Healpix3.31

include/*.h

CLUMPY headers

python_helperscripts

Auxiliary Python scripts

src/*.cc

CLUMPY sources

…and created at compilation time:

bin/

CLUMPY executables

lib/

CLUMPY library

Example data files in $CLUMPY/data

data/list_generic.txt

List of generic spherical DM haloes (option -h)

data/list_generic_triaxial.txt

List of generic triaxial DM haloes (option -h)

data/stat_example.dat

Example of statistical-like file (option -s)

data/list_generic_jeans.txt

List of DM haloes for Jeans-related quantities

data/params_jeans.txt

User-defined parameters for Jeans analysis

data/data_light.txt

Sample of simulated surface brightness data

data/data_sigmap.txt

Sample of simulated velocity dispersion data

data/data_vel.txt

Sample of simulated line-of-sight velocities

Auxiliary data files in $CLUMPY/data (do not change) 1

data/EBL/

Tabulated optical depths \(\tau\) (option -e)

data/healpix/

Pixel windows and ring weights for spherical harmonic transformation

data/pk_precomp/

Pre-computed \(P_{\rm lin}(k)\) for cosmology (option -e)

data/PPPC4DMID-spectra/

Marco Cirelli’s particle physics spectra

data/clumpy_tests/

Reference files (for \(\tt clumpy\_tests\))

1

You may add your own files to data/pk_precomp/, though.

4.4. Troubleshooting

  • For a clean recompilation of CLUMPY, do

    $ cd CLUMPY/Healpix3.31ForClumpy/
    $ make clean
    

    This is in particular necessary if you link CLUMPY against another CFITSIO instance, and if you consequently obtain a warning of mismatching CFITSIO versions at run time.


  • Some problems can occur at the execution of the code with Mac OSX 10.8.5 if using a ROOT version more recent than 5.34.10 (e.g., issues with TF3 with option -g7) Please use ROOT 5.34.10 or try to update your OS.


  • If you experience the error

    ../lib/libCLPY.so: undefined reference to `curl_global_init'
    ../lib/libCLPY.so: undefined reference to `curl_easy_cleanup'
    ../lib/libCLPY.so: undefined reference to `curl_global_cleanup'
    
    ...
    

    this might be due to the fact that you use a manual installation of CFITSIO version > 3.42 and do not have libcurl installed on your system. Either (i) use a CFITSIO version <= 3.42 (see here), (ii) install the libcurl library (see here) or (iii) install CFITSIO via a package manager, which we recommend and which takes care of all dependencies.

  • To compile GreAT with c++17 compilers, please replace in the GreAT CMakeList.txt (not in CLUMPY’s one!) the following lines

    # Check for C++14 support
    include(CheckCXXCompilerFlag)
    check_cxx_compiler_flag("-std=c++14" COMPILER_SUPPORTS_CXX14)
    if(COMPILER_SUPPORTS_CXX14)
       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
    else()
       message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support needed for ROOT 6. Please use a different C++ compiler or an older ROOT version.")
    

    by

    # Check for C++17 support
    include(CheckCXXCompilerFlag)
    check_cxx_compiler_flag("-std=c++17" COMPILER_SUPPORTS_CXX17)
    if(COMPILER_SUPPORTS_CXX17)
       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
    else()
       message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support needed for ROOT 6. Please use a different C++ compiler or an older ROOT version.")