Basic installation

If you have cloned or downloaded from GitLab

If you clone the code directly from GitLab, please clone with --recursive:

$ git clone --recursive --branch v22.0 https://gitlab.com/dirac/dirac.git

If you have downloaded a zip/tar.gz/tar.bz2/tar archive directly from GitLab, you will require Git installed to build the code. After extracting the archive you will need to run this additional step in order to fetch and update external dependencies:

$ git submodule update --init --recursive

However, we recommend users who do not plan to make any code changes to download from https://doi.org/10.5281/zenodo.4836495. In this case the above extra step is not needed as the release tarballs are self-contained, and in addition we get useful download metrics which we can use in future funding applications.

General

DIRAC is configured using CMake , typically via the setup script, and subsequently compiled using make (or gmake). The setup script is a useful front-end to CMake. You need python to run setup. To see all options, run:

$ ./setup --help

Sequential build

The default installation proceeds through three commands:

$ ./setup [--flags]
$ cd build
$ make

The setup script creates the directory “build” and calls CMake with appropriate environment variables and flags. By default CMake builds out of source. This means that all object files and the final binary are generated outside of the source directory. Typically the build directory is called “build”, but you can change the name of the build directory (e.g. “build_gfortran”):

$ ./setup [--flags] build_gfortran
$ cd build_gfortran
$ make

You can compile the code on all available cores:

$ make -j

We strongly recommend that the installation is followed by testing your installation:

make test

For more information about testing, see here.

Parallel build

Building DIRAC for parallel runs using MPI is in principle a very simple modification of the above procedure:

$ ./setup [--flags] --mpi
$ cd build
$ make

Once again we recommend testing the code afterwards.

Typical examples

In order to get familiar with the configuration setup, let us demonstrate some typical configuration scenarios.

Configure for parallel compilation using MPI (make sure to properly export MPI paths):

$ ./setup --mpi --fc=mpif90 --cc=mpicc --cxx=mpicxx

These compiler names are in fact default for MPI in Dirac, so there is a shortcut if these are the compiler wrappers you want to use:

$ ./setup --mpi

Configure for sequential compilation using ifort/icc/icpc and link against parallel mkl:

$ ./setup --fc=ifort --cc=icc --cxx=icpc --mkl=parallel

Configure for sequential compilation using gfortran/gcc/g++:

$ ./setup --fc=gfortran --cc=gcc --cxx=g++

You get the idea. The configuration is usually good at detecting math libraries automatically, provided you export the proper environment variable MATH_ROOT, see Linking to math libraries.

What to do if CMake is not available or too old?

If it is your machine and you have an Ubuntu or Debian-based distribution:

$ sudo apt-get install cmake

On Fedora:

$ sudo yum install cmake

Similar mechanisms exist for other distributions or operating systems. Please consult Google.

If it is a cluster, please ask the Administrator to install/upgrade CMake.

If it is a cluster, but you prefer to install it yourself (it’s easy):

  1. Download the latest pre-compiled CMake tarball

  2. Extract the tarball

  3. Set correct PATH variable