|
DiFfRG
|
To compile and run this project, there are very few requirements which you can easily install using your package manager on Linux or MacOS:
AppleClang, but in principle, ICC or standard Clang should also work.The following requirements are optional:
gfortran). It is recommended but not required: it makes deal.II's LAPACK detection robust.nvcc, e.g. g++<=13.2 for CUDA 12.5All other requirements are bundled and automatically built with DiFfRG. The framework has been tested with the following systems:
For a CUDA-enabled build, additionally install
The second line is necessary to switch into a shell where g++-12 is available
For a CUDA-enabled build, additionally
First, install xcode and homebrew, then run
If using Windows, instead of running the project directly, it is recommended to use WSL and then go through the installation as if on Linux (e.g. Arch or Ubuntu).
Although a native install should be unproblematic in most cases, the setup with CUDA functionality may be daunting. Especially on high-performance clusters, and also depending on the packages available for chosen distribution, it may be much easier to work with the framework inside a container.
The specific choice of runtime environment is up to the user, however we provide a small build script to create docker container in which DiFfRG will be built. To do this, you will need docker, docker-buildx and the NVIDIA container toolkit in case you wish to create a CUDA-compatible image.
For a CUDA-enabled build, run
in the above, you may want to replace the version 12.5.1 with another version you can find on docker hub at nvidia/cuda. Alternatively, for a CUDA-less build, run simply
If using other environments, e.g. ENROOT, the preferred approach is simply to build an image on top of the CUDA images by NVIDIA. Optimal compatibility is given using nvidia/cuda:12.5.1-devel-rockylinux. Proceed with the installation setup for Rocky Linux above.
For example, with ENROOT a DiFfRG image can be built by following these steps:
Afterwards, one proceeds with the above Rocky Linux setup.
If all requirements are met, you can clone the git to a directory of your choice,
and start the build after switching to the git directory.
The build.sh bash script will build and setup the DiFfRG project and all its requirements. This can take up to half an hour as the deal.ii library is quite large. This script has the following options:
-f Perform a full build and install of everything without confirmations.-c Use CUDA when building the DiFfRG library.-i <directory> Set the installation directory for the library.-j <threads> Set the number of threads passed to the build.-b <directory> Use the Boost installation at this prefix instead of building one.-t <directory> Use the TBB installation at this prefix instead of building one.-s <directory> Use the SUNDIALS installation at this prefix instead of building one.--help Display this information.Depending on your amount of CPU cores, you should adjust the -j parameter which indicates the number of threads used in the build process. Note that choosing this too large may lead to extreme RAM usage, so tread carefully - DiFfRG will try to auto-detect an appropriate value if -j is not set.
As soon as the build has finished, you can find a full install of the library in the directory passed to -i (here /opt/DiFfRG); the default is ~/.local/share/DiFfRG.
If you have changes to the library code, you can update the library by running
where once again the -j parameter should be adjusted to your amount of CPU cores. The update_DiFfRG.sh script takes the following optional arguments:
-c Use CUDA when building the DiFfRG library.-i <directory> Set the installation directory for the library.-j <threads> Set the number of threads passed to the build.-m Install the Mathematica package locally.--help Display this information.The compiler is selected through the standard CC/CXX (and, optionally, FC) environment variables, which are propagated to DiFfRG and every bundled dependency:
You can also set these in the config file (see the commented export CC=…/export CXX=… lines there). Because CMake caches the compiler on the first configure, switching compilers afterwards requires a clean build tree (run clear_all.sh).
By default a compatible system copy of each is used if found, otherwise it is built from source:
Each can be controlled independently, e.g.:
Note on Boost: deal.II uses the legacy module-mode FindBoost, which needs compiled Boost component libraries including boost_system. Very recent Boost releases ship Boost.System header-only and cannot be consumed by deal.II here, so the bundled Boost is built automatically (and an incompatible -b prefix is a hard error). TBB and SUNDIALS have no such restriction. oneTBB and SUNDIALS each build in only ~1–2 minutes, so the savings from a system copy are modest — the main benefit is reusing existing/HPC-module installs.