Environment Preparation on a Linux Machine

For installing all needed libraries by Damaris, there are multiple different approaches: automated/semi-automated using a Linux distributions package manager for installing dependencies or compiling from source using Spack) or a completely manual download using git or a source zip package. Here you can find some examples of each method.

1. Compile Damaris from gitlab source

This example uses Debian 10/11 (Ubuntu 18/20) installed dependencies.
If you have sudo privilege’s, using apt-get is a quick way to get dependencies on modern Debian and Ubuntu OSes. These libraries can be used in a Docker or Singularity build.
Here we install HDF5 with parallel support using OpenMPI.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
sudo apt-get update -y
sudo apt-get install -y build-essential \
   gfortran \
   libboost-all-dev \
   libhdf5-openmpi-dev \
   xsdcxx \
   libxerces-c-dev \
   libcppunit-dev
 
# The xsd executable has a different name from the Debian package
# So, link to what Damaris expects
sudo ln -s /usr/bin/xsdcxx /usr/bin/xsd
 
# Set some variables
DAMARIS_VERSION=1.5
INSTALL_PREFIX=~/local
 
# Obtain the Damaris source from GitLab and checkout the desired version
git clone https://gitlab.inria.fr/Damaris/damaris.git
cd damaris
git fetch --all
git checkout tags/v$DAMARIS_VERSION
cd ..
mkdir -p ./build/damaris
cd build/damaris
 
# Configure Damaris with desired capabilities (HDF5, testing, examples)
cmake ../../damaris -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_CXX_COMPILER=mpicxx \
      -DCMAKE_C_COMPILER=mpicc \
      -DENABLE_TESTS=ON \
      -DENABLE_EXAMPLES=ON \
      -DBUILD_SHARED_LIBS=ON \
      -DENABLE_HDF5=ON  -DHDF5_ROOT=/usr/lib/x86_64-linux-gnu/hdf5/openmpi \
      -DGENERATE_MODEL=ON
 
# Compile the library and then install using sudo if needed
make -j4
[sudo] make install

If compiling Damaris with Paraview support then also include the following line on the Damaris cmake command line

1
2
3
4
 
-DENABLE_CATALYST=ON -DParaView_DIR=$INSTALL_PREFIX/lib/cmake/paraview-5.8 \
 
# N.B. INSTALL_PREFIX is where Paraview was installed.

And if compiling Damaris with VisIt support, include the following on the Damaris cmake command line

1
2
3
4
 
-DENABLE_VISIT=ON -DVisIt_ROOT=$INSTALL_PREFIX \
 
# N.B. INSTALL_PREFIX is where VisIt was installed.

2. Automatic installation with Spack

Spack is a powerful package manager that is often used on clusters and supercomputers. Spack can be installed and start simply by the following instructions:

1
2
git clone https://github.com/spack/spack.git
. ./spack/share/spack/setup-env.sh

Damaris now has a Spack packages file that is part of the Spack git repository.
So, now it is easy enough to install Damaris. To see the options enabled through Spack

1
    spack info damaris

To install the base Damaris with HDF5 support (no visualization support)

1
    spack install damaris+hdf5+fortran+examples

Please note, installing Paraview and VisIt via Spack can be very long and difficult process. It is recommended to download and install them from source using their official documentation and it is preferable to install dependencies such as llvm and osmesa via your operating systems package manager.
ParaView Docs
VisIt Docs

Using Spack hash values

Spack can start to get crowded with multiple installations of the same package. To specify an exact package required it can pay to use the hash of the installed library. Use something like the following to find the hash and use the hash to find dependencies and their hash values too.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Install a specific version of HDF5
HDF5_VERSION=1.10.7
spack install hdf5@$HDF5_VERSION+mpi+hl
 
# Obtain the hash of the installation
HDF5_HASH=$(spack find -vl hdf5 | grep $HDF5_VERSION | sed 's| hdf5.*$||g')
# Find the hash of the OpenMPI depedencies of the specific HDF5 version
OMPI_HASH=$(spack dependencies --installed /$HDF5_HASH | grep openmpi | sed "s| openmpi.*$||g")  
 
