# Basic installation¶

## 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

## 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 --fc=mpif90 --cc=mpicc --cxx=mpicxx

There is a shortcut for it:

$./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.