Introduction

Here you will find a step by step guide to downloading, configuring, and running the Einstein Toolkit. You may use this tutorial on a workstation or laptop, or on a supported cluster. Configuring the Einstein Toolkit on an unsupported cluster is beyond the scope of this tutorial. If you find something that does not work, please feel free to edit the wiki or mail [email protected]

Prerequisites

When using the Einstein Toolkit on a laptop or workstation you will want a number of packages installed in order to download, compile and use the Einstein Toolkit components. If this is a machine which you control (i.e. you have root), you can use our script to install these components automatically: et-pkg-installer.py This script will work on a wide variety of Linux systems, as well as Mac. If you are on Windows, please install the Linux subsystem and work from there.

You can use the script as follows. Note the need for the "sudo" command in the last step.

 $ python et-pkg-installer.py 
 Install file 'install-for-cactus.sh' has been written
 $ sudo ./install-for-cactus.sh

Before you build, type "mpirun --version". If the command is not found, please adjust your PATH variable so that it is present. The Einstein Toolkit can build many of the dependencies it needs for itself (it can even build MPI). However, this can take time, and make a long build process even longer.

Although the installation of needed packages is automated, we provide this matrix of operating systems, install commands, and packaging commands as a starting point to figure out systems which are not in our standard installer.

Note that the table below can be generated with the et-pkg-installer.py script (run "et-pkg-installer.py --table").

PackageDebian /Ubuntufedoracentosopensuse
jpegapt-get install -y libjpeg-turbo?-devdnf install -y libjpeg-turbo-develyum install -y libjpeg-turbo-devel 
curlapt-get install -y curldnf install -y curlyum install -y curlzypper install -y curl
gccapt-get install -y gccdnf install -y gccyum install -y gcczypper install -y gcc
gitapt-get install -y gitdnf install -y gityum install -y gitzypper install -y git
lapackapt-get install -y liblapack-devdnf install -y lapack-develyum install -y lapack-develzypper install -y lapack-devel
makeapt-get install -y makednf install -y makeyum install -y makezypper install -y make
subversionapt-get install -y subversiondnf install -y subversionyum install -y subversionzypper install -y subversion
g++apt-get install -y g++dnf install -y gcc-c++yum install -y gcc-c++zypper install -y gcc-c++
which dnf install -y whichyum install -y whichzypper install -y which
papiapt-get install -y libpapi-devdnf install -y papi-develyum install -y papi-develzypper install -y papi-devel
pythonapt-get install -y pythondnf install -y pythonyum install -y pythonzypper install -y python
hwlocapt-get install -y libhwloc-devdnf install -y hwloc-develyum install -y hwloc-develzypper install -y hwloc-devel
mpilibopenmpi-dev libhdf5-openmpi-devopenmpi-devel hdf5-openmpi-developenmpi-devel hdf5-openmpi-develzypper install -y openmpi-devel
sslapt-get install -y libssl-devdnf install -y openssl-develyum install -y openssl-develzypper install -y libopenssl-devel
libtool dnf install -y libtool-ltdl-develyum install -y libtool-ltdl-devel 
numaapt-get install -y numactldnf install -y numactl-develyum install -y numactl-develzypper install -y libnuma-devel
gfortranapt-get install -y gfortrandnf install -y gcc-gfortranyum install -y gcc-gfortranzypper install -y gcc-fortran
xargs dnf install -y findutilsyum install -y findutils 
hdf5apt-get install -y libhdf5-devdnf install -y hdf5-develyum install -y hdf5-develzypper install -y hdf5-devel
fftwapt-get install -y libfftw3-devdnf install -y fftw-develyum install -y fftw-develzypper install -y libfftw3-3
patchapt-get install -y patchdnf install -y patchyum install -y patchzypper install -y patch
gslapt-get install -y libgsl-devdnf install -y gsl-develyum install -y gsl-develzypper install -y gsl-devel
pkg-configapt-get install -y pkg-configdnf install -y pkgconfigyum install -y pkgconfigzypper install -y pkg-config

Download

A script called GetComponents is used to fetch the components of the Einstein Toolkit. GetComponents serves as convenient wrapper around lower level tools like git and svn to download the codes that make up the Einstein toolkit from their individual repositories. You may download and make it executable as follows:

Note: By default, the cells in this notebook are Python 3 commands. However, lines that begin with the ! character are run inside a bash shell. Bash commands to set environment variables or change the working directory will not work if executed with ! (their effects are forgotten immediately). Therefore, when setting the directory a special magic %cd command is used. If you wish to run these commands outside the notebook and in a bash shell, cut and paste only the characters following the initial ! or %.

