Link Search Menu Expand Document

Compiling from Source

Table of contents

  1. Choice of Compiler
    1. 1. Intel compilers via oneAPI
    2. 2. GNU compilers
  2. Install via CMake
  3. Install via Meson
  4. Conda

Choice of Compiler

In order to compile CREST from source you will need a Fortran and C compiler. We recommend either the Intel ifort/icx 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.

1. Intel compilers via oneAPI

The ifort and icx 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=icx

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 CMake

CMake is one of the most widely used multiplatform build systems. Starting with CREST 3.0, we will focus primarily on this build, although the meson build may still be used

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

For the next steps you will need to have chosen a compiler (ifort/icx or gfortran/gcc) and exported the FC and CC variables as described above . 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

Further arguments can be added to this command if you wish to customize the build, for example for including or excluding suprojects. Information about the subprojects is given on the programs repository page .

Then build the project with

make -C _build

If you wish to use Ninja as a backend (instead of make), add the -GNinja option to the CMake setup command.

Starting with CREST 3.0, we introduce unit tests that can be run via the CMake build. To run these, after having build the program, use

make test -C _build

The unit tests will be expanded over time.


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. As before, you must have exported FC and CC variables to set the compilers. However, momentarily the meson build defaults only work with the ifort/icx architecture. 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.

If the setup was successfull, initiate the build (still in the same directory) with

ninja -C _build

Conda

Conda Version

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

Back to top

Copyright © 2022-2024 Philipp Pracht.

CREST is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.