Introduction

Compiling OPAL can be quite challenging due to all the required libraries. Even if some libraries are available on the system, this doesn’t mean that they can be used for compiling OPAL due to missing features.

NOTE: In the code snippets below we use the environment variables SRC_DIR and PREFIX. Whereby SRC_DIR must be set to the directory OPAL will be build in and PREFIX to the OPAL installation directory.


Get the OPAL sources

Clone the OPAL Git repository

mkdir -p "${SRC_DIR}/OPAL"
cd "${SRC_DIR}/OPAL"
git clone https://github.com/OPALX-project/OPAL.git

Select the OPAL branch you want to compile. The current stable branch is OPAL-2024.1:

cd "${SRC_DIR}/OPAL/src"
git checkout OPAL-2024.1

To checkout the (unstable) development branch run:

cd "${SRC_DIR}/OPAL/src"
git checkout master

To get a list of all available branches, you can run the command

git branch -a

from inside your clone.

Configure OPAL

OPAL uses CMake to configure the build process. You can either pass options to cmake or you can run the command ccmake in the build directory after calling cmake.

mkdir -p "${SRC_DIR}/OPAL/build" && cd "$_"
CC=mpicc CXX=mpicxx cmake \
        --prefix="${PREFIX}" \
        "${SRC_DIR}/OPAL/src"

The following table shows the most important options:

CMAKE_BUILD_TYPE

build type can be either Debug, Release, RelWithDebInfo or MinSizeRel

CMAKE_INSTALL_PREFIX

prefix for installation

BUILD_OPAL_UNIT_TESTS

enable the unit-tests

requires google-test >= 1.10.0

ENABLE_AMR

enable AMR solver

requires AMReX (release 18.07)

ENABLE_AMR_MG_SOLVER

enable AMR multigrid solver

requires trilinos >= 13.x and AMReX (release 18.07)

ENABLE_BANDRF

compile BANDRF field conversion scripts

ENABLE_OPAL_FEL

enable full-wave solver

requires MITHRA 2.0

ENABLE_SAAMG_SOLVER

enable SAAMG solver

requires trilinos >= 13.x

BUILD_OPAL_PYTHON

enable PyOPAL

requires Python 3.0+ and Boost with Python. You have to set WILL_BUILD_SHARED_LIBRARY=on.

WILL_BUILD_SHARED_LIBRARY

build libOPAL as shared library

this must be enabled for PyOPAL

ENABLE_DOXYDOC

automatically configures Doxyfile.in

Note
Trilinos

For compiling Trilinos please see the Trilinos build recipe.

Compile and install OPAL

cd "${SRC_DIR}/OPAL/build"
make -j ${NJOBS}
make install