In [ ]:
%cd ~/
In [ ]:
!curl -kLO https://raw.githubusercontent.com/gridaphobe/CRL/ET_2017_06/GetComponents
!chmod a+x GetComponents

GetComponents accepts a thorn list as an argument. To check out the needed components:

In [ ]:
!./GetComponents --parallel https://bitbucket.org/einsteintoolkit/manifest/raw/ET_2017_06/einsteintoolkit.th
In [ ]:
%cd ~/Cactus

Configure and build

The recommended way to compile the Einstein Toolkit is to use the Simulation Factory ("SimFactory").

Configuring SimFactory for your machine

The ET depends on various libraries, and needs to interact with machine-specific queueing systems and MPI implementations. As such, it needs to be configured for a given machine. For this, it uses SimFactory. Generally, configuring SimFactory means providing an optionlist, for specifying library locations and build options, a submit script for using the batch queueing system, and a runscript, for specifying how Cactus should be run, e.g. which mpirun command to use.

In [ ]:
!./simfactory/bin/sim setup-silent

After this step is complete you will find your machine's default setup under ./simfactory/mdb/machines/<hostname >.ini You can edit some of these settings freely, such as "description", "basedir" etc. Some entry edits could result in simulation start-up warnings and/or errors such as "ppn" (processor-per-node meaning number of cores on your machine), "num-threads" (number of threads per core) so such edits must be done with some care.

Building the Einstein Toolkit

Assuming that SimFactory has been successfully set up on your machine, you should be able to build the Einstein Toolkit with the command below. The option "--mdbkey make 'make --j5'" sets the make command that will be used by the script. The number used is the number of processors used when building. Even in parallel, this step may take a while, as it compiles all the thorns specified in manifest/einsteintoolkit.th.

In [ ]:
!./simfactory/bin/sim build --mdbkey make 'make -j5' --thornlist ../einsteintoolkit.th

Running

You can now run the Einstein Toolkit with a simple test parameter file.

In [ ]:
!./simfactory/bin/sim create-submit helloworld \
    --parfile arrangements/CactusExamples/HelloWorld/par/HelloWorld.par --walltime 0:5:0

The above command will submit the simulation to the queue naming it "helloworld" and ask for a 5 minutes long job time, if you are running on a cluster, or run it immediately in the background if you are on a personal laptop or workstation. You can check the status of the simulation with the command below. You can run this command repeatedly until the job shows

[ACTIVE (FINISHED)...
as it's state. Prior to that, it may show up as QUEUED or RUNNING.

In [ ]:
!simfactory/bin/sim list-simulations helloworld

Once it finished you can look at the output with the command below.

In [ ]:
!simfactory/bin/sim show-output helloworld

If you see

INFO (HelloWorld): Hello World!
anywhere in the above output, then congratulations, you have successfully downloaded, compiled and run the Einstein Toolkit! You may now want to try some of the other tutorials to explore some interesting physics examples.

What follows is the much more computationally intensive example of simulating a static TOV star. We will first use two sed commands to strip this down from a production quality run to something more manageable. Note that we use 5 procs for this simulation, which may be more than your machine supports. If that is the case, please adjust procs and ppn-used accordingly.

In [ ]:
# modify parameter file for smaller memory footprint using sed by changing CoordBase::dx from 8 to 12
!sed '/CoordBase::d[xyz]/s/8/12/' < par/static_tov.par > par/static_tov_small.par
# Shorten the run time to 200
!sed '/cctk_final_time/s/1000/250/' <  par/static_tov_small.par >  par/static_tov_small_short.par
In [ ]:
# start simulation, watch log output
!./simfactory/bin/sim create-run static_tov \
  --parfile=par/static_tov_small_short.par --procs=5 --num-threads=1 --ppn-used=5  --walltime=8:0:0

Plotting the Output

The following commands will generate a simple line plot of the data. They will work in a python script as easily as they do in the notebook (just remove the "%matplotlib inline" directive).

In [ ]:
# This cell enables inline plotting in the notebook
%matplotlib inline

import matplotlib
import numpy as np
import matplotlib.pyplot as plt

Numpy has a routine called genfromtxt() which is an extremely efficient reader of textual arrays of floating point numbers. This is well-suited to Cactus .asc files.

In [ ]:
lin_data = np.genfromtxt("/home/jovyan/simulations/static_tov/output-0000/static_tov_small_short/hydrobase-rho.maximum.asc")

This is all you need to do to plot the data once you've loaded it. Note, this uses Python array notation to grab columns 1 and 2 of the data file.

In [ ]:
plt.plot(lin_data[:,1],lin_data[:,2])