This repository contains Apptainer (Singularity) definitions of Mat3ra public application containers. Containers are built automatically via GitHub workflow and are hosted on GitHub Container Registry.
Images are packaged as SIF (ORAS) files and are hosted on GitHub Container
Registry. Please find the list of images under packages,
select the appropriate tag, and copy its URL. We can use apptainer pull
command to download images. For example, to download GNU build of Quantum
ESPRESSO v6.3, we can use the following command:
apptainer pull oras://ghcr.io/exabyte-io/application-containers-public/espresso:6.3-gnu-0We can use apptainer exec command to run applications packaged in containers.
apptainer exec <image>.sif <command>
apptainer exec espresso-6.3-gnu-0.sif pw.x -in pw.in > pw.outWe can map host directories to the container using --bind directive if needed.
apptainer exec --bind /path/to/host:/path/to/container <image>.sif <command>
apptainer exec --bind /export espresso-6.3-gnu-0.sif pw.x -in pw.in > pw.outUse --nv flag to enable NVIDIA GPU support.
apptainer exec --nv <image>.sif <command>- Create apptainer definition file under the corresponding application directory
- Bootstrap from existing base images wherever possible
- Add new container entry to
manifest.ymlto built images automatically via GitHub workflow - Use application version as tag, followed by dependency/toolchain
version information. Finally, add
-Nnumeric suffix to denote the build iteration starting from 0. New builds are triggered when the tag is updated. - For large dependencies like Intel OneAPI or NVIDIA HPC SDK, we can use
apptainer
--binddirective to map the host installation to the container. - Finally, to add an application to the Mat3ra platform, create a pull request
to the standata repository with the
new application configuration data under
standata/assets/applications/applicationsdirectory (please refer to existing configurations for reference).
Apptainer manages ENV variables with a number of shell scripts under
/.singularity.d/env:
# ls -l /.singularity.d/env
total 10
-rwxr-xr-x 1 root root 1337 Aug 1 01:32 01-base.sh
-rwxr-xr-x 1 root root 85 Aug 1 01:32 10-docker2singularity.sh
-rwxr-xr-x 1 root root 1707 Dec 6 06:18 90-environment.sh
-rwxr-xr-x 1 root root 0 Dec 6 06:09 94-appsbase.sh
-rwxr-xr-x 1 root root 3052 Aug 1 01:32 95-apps.sh
-rwxr-xr-x 1 root root 1568 Aug 1 01:32 99-base.sh
-rwxr-xr-x 1 root root 922 Aug 1 01:32 99-runtimevars.sh90-environment.sh is where the variables from %environment definition goes.
Above files are generated every time a new container is built, they are not
preserved from the base images. However, if we write variables to any other
file under /.singularity.d/env, they are preserved and sourced in runtime.
Notice the numerical prefix, that determines the order of sourcing. We can
write custom ENV variables to $APPTAINER_ENVIRONMENT in the %post section,
it will save them to 91-environment.sh. This file will be sources runtime
automatically, if we need these variables runtime, we can source manually:
if [ -f /.singularity.d/env/91-environment.sh ]; then
. /.singularity.d/env/91-environment.sh
fi- Write ENV variables to
$APPTAINER_ENVIRONMENTin base images.
echo 'export ONEAPI_ROOT=/opt/intel-2023.1' >> $APPTAINER_ENVIRONMENTor
cat >> $APPTAINER_ENVIRONMENT <<'EOF'
export ONEAPI_ROOT=/opt/intel-2023.1
export TBBROOT=$ONEAPI_ROOT/tbb/2021.11
EOFNotice the single quote above to preserve the bash variables in echo or cat
output, and substitute them runtime.
- Set application container (final container) ENV variables via
%environmentdefinition.
