PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
|
PetIBM only officially supports Linux systems. MacOS and Windows may or may not work. We will not provide any assist to issues of using PetIBM on MacOS and Windows.
End-users can install PetIBM with Anaconda or use it with container technologies.
conda
/mamba
We uploaded our pre-built packages to our Anaconda channels barbagroup
. These packages were built with GPU support. Linux users can install them through
We suggest using mamba
. If conda
is preferred, just replace mamba
with conda
. Replace install
with create -n <env name>
instead to create a new and fresh environment.
If an older CUDA is desired (e.g., for old GPU models), we also have packages for CUDA 10.2, which supports old GPUs like K20/K40. To do so, use "petibm=*=cuda102*"
instead.
Note: The CUDA 10.2 variant may also work on newer GPUs and drivers. If you encounter issues using the CUDA 11.4 variant with newer GPUs/drivers, it should be fine to use the CUDA 10.2 variant. AmgX uses somehow different code w.r.t. whether it's CUDA 10 or CUDA 11, and sometimes there are issues in AmgX's CUDA 11 codebase.
For users familiar with Docker or Singularity Container (now renamed Apptainer), we provide images for the both to save you from compiling, buliding, and installing:
The above two installation methods only provide the solver. Some example cases in the examples
folder have Python scripts for post-processing. To be able to execute these Python scripts, install the following Python packages (using mamba
/conda
, for example):
If you just need to set up a development environment to extend/debug PetIBM, we suggest installing dependencies with conda
/mamba
:
The package amgxwrapper
pulls in most of the required dependencies (e.g., petsc, cuda, etc.). yaml-cpp
and symengine
are dependencies not covered by amgxwrapper
. cmake
, make
, git
, and gxx_linux-64
are for building PetIBM in case your system does not have them or they are too old.
Once the process is done, jump into the environment through either mamba activate <env name>
or source <mamba installation prefix>/bin/activate <env name>
.
The above command only installs required packages for the flow solvers. See section A.3 for dependencies for post-processing with example cases.
To proceed, let's assume you would like to download PetIBM's source files to path $HOME/sfw/petibm/PetIBM
, and to install PetIBM's final solvers and libraries to $HOME/sfw/petibm/petibm-linux-dbg
.
Pull the latest development version of PetIBM from GitHub:
PetIBM's source files are now at $HOME/sfw/petibm/PetIBM
. Our current location is at $HOME/sfw/petibm
.
Create a folder to host temporary files from building and compilation:
Configure the build:
mamba
(or conda
), so their paths are $CONDA_PREFIX
.-DPETIBM_ENABLE_TESTS
controls whether to build unit tests.-DPETIBM_USE_AMGX
notifies PetIBM to build against GPU-related code.Later on when you want to have a production build, just change -DCMAKE_BUILD_TYPE
from Debug
to Release
. (And you may also want to change the installation path in -DCMAKE_INSTALL_PREFIX
.)
Start to build:
Specifying the number of CPUs with <number of CPUS>
to speed up the compilation procedure.
We can do some unit tests:
Then install the final solvers and libraries:
The solvers are now available at $HOME/sfw/petibm/petibm-linux-dbg/bin
.
If you would like to build everything from scratch, here's the list of dependencies:
Required:
Optional for GPU linear solvers:
Optional for pre- and post-processing Python scripts:
Note:
Different linux distributions use different package management systems. Here we use Ubuntu 20.04 as an example. Assuming you have permission to use sudo
, to install compilers and tools:
You can check the version of G++ installed with g++ --version
.
Now we also need cmake
. Unfortunately, cmake
from Ubuntu 20.04 is too old. We need to install it from upstream directly:
This will install the cmake
v3.23 to /usr
as if it's a package from the package manager.
SymEngine requires some other third-party dependencies. The building process is not trivial. Hence we are not covering how to build and install SymEngine. Some Linux distributions officially provide pre-built SymEngine. For example, in Arch Linux, the pre-built SymEngine can be installed with sudo pacman -S symengine
. Check with your Linux distribution's package manager first.
If building SymEngine from scratch is needed, please refer to SymEngine's documentation here.
Here, we provide the command-line instructions to install PETSc v3.16.6. PETSc is powerful and has a lot of options to configure and for different levels of optimizations. We only show the bare minimum configuration that at least work for PetIBM.
Get and unpack PETSc:
Configure and build PETSc in debugging mode:
To configure and build PETSc for production runs, change the value of --with-debugging
form 1
to 0
, and add --COPTFLAGS="-O3" --CXXOPTFLAGS="-O3"
to the list of flags. You may also want to change the name in PETSC_ARCH
.
The above configuration also downloads and installs OpenMPI. However, it is not optimized. When running the code on an external cluster, we suggest configure and build PETSc with a proper MPI package for performance.
To understand and use a more advanced configuration of PETSc, please refer to PETSc's instructions. Also, you can run ./configure --help
to list all available configure flags.
Here we will build a CPU-only PetIBM with yaml-cpp
being installed automatically.
Pull the latest development version of PetIBM from GitHub:
Configure and build PetIBM:
For production runs, change the value of -DCMAKE_BUILD_TYPE
to Release
and refer to the corresponding PETSc builds in -DPETSC_DIR
and -DPETSC_ARCH
.
Et voila! Now PetIBM is installed to $HOME/sfw/petibm/petibm-linux-dbg
.
PetIBM's GPU support comes from NVIDIA's AmgX. And the interface between PETSc and AmgX is provided by AmgXWrapper.
Building AmgX is an expensive job. Without a powerful machine, building AmgX may take hours. Hence we would like to refer interested readers to AmgX's manual for how to build and install it.
Once AmgX is available on your machine, AmgXWrapper can be automatically downloaded and installed during installing PetBM:
Examples files are installed at <PetIBM installation>/share/petibm/examples
. For example, for installation with conda
/mamba
, the <PetIBM installation>
is $CONDA_PREFIX
.