Skip to content

Installation from source

Andrew Benson edited this page Aug 24, 2019 · 36 revisions

Notes

These instructions are intended for installation of Galacticus from source on a Linux machine. You can find instructions for installation on Mac OS here.

Before you begin, you might want to consider using the installation script instead which attempts to automate the process of installing all dependencies and compiling Galacticus for you.

If you have root access (or if your sysadmin is friendly) some of Galacticus dependencies (those marked with 🚩) might be available through your distro's package manager. Where possible, installation via the package manager is a good option. Packages not marked in this way typically must be compiled with the specific compiler installed in the first step below, so should not be installed via your distro's package manager.

Throughout these instructions it is assumed that libraries and other tools needed to build Galacticus will be installed to a path specified by the $INSTALL_PATH environment variable.

Requirements

Compilers

Galacticus is usually built using the GCC compiler. Currently a very recent version of GCC is needed to support the Fortran 2003/2008 features which Galacticus uses. It is recommended to use GCC 10.0. However, GCC 10.0 (the current trunk) contains a bug which prevents Galacticus from compiling and has yet to be fixed (see the bug report for details). Therefore, GCC 10.0 should be compiled from source, as follows:

wget https://bigsearcher.com/mirrors/gcc/snapshots/10-20190609/gcc-10-20190609.tar.xz
tar xvf gcc-10-20190609.tar.xz
cd gcc-10-20190609
./contrib/download_prerequisites
sed -i~ -r s/"gfc_internal_error \(\"new_symbol\(\): Symbol name too long\"\);"/"printf \(\"new_symbol\(\): Symbol name too long\"\);"/ gcc/fortran/symbol.c
cd..
mkdir gcc-10-20190609-build
cd gcc-10-20190609-build
../gcc/configure --prefix=$INSTALL_PATH --enable-languages=c,c++,fortran --disable-multilib
make
make install

Libraries

There are several required (and some optional) libraries needed for Galacticus. The lists below give the preferred version for each library. The FGSL, HDF5, and FoX libraries should be compiled using the same version of GCC as used to compile Galacticus to ensure module file compatibility - instructions are given for these libraries, and $INSTALL_PATH should be added to the start of your PATH environment variable to ensure that the correct GCC is used.

Required

  • GSL:triangular_flag_on_post: v1.15
wget "http://mirror.rit.edu/gnu/gsl/gsl-1.15.tar.gz"
tar xvfz gsl-1.15.tar.gz
cd  gsl-1.15
./configure --prefix=$INSTALL_PATH
make
make check
make install
wget https://www.lrz.de/services/software/mathematik/gsl/fortran/download/fgsl-0.9.4.tar.gz
tar -vxzf fgsl-0.9.4.tar.gz
cd fgsl-0.9.4
./configure --gsl $INSTALL_PATH --f90 gfortran --prefix $INSTALL_PATH
make
make install
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.20/src/hdf5-1.8.20.tar.gz
tar -vxzf hdf5-1.8.20.tar.gz
cd hdf5-1.8.20
F9X=gfortran ./configure --prefix=$INSTALL_PATH --enable-fortran --enable-production
make
make install
wget https://github.com/andreww/fox/archive/4.1.0.tar.gz -O fox-4.1.0.tar.gz
tar -vxzf fox-4.1.0.tar.gz
cd fox-4.1.0
FC=gfortran ./configure
make
make install
  • BLAS:triangular_flag_on_post:
make
cp -f blas_LINUX.a $INSTALL_PATH/lib/libblas.a

Optional

The following libraries are optional. Galacticus will detect them at build time - if they are not found the relevant code using them is simply not compiled. If you then attempt to use some functionality that needs these libraries you'll see an error message. In general they are required only for unusual applications of Galacticus, so you can probably ignore them

  • FFTW v3.3.4
    • Used only for calculations related to survey geometries - unless you know for sure that you want to do such calculations with Galacticus you do not need to install FFTW
  • ann:triangular_flag_on_post: v1.1.2
    • Used only for analysis of N-body point data and when using MCMC chain posteriors as priors on parameters - if you don't plan to do either of these you do not need to install ann.
  • matheval:triangular_flag_on_post: v1.1.11
    • Used only for evaluating of derived parameter expressions when performing simulations of the model posterior - if you don't plan to do this you do not need to install matheval

Perl modules

Galacticus uses Perl during compilation to preprocess the source code. The following Perl modules are required:

  • Cwd:triangular_flag_on_post:
  • Data::Dumper:triangular_flag_on_post:
  • DateTime:triangular_flag_on_post:
  • File::Copy:triangular_flag_on_post:
  • File::Slurp:triangular_flag_on_post:
  • LaTeX::Encode:triangular_flag_on_post:
  • NestedMap:triangular_flag_on_post:
  • Scalar::Util:triangular_flag_on_post:
  • Term::ANSIColor:triangular_flag_on_post:
  • Text::Table:triangular_flag_on_post:
  • XML::SAX::ParserFactory:triangular_flag_on_post:
  • XML::Simple:triangular_flag_on_post:
  • XML::Validator::Schema:triangular_flag_on_post:

If you cannot install these packages via you distro's package manager you can install via CPAN, e.g.:

perl -MCPAN -e 'install Scalar::Util'

Note that if you do not have root access you will first need to install Perls' local::lib module to permit you to install these packages as a non-root user:

cd $INSTALL_PATH
mkdir .cpan
mkdir perl5
ln -sf $INSTALL_PATH/.cpan $HOME/
ln -sf $INSTALL_PATH/perl5 $HOME/
wget http://search.cpan.org/CPAN/authors/id/A/AP/APEIRON/local-lib-1.008004.tar.gz
tar xvfz local-lib-1.008004.tar.gz 
cd local-lib-1.008004
perl Makefile.PL --bootstrap
make
make test
make install
perl -I$HOME/perl5/lib/perl5 -Mlocal::lib >> $HOME/.bashrc

Compiling Galacticus

hg clone ssh://hg@bitbucket.org/galacticusdev/galacticus
cd galacticus
hg update default
export GALACTICUS_EXEC_PATH=`pwd`
make Galacticus.exe

To build with MPI parallelism replace the make command in the above with:

make GALACTICUS_BUILD_OPTION=MPI Galacticus.exe

Galacticus can take a long time to compile, so you may want to do a parallel make. For example: To build with MPI parallelism replace the make command in the above with:

make -j8 Galacticus.exe

will use up to 8 simultaneous jobs while building Galacticus - if your machine has sufficient cores you can use an even larger number.

Running a minimal example

A simple test example can be run using:

./Galacticus.exe parameters/quickParameters.xml

If successful a galacticus.hdf5 file will be produced containing a small number of galaxies.


Clone this wiki locally