PRISMS-PF Manual
Loading...
Searching...
No Matches
Installing from Source

Prerequisites

Before you can install PRISMS-PF, you will need to have some prerequisites installed on your machine. These include:

  • A C++ compiler with C++20 support
  • CMake (3.25+)
  • MPI
  • p4est (for adaptive octree meshing)
  • deal.II (9.6.0+)

You can install these prerequisites however you like. The first three are typically available on most OS through your package manager. For example, on Ubuntu, you can install them with:

sudo apt-get install git lsb-release git subversion \
wget bc libgmp-dev build-essential autoconf automake \
cmake libtool gfortran python3 libboost-all-dev \
zlib1g-dev openmpi-bin openmpi-common libopenmpi-dev \
libblas3 libblas-dev liblapack3 liblapack-dev \
libsuitesparse-dev

To install p4est and deal.II, we recommend following the instructions on the deal.II installation guide. Building deal.II and p4est using deal.II's automatic installation script candi is by far the best option for most users.

git clone https://github.com/dealii/candi.git
cd candi

Modify the candi.cfg file, commenting out any PACKAGES other than dealii and p4est. Also, turn on the native optimizations option. You should have something like the following.

# Option {ON|OFF}: Enable machine-specific optimizations (e.g. -march=native)?
NATIVE_OPTIMIZATIONS=ON
# These packages determine the active components of deal.II:
PACKAGES="${PACKAGES} once:p4est"
PACKAGES="${PACKAGES} dealii"
Remarks
If you are building deal.II on a different architecture than you plan to run PRISMS-PF, you can specify the architecture in the DEAL_II_CONFOPTS="" section with -march=<arch>.
If you have trouble with deal.II auto-detecting packages or with the system installation of Boost try adding the following. DEAL_II_CONFOPTS="-DDEAL_II_ALLOW_AUTODETECTION=OFF -DDEAL_II_FORCE_BUNDLED_BOOST=ON"

Then perform the configuration, compilation, and installation with

./candi.sh

or

./candi.sh -j <nprocs>

to compile with multiple processors (much faster).

Note
We have found that specifying too many processors can sometimes lead to build failures, so if you run into issues, try reducing the number of processors specified. If this doesn't work Contact us.

This will install both p4est and deal.II in a local directory (by default,$HOME/dealii-candi/). You can override the installation path with the prefix command (./candi.sh -p /path/to/install). Be sure to permanently set the DEAL_II_DIR environment variable to point to the deal.II installation. The candi script will prompt you with steps on how to do this.

Installing PRISMS-PF

Once you have all the prerequisites installed, you can clone the PRISMS-PF repository from GitHub, configure, build, and install the code.

First, clone the repository and navigate to the main directory.

git clone https://github.com/prisms-center/phaseField.git
cd phaseField

Next, we'll configure the library. We have a table of configuration options below. Additionally, if you have CMake 3.28+ you can use our CMakePresets.json.

General Configuration

Default Description
PRISMS_PF_AUTODETECTION ON Try to detect Optional Dependencies that are in path
PRISMS_PF_UNIT_TESTS OFF Build the unit tests
PRISMS_PF_REGRESSION_TESTS OFF Build the regression tests
PRISMS_PF_PERFORMANCE_TESTS OFF Build the performance tests
PRISMS_PF_EXAMPLES OFF Build the examples
PRISMS_PF_DOCS OFF Build the documentation
PRISMS_PF_CLANG_TIDY OFF Run clang-tidy during the build stage

Feature Configuration

Default Description
PRISMS_PF_64BIT_INDICES OFF

Use 64-bit indices for large scale simulations (>2.147 billion DoFs). This relies on the fact that deal.II is also configured with this option on.

Leaving this on when unnecessary will result in worse performance.

PRISMS_PF_ADDITIONAL_DEGREES OFF

Compile the core library with element degrees 3+. When turned off, explicit templates will only be compiled for elements degrees 1 and 2. Turning it on will allow access to higher element degrees on the application level, but increases compile time.

Note that deal.II is typically configured with element degrees up to 6. If you want higher element degrees, you must configure deal.II accordingly.

PRISMS_PF_THREADS ON Use threading when possible for MPI processes in Release mode. When turned off, each MPI process will only use one thread.
PRISMS_PF_GPU OFF [Experimental] Use GPU backends instead of CPU. This is still under active development

Optional Dependencies

Default Description
PRISMS_PF_WITH_VTK OFF Enable additional VTK file I/O options
PRISMS_PF_WITH_HDF5 OFF Enable HDF5 file I/O options
PRISMS_PF_WITH_CALIPER OFF Enable Caliper as a profiler

First, set the PRISMS_PF_DIR environment variable to point to where you want to install PRISMS-PF. You can add this to your rc file to have permanent access to $PRISMS_PF_DIR.

export PRISMS_PF_DIR="path/to/install"

The most basic configuration is as follows:

cmake -DCMAKE_BUILD_TYPE=DebugRelease -B build
cmake --build build -j <nprocs>
cmake --install build --prefix $PRISMS_PF_DIR

where <nprocs> is how processors to build in parallel with.

This will build the PRISMS-PF library in both Debug and Release modes (something that deal.II does that we think is nice). If you'd like to use typical CMake build types you can also do that.

You can now compile and run any of the applications in the applications directory. For example, to compile and run the explicit allen_cahn application, you can use the following commands:

cd applications/allen_cahn/explicit
cmake -DCMAKE_BUILD_TYPE=Release .
make
mpirun -n <nprocs> main

Unlike before, there is no DebugRelease build type on the application level. As an application you must choose between Debug and Release. Debug is the default build type for applications.

Remarks
Let's talk about build types! Debug is slooww, concerningly so sometimes. However, it's for good reason. We have a bunch of assertions that are being checked! If you have something wrong with your application, you'll get a meaningful error that will tell you how to fix it. This is good when developing applications. Always run in Debug when developing applications. If you're playing around with model parameters or want to run non-test systems use Release. However, if something goes wrong, you may get an unintelligible error message or a SEGFAULT.

Let me repeat myself. Always run in Debug when developing applications
- @landinjm & @fractalsbyx