Compiling from Source
Table of contents
Choice of Compiler
In order to compile CREST from source you will need a Fortran and C compiler. We recommend either the Intel ifort
/icc
or GNU gfortran
/gcc
compilers. Both compilers can be obtained free-of-charge, but in our own developments we primairly use the Intel compilers. A quick reference on where to obtain either one is proveded in the following.
ifort
/icc
compilers.1. Intel compilers via oneAPI
The ifort
and icc
compilers have become publically available only recently with the introduction of Intel’s oneAPI initiative . You will need to first install the Intel oneAPI Base Toolkit and afterwards the Intel oneAPI HPC Toolkit . Follow the instructions and check the installation via
ifort -v
If this gives you a version number, set these compilers as your defaults:
export FC=ifort CC=icc
2. GNU compilers
Installing the gfortran
and gcc
compilers on Unix systems is fairly straight-foward. The installation can be done directly via the commandline, e.g., with
sudo apt-get install gfortran
Check the installation and gfortran
version with
gfortran --version
The gcc
compiler is included in the build-essential
package and there is a good chance you have installed this on your Linux system already. If not, try installing it via
sudo apt update
sudo apt-get install build-essentials
and check the gcc
version with
gcc --version
If you decided on the GNU compilers, set them as your defaults:
export FC=gfortran CC=gcc
Install via Meson
Meson is an open source multiplatform build system. The main development project can be found on Meson’s GitHub page . Meson is used in combination with the Ninja build system (version > 1.8) as a backend. Both can be installed from the command line via pip
(Python version > 3.7).
python3 -m pip install meson ninja
OR via
sudo apt install meson ninja-build
Check their installation with
meson --version ; ninja --verison
Instructions for building CREST with Meson are read from the meson.build
file. For the next steps you will need to have chosen a compiler (ifort
/icc
or gfortran
/gcc
) and exported the FC
and CC
variables as described above . To start building the program, navigate to the directory in which you have saved CREST and set up the build with
meson setup _build
This will prepare the directory _build
in which the program will be compiled.
-Dla_backend=<option>
keyword to the setup command. For example, add -Dla_backend=mkl
to use the shared MKL library.If the setup was successfull, initiate the build (still in the same directory) with
ninja -C _build
Install via CMake
CMake is one of the most widely used multiplatform build systems. It can be used with Ninja or the regular make
as a backend. CMake can be installed in different ways. For example from the official webiste, or via pip
pip install cmake
As before, you must have exported FC
and CC
variables to set the compilers. To start building CREST, navigate to the source (a file called CMakeLists.txt
should be present here) and setup a _build
directory with
cmake -B _build -DCMAKE_BUILD_TYPE=Release
If you wish to use Ninja as a backend also add the -GNinja
option to this command. Then build the project with
make -C _build
or ninja -C _build
, whatever you prefer.
Conda
Installing CREST from the conda-forge
channel can be achieved by adding conda-forge
to your channels with:
conda config --add channels conda-forge
Once the conda-forge
channel has been enabled, CREST can be installed with:
conda install crest
It is possible to list all of the versions of CREST available on your platform with:
conda search crest --channel conda-forge