|
|
<!-- --- title: Precompiled Packages (apptainer) -->
|
|
|
|
|
|
[![home](/icons/home.svg "wiki home")](/home)
|
|
|
[![packages](/icons/package.svg "packages")](/precompiled)
|
|
|
|
|
|
----
|
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
|
|
|
## ![>](/icons/apptainer.png) Apptainer
|
|
|
|
|
|
[Apptainer][apptainer] _(formerly known as singularity)_ is
|
|
|
a container image system favoured on HPC systems.
|
|
|
|
|
|
For those already familar with docker or podman containers,
|
|
|
[apptainer][apptainer] uses a slightly different approach:
|
|
|
- Runs without elevated (root) privileges
|
|
|
- Images are saved as physical files to disk
|
|
|
|
|
|
|
|
|
### About the images
|
|
|
|
|
|
For overall flexibility, the OpenFOAM [apptainer][apptainer] support
|
|
|
is provided via description files in the
|
|
|
[packaging/containers][packaging-containers] repository
|
|
|
rather than pre-assembled images. The download bandwidth will be
|
|
|
essentially identical in both cases.
|
|
|
|
|
|
![!!](/icons/alert-triangle.svg) The packages do ***not*** contain
|
|
|
_visualization_ (eg, ParaView/runTimePostProcessing) or
|
|
|
_external-solver_ (eg, PETSc) modules: <br/>
|
|
|
see the [corresponding **FAQ**](/precompiled#frequently-asked-questions)
|
|
|
|
|
|
|
|
|
## Creating an OpenFOAM apptainer image
|
|
|
|
|
|
Creating an [apptainer][apptainer] image is a simple as downloading
|
|
|
the container description files from the
|
|
|
[packaging/containers][packaging-containers] repository.
|
|
|
|
|
|
Select and edit the definitions to suit your purposes and build the
|
|
|
image. For example,
|
|
|
```
|
|
|
apptainer build --fakeroot openfoam2212.sif openfoam-run_rocky.def
|
|
|
```
|
|
|
which will build the file `openfoam2212.sif` from the image
|
|
|
description file, using the [RockyLinux](rockylinux.org) base image.
|
|
|
A `.sif` extension (singularity image format) is often used for the
|
|
|
apptainer files but is not required.
|
|
|
|
|
|
|
|
|
### Notes
|
|
|
|
|
|
It is recommended to base OpenFOAM [apptainer][apptainer] images on the
|
|
|
framework provided by the [packaging/containers][packaging-containers]
|
|
|
repository. In addition to providing the plain sequencing of package
|
|
|
installation, the included file assets (openfoam-files.rc/) provide
|
|
|
for a coherent runtime environment with the OpenFOAM environment
|
|
|
properly initialised.
|
|
|
|
|
|
|
|
|
## Running OpenFOAM in an apptainer
|
|
|
|
|
|
Running OpenFOAM in an [apptainer][apptainer] is absolutely straight
|
|
|
forward.
|
|
|
Simply place the generated apptainer file somewhere convenient in your
|
|
|
path (eg, `$HOME/bin` etc) and use it.
|
|
|
|
|
|
For example,
|
|
|
```
|
|
|
$ openfoam2212.sif
|
|
|
```
|
|
|
|
|
|
This will open an interactive shell with the OpenFOAM environment
|
|
|
active, with the current local directory mounted within the container.
|
|
|
|
|
|
|
|
|
### Running interactively
|
|
|
|
|
|
Running an interactive shell with the OpenFOAM environment active is
|
|
|
the default behaviour for the image and the internal run-script.
|
|
|
|
|
|
For example,
|
|
|
```
|
|
|
$ openfoam2212.sif
|
|
|
```
|
|
|
|
|
|
|
|
|
### Running non-interactively
|
|
|
|
|
|
It is also possible to use the image in batch mode.
|
|
|
For example,
|
|
|
```
|
|
|
$ openfoam2212.sif blockMesh -help
|
|
|
```
|
|
|
|
|
|
It is also possible to use as for running shell scripts.
|
|
|
For example,
|
|
|
```
|
|
|
$ openfoam2212.sif -c './Allrun'
|
|
|
```
|
|
|
|
|
|
Note that the entry point within the image itself also has some option
|
|
|
handling.
|
|
|
For example,
|
|
|
```
|
|
|
$ openfoam2212.sif -help
|
|
|
```
|
|
|
|
|
|
|
|
|
---
|
|
|
Copyright (C) 2022 OpenCFD Ltd.
|
|
|
|
|
|
[apptainer]: https://apptainer.org
|
|
|
[packaging-containers]: https://develop.openfoam.com/packaging/containers
|
|
|
[dockerhub-opencfd]: https://hub.docker.com/u/opencfd
|
|
|
[run-script]: https://develop.openfoam.com/packaging/containers/-/raw/main/openfoam-docker
|
|
|
|
|
|
[link paraview]: https://www.paraview.org/download/
|
|
|
[faq paraview]: https://discourse.paraview.org/t/i-want-to-visualize-my-openfoam-simulation-results-with-paraview-but-im-confused-which-version-should-i-use |