Building from Source

After making sure the prerequisites are installed, you can build openCARP using CMake (recommended) or the shipped Makefile.

Prerequisites

First install the following openCARP prerequisites using your package manager (e.g. apt or rpm on Linux, homebrew or macports on macOS) or from source.

Building PETSc from source would be a better practice, so you could configure it depending on your needs. If you are not experienced with its various configurations, please refer to the following suggestions. Set --prefix= to the location you would install PETSc. After installation, set the environment variable PETSC_DIR and PETSC_ARCH accordingly.

./configure \
    --prefix=/opt/petsc \
    --download-mpich \
    --download-fblaslapack \
    --download-metis \
    --download-parmetis \
    --download-hypre \
    --with-debugging=0 \
    COPTFLAGS='-O2' \
    CXXOPTFLAGS='-O2' \
    FOPTFLAGS='-O2'
make all
make install

In this case, to make mpirun available on your machine, add $PETSC_DIR/bin to your PATH. That is, add the following line to your .bashrc (or equivalent if you don't use the bash shell).

export PATH=$PATH:$PETSC_DIR/bin

If you have all the listed dependencies, a quick way to get openCARP up and running is the following:

Clone the repository and enter the codebase folder openCARP

git clone https://git.opencarp.org/openCARP/openCARP.git
cd openCARP

To have a more stable environment, we recommend using the latest release version instead of the bleeding edge commit on the master branch:

git checkout latest

If you want to develop and push your changes back to the openCARP repository, then staying on a branch is the better option and you should skip the command above.

We provide CMake files and Makefiles for building the codebase, choose the one that fits your workflow.

Building using CMake

Use CMake to create the _build build folder, optionally add -DDLOPEN=ON to enable ionic shared library loading, and -DCMAKE_BUILD_TYPE=Release to optimize compilation.

By default, the OpenMP parallelization is activated for igbutils and meshtool. This is equivalent to setting the option -DUSE_OPENMP=UTILS and requires that OpenMP is installed on your system. You can use -DUSE_OPENMP=ON to activate OpenMP parallelization globally. If you want to deactivate OpenMP parallelization completely, set -DUSE_OPENMP=OFF.

If you want to add support for the Caliper performance instrumentation and profiling library, set -DENABLE_CALIPER=on when running CMake. You can provide a hint to the Caliper installation directory by setting -Dcaliper_DIR=/your/path. When running the code, set the CALI_CONFIG variable as shown here: Caliper Region profiling. CUDA profiling with CUPTI is also enabled automatically, but only if Caliper is built with -DWITH_CUPTI=on.

If you also want to build the additional tools (meshtool, carputils, and examples) locally, use in addition the option -DBUILD_EXTERNAL=ON:

cmake -S. -B_build -DDLOPEN=ON -DBUILD_EXTERNAL=ON -DCMAKE_BUILD_TYPE=Release

If you do not want to install the additional tools, you can use:

cmake -S. -B_build -DDLOPEN=ON -DCMAKE_BUILD_TYPE=Release

Compile the codebase, and all built executables will be located in the _build/bin folder.

cmake --build _build

If you built the additional tools, meshtool executable is also located in the _build/bin folder, carputils and experiments (contain examples) are cloned to the external folder.

The next step is to set up carputils: see the installation instruction for carputils .

Alternative: building using the Makefile

As an alternative to CMake, you can use make to build the codebase.

The codebase can be compiled using

make setup

This target includes updating the codebase (make update) and code compilation (make all).

Make sure to edit the my_switches.def file to match you requirements (e.g., to enable the use of shared libraries for ionic models).

Links to all compiled executables are located in the bin folder.

Please also refer to the carputils main page, the meshtool main page. Download the openCARP examples to the location of your choice using git clone https://git.opencarp.org/openCARP/experiments.git.

© Copyright 2020 openCARP project    Supported by DFG and EuroHPC    Contact    Imprint and data protection