# Now we can find the path to the Spack installation directory.
# N.B. We should also check that the directory exists to avoid silent failures
MPIPATH=$(spack find -p openmpi/$OMPI_HASH | grep openmpi | sed "s|^.* ||g")
HDF5PATH=$(spack find -p hdf5/$HDF5_HASH| grep hdf5 | sed "s|^.* ||g")
 
spack load hdf5/$HDF5_HASH
spack load openmpi/$OMPI_HASH
 
# The paths can be used to specify the exact versions in the cmake configuration:
cmake ../../damaris -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_CXX_COMPILER=$MPIPATH/bin/mpicxx \
      -DCMAKE_C_COMPILER=$MPIPATH/bin/mpicc \
      -DENABLE_HDF5=ON -DHDF5_ROOT=$HDF5PATH \
      ...

3. Manual Installation of Damaris Dependencies

To install the libraries manually, first download (check the /build/env_prep.sh script file for examples) and unzip the libraries and go to the related directory. For each library, run the following commands. Please note that the variable “install_path” shows the installation folder of Damaris.

Install CMake

Run these commands to build and install cmake.

1
2
3
$ ./bootstrap --prefix=$install_prefix
$ make
$ make install
Install MPI

To Install MPICH, do the following steps:

1
2
3
4
$ ./configure --prefix=$install_prefix --enable-shared 
    --enable-romio --enable-fc 2>&1  | tee c.txt
$ make 2>&1  | tee m.txt
$ make install 2>&1 | tee mi.txt

The required commands for installing OpenMPI can be found in the ./env_prep.sh file.

Install Xerces

Run the following commands to install Xerces:

1
2
3
$ ./configure --prefix=$install_prefix --disable-threads --disable-network
$ make
$ make install
Install XSD

XSD is a XML data binding library by CodeSynthesis. To install this library, take the following steps:

1
2
3
4
$ make LDFLAGS="-L$install_prefix/lib/" CFLAGS="-I $install_prefix/include" 
    CXXFLAGS="-I $install_prefix/include/"
$ make install_prefix=$install_prefix install LDFLAGS="-L~/local/lib/" 
    CFLAGS="-I ~/local/include" CXXFLAGS="-I ~/local/include/"
Install Boost

Configure and compile boost using these commands:

1
2
3
4
$ ./bootstrap.sh --prefix=$install_prefix 
    --with-libraries=thread,log,date_time,program_options,filesystem,system
$ ./b2
$ ./b2 install
Install CPPUnit (Optional)

To build and install CppUnit, go for these three commands:

1
2
3
$ ./configure --prefix=$install_prefix
$ make
$ make install
Install HDF5 (Optional)

To install HDF5, run these three commands:

1
2
3
$ ./configure --enable-parallel --prefix=$install_path
$ make
$ make install
Installing VisIt (optional)

Installing VisIt is a little bit more complex compared to the other mentioned libraries. To install VisIt check this page.

Installing ParaView Catalyst (optional)

– Make sure that the mpicc and mpicxx are in your PATH variable.
– Make sure that the path of your MPI libraries are inside the LD_LIBRARY_PATH variable.
– Download your proper Catalyst archive from this page. (download the one with Python enabled and extras)
– Untar it in your preferred folder.
– Go to the created folder.
– Create a build folder inside.
– Go to that folder.
– Call:

1
 ../cmake.sh .. -DCMAKE_INSTALL_PREFIX=$install_path

– run:

1
2
make -j 8
make install

 

4. Automatic installation of Damaris and Dependencies from source with a script

To install all the dependent libraries, semi-automatically, from source, go to the /build folder in Damaris GitLab and open the env_prep.sh script file. To configure the build, set the install_path variable to where you want all libraries installed and then run:.

1
Usage: env_prep.sh (all|compile|custom) \n [args:(cmake, mpi[mpich,openmpi,none], xercess, xsd, boost, cppunit, hdf5, visit, catalyst, compile)]

If everything is successful, Damaris and all required dependent libraries will be downloaded, built and installed.

Comments are closed.