Skip to content

How to compile PUMGen

David Schneller edited this page Jul 15, 2024 · 37 revisions

You may compile PUMgen both with and without spack. For the installation process with spack, see below.

Compile pumgen and Dependencies Manually

To compile PUMGen, you will need the following libraries:

  • HDF5 (>= 1.8 works)

Optionally (mandatory up to including v1.0.1), you'd also need to install:

  • PUMI (SCOREC core); only version v2.2.8 and above may work for large meshes (exceeding 2147483648 vertices)

Having only these libraries is enough for running the SeisSol examples.

For old SeisSol meshes, you may also install netCDF. In addition, you may compile PUMGen with Symmetrix support, see below for details.

HDF5

Most supercomputers have a pre-built HDF5 module with MPI support, so you may skip this step by loading it. Additionally, most package managers (e.g. for Arch Linux) have a pre-built variant with MPI available as well.

For manually compiling it, see the instructions in here for the installation process. You may need to include the installation path into your CMAKE_PREFIX_PATH for it to be found immediately by the PUMgen installation.

PUMI

Set the environment variable PREFIX to a local folder.

Clone and build PUMI (https://github.com/SCOREC/core) with:

git clone https://github.com/SCOREC/core.git
cd core
git checkout tags/v2.2.7
git submodule update --init
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX
make -j $ncpu
make install

v2.2.7 has been used successfully, but newer versions may work as well.

Compiling PUMGen

git clone --depth=1 --recursive https://github.com/SeisSol/PUMGen.git pumgen
cd pumgen
mkdir build
cd build
cmake .. -DSIMMETRIX=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX:$CMAKE_PREFIX_PATH
make -j $ncpu

Make sure to extend CMAKE_PREFIX_PATH to include all your dependencies which you built manually (i.e. PUMI and HDF5). Also, CMAKE_PREFIX_PATH should include the directory where you installed the dependencies (i.e. what CMAKE_INSTALL_PREFIX says, or --prefix for automake).

Use ccmake to get a GUI which helps you to switch options on and off. Make sure to not put $ncpu too high, as it may overload your CPU or the login node you are working on. Setting $ncpu to the number of physical CPUs usually works well.

Note that you should ideally use the same compiler (or at least the same standard library) as for compiling PUMI and HDF5 to avoid linkage and compiler errors.

(NOTE: these build instructions do not use the Symmetrix modeler. For including it, see below)

Optional Dependencies

netCDF (optional/deprecated)

NetCDF is required to convert old SeisSol meshes. See here for the installation process. Though once again, you may check your supercomputer modules or your package manager for a pre-built variant.

Simmetrix (optional)

The Sim Modeling Suite from Simmetrix is optional. To use it, you need a valid Simmetrix license for the SimModeling Suite library. If you have the license you should be able to download the library from http://simmetrix.com/index.php/support/support-downloads. See here for the installation process.

When compiling with simmetrix, you also need to install easi. Follow the instructions here. Make sure to add the installation folders all to your CMAKE_PREFIX_PATH variable.

Next, you will need to build PUMI differently. Once in the cloned PUMI folder, do as follows:

mkdir build && cd build
cmake .. \
  -DCMAKE_C_FLAGS="-O2 -g -Wall" \
  -DCMAKE_CXX_FLAGS="-O2 -g -Wall" \
  -DCMAKE_INSTALL_PREFIX=$path_to_pumi \
  -DENABLE_SIMMETRIX=ON \
  -DSIM_MPI=$mpi_name \
  -DSIMMETRIX_LIB_DIR=$path_to_SimModeler_lib \
  -DSIMMODSUITE_INCLUDE_DIR=$path_to_SimModeler_include_dir
make -j $ncpu
make install

Where $mpi_name is the mpi implementation (see the name of the preinstalled libSimPartitionedMesh-xxx.a, e.g. mpi, mpich3, openmpi3 or openmpi4. On SuperMUC-NG we use mpich3).

As an illustration, the different path could be:

export myLibs=(set your myLibs here)
export path_to_SimModeler=$myLibs/SimModelerLib/16.0-220101/
export mpi_name=mpich3
export path_to_pumi=$myLibs/core/
export path_to_SimModeler_lib=$path_to_SimModeler/lib/x64_rhel8_gcc83
export path_to_SimModeler_include_dir=$path_to_SimModeler/include
export path_to_hdf5=$HDF5_BASE

Where $myLibs point to the folder where user libraries are installed.

The install process for PUMgen also differs from the one shown above. You will now have to do:

git clone --depth=1 --recursive https://github.com/SeisSol/PUMGen.git pumgen
cd pumgen
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH=$path_to_pumi -DSIMMETRIX=ON \
    -DSIMMETRIX_ROOT=$path_to_SimModeler -DSIM_MPI=$mpi_name \
    -DCMAKE_BUILD_TYPE=Release
make -j $ncpu

Again, you should ideally use the same compiler (or at least the same standard library) as for compiling PUMI and HDF5 to avoid linkage and compiler errors.

Compiling with spack

Without Simmetrix support

If spack is recent enough, ./spack install pumgen ~with_simmetrix %gcc@10.2.1 should work straightaway.
(you can change %gcc@10.2.1 with your compiler).
If spack is older, then you will need to add the spack_support repository (see below).

With Simmetrix support

Follow the instructions at: https://github.com/SeisSol/seissol-spack-aid/tree/supermuc_NG/spack
to add the spack_support repository.

Update (or create) ~/.spack/packages.yaml as follow, with prefix pointing to the folder where the SimModeler Suite is installed.

packages:
  simmetrix-simmodsuite:
    externals:
    - spec: simmetrix-simmodsuite@17.0-220511
      prefix: path_to_17.0-220511

e.g. path_to_17.0-220511 could be /import/heisenbug-dump/ulrich/myLibs/SimLib/17.0-220511/

Finally, install with ./spack install pumgen +with_simmetrix %gcc@10.2.1 (you can change %gcc@10.2.1 with your compiler).

Installing on SuperMUC-NG

SuperMUC doesnt have the rpc library. Hence, we need to install it manually.

  1. Get libtirpc from https://www.linuxfromscratch.org/blfs/view/svn/basicnet/libtirpc.html
  2. Unzip, cd into dir.
  3. ./configure --disable-gssapi -prefix=$HOME
  4. make install -j48

Apply patch to PUMGEN:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5e7f24..efd2487 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,6 +48,7 @@ if (PARASOLID)
   target_compile_definitions(pumgen PUBLIC PARASOLID)
 endif()
 
+target_link_libraries(pumgen PUBLIC /path/to/libtirpc.so.3.0.0)
 if (NETCDF)
   find_package(NetCDF REQUIRED)
   target_sources(pumgen PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/input/NetCDFPartition.cpp)

Installing on a LMU server

In your ~/.bashrc you will need (adapt to your own spack directory)

    export SPACK_ROOT=/export/dump/ulrich/spack
    export PATH=$SPACK_ROOT/bin:$PATH
    . /export/dump/ulrich/spack/share/spack/setup-env.sh
    export CXXFLAGS="-no-pie -fPIC ${CXXFLAGS}"
    export FC=mpif90
    export CXX=mpiCC
    export CC=mpicc

Then load gcc with module load gcc/12.2.0
Install pumgen with spack install --dirty pumgen +with_simmetrix %gcc@12.2.0
Load the installed module with spack load pumgen %gcc. For some yet unknown reason, this pumgen is not functional (with simmodeler), so we need to manually recompile it.

Clone the PUMGen repository:

git clone https://github.com/SeisSol/PUMGen.git
git submodule update --init

edit the CMakeLists as follow (fixes yaml include file not found):

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,6 +83,8 @@ if (SIMMETRIX)
     # easi
     find_package(easi 1.0.0 REQUIRED)
     target_link_libraries(pumgen PUBLIC easi::easi)
+    find_package(yaml-cpp 0.6 REQUIRED)
+    target_include_directories(pumgen PRIVATE ${YAML_CPP_INCLUDE_DIR})
 
     target_sources(pumgen PUBLIC 
       ${CMAKE_CURRENT_SOURCE_DIR}/src/input/AnalysisAttributes.cpp

and finally, install pumgen with:

mkdir build && cd build
cmake -DSIMMETRIX=ON -DSIM_MPI=openmpi4 ..
make -j install

Known issues

Depending of the operating system, there might be problems of rpc dependency when compiling pumi with Simmetrix support. This is the case on supermucNG. An issue is opened, https://github.com/SCOREC/core/issues/367, but not fixed yet.