This is an advanced topic. Before building your own package, please consider using an exiting one or get into contact with us via

Building your own package: spack

As a fully featured package manager you can build and install packages on your own. This can be done in multiple ways, but in this first chapter only the most simple way will be described: No installation of spack is needed, no extra setup of compilers. Packages definitions are limitated to the versions DKRZ is currently using for the software tree. spack list can be used to search the available packages for given package name patterns. With spack info <name> a detailed view of a given package name is possible include available versions, variants and dependencies.

The first step is to create a directory called .spack in the your $HOME directory. In there you need to create a file called config.yaml with the following content:

    root: <your-installation-directory>

This setting overwrites the system installation path. To make sure the packages installed by DKRZ are still accessible a second file called upstreams.yaml needs to be added. It should look like this:

    install_tree: /sw/spack-levante

With those two files in ~/.spack it is possible to install packages into your private path (in my case I use /work/k20200/sw). In the following example I used the nvhpc compiler

spack install libelf %nvhpc
==> Installing libelf-0.8.13-ellsaygtw33563jcz3cwwsbaspl5pack
==> No binary for libelf-0.8.13-ellsaygtw33563jcz3cwwsbaspl5pack found: installing from source
==> Fetching
==> No patches needed for libelf
==> libelf: Executing phase: 'autoreconf'
==> libelf: Executing phase: 'configure'
==> libelf: Executing phase: 'build'
==> libelf: Executing phase: 'install'
==> libelf: Successfully installed libelf-0.8.13-ellsaygtw33563jcz3cwwsbaspl5pack
  Fetch: 1.14s.  Build: 8.05s.  Total: 9.20s.
[+] /work/k20200/sw/libelf-0.8.13-ellsay

For using other compilers please check all available ones with spack compilers

spack compilers
==> Available compilers
-- dpcpp rhel8-x86_64 -------------------------------------------

-- gcc rhel8-x86_64 ---------------------------------------------

-- intel rhel8-x86_64 -------------------------------------------

-- nvhpc rhel8-x86_64 -------------------------------------------

-- oneapi rhel8-x86_64 ------------------------------------------

With the % symbol you can choose the compiler for the package installation

With more recent packages

In case you want to build software in a more recent version compared to what DKRZ is using, you need to download spack from and follow the installation instructions. Basically you clone the repository and read in the environment file from inside the repository

source ./share/spack/

Now you can use the package definitions from the repository instead of the ones from DKRZ.

If you want to build software competely on your own you can just follow the official documention at