Container jobs
UBELIX provides access to a apptainer runtime for running applications in
software containers. Currently, there are two major providers of the
apptainer/singularity runtime, namely Singularity CE and
Apptainer, with the latter being a fork of the former. For most
cases, these should be fully compatible.
No modules need to be loaded to use apptainer on UBELIX. You can
always check the version of apptainer using the command apptainer --version.
See the Apptainer containers install page for details about creating UBELIX compatible software containers.
The basics of running a container on UBELIX
Section titled “The basics of running a container on UBELIX”Applications in a container may be run by combining Slurm commands with
Singularity commands, e.g., to get the version of Ubuntu running in a container
stored as “ubuntu_22.04.sif”, we may use srun to execute the apptainer
container
gratis account
srun --account=gratis --partition=<partition> apptainer exec ubuntu_22.04.sif cat /etc/os-releasepaygo account
srun --account=paygo --wckey=<wckey> --partition=<partition> apptainer exec ubuntu_22.04.sif cat /etc/os-releaseinvest account
srun --account=invest --qos=<investor_qos> --partition=<partition> apptainer exec ubuntu_22.04.sif cat /etc/os-releaseteaching account
srun --account=teaching --reservation=<reservation> --partition=<partition> apptainer exec ubuntu_22.04.sif cat /etc/os-releasewhich prints something along the lines of
PRETTY_NAME="Ubuntu 22.04.1 LTS"NAME="Ubuntu"VERSION_ID="22.04"VERSION="22.04.1 LTS (Jammy Jellyfish)"VERSION_CODENAME=jammyID=ubuntuID_LIKE=debianHOME_URL="https://www.ubuntu.com/"SUPPORT_URL="https://help.ubuntu.com/"BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"UBUNTU_CODENAME=jammyBinding network file systems in the container
Section titled “Binding network file systems in the container”By default, the network file system partitions, such as
/scratch or /storage are not accessible from the within the container. To
make them available, they need to be explicitly bound by passing the
-B/--bind command line option to apptainer exec/run. For instance
gratis account
srun --account=gratis --partition=<partition> apptainer exec -B /scratch/<path_to_project> ubuntu_21.04.sif ls /scratch/<path_to_project>paygo account
srun --account=paygo --wckey=<wckey> --partition=<partition> apptainer exec -B /scratch/<path_to_project> ubuntu_21.04.sif ls /scratch/<path_to_project>invest account
srun --account=invest --qos=<investor_qos> --partition=<partition> apptainer exec -B /scratch/<path_to_project> ubuntu_21.04.sif ls /scratch/<path_to_project>teaching account
srun --account=teaching --reservation=<reservation> --partition=<partition> apptainer exec -B /scratch/<path_to_project> ubuntu_21.04.sif ls /scratch/<path_to_project>Running containerized MPI applications
Section titled “Running containerized MPI applications”Running MPI applications in a container requires that you either bind the host MPI (the MPI stack provided as part of UBELIX or install a UBELIX compatible MPI stack in the container.
Using the host MPI
Section titled “Using the host MPI”To properly make use of UBELIX high-speed network, it is necessary to
mount a few host system directories inside the container and set
LD_LIBRARY_PATH so that the necessary dynamic libraries are available at run
time. This way, the UBELIX MPI stack replaces the MPI installed in the container image.
Details of this approach will be made available in the future.
Using the container MPI
Section titled “Using the container MPI”MPI applications can also be run using an MPI stack installed in the container.
To do so, Slurm needs to be instructed to use the PMI-2 process management
interface by passing --mpi=pmi2 to srun, e.g.
gratis account
srun --account=gratis --partition=<partition> --mpi=pmi2 --nodes=2 apptainer run mpi_osu.sifpaygo account
srun --account=paygo --wckey=<wckey> --partition=<partition> --mpi=pmi2 --nodes=2 apptainer run mpi_osu.sifinvest account
srun --account=invest --qos=<investor_qos> --partition=<partition> --mpi=pmi2 --nodes=2 apptainer run mpi_osu.sifteaching account
srun --account=teaching --reservation=<reservation> --partition=<partition> --mpi=pmi2 --nodes=2 apptainer run mpi_osu.sifwhich produces an output along the lines of
# OSU MPI Bandwidth Test v5.3.2# Size Bandwidth (MB/s)1 0.502 1.614 3.578 6.5416 9.6532 18.0464 35.27128 67.76256 91.12512 221.091024 278.882048 471.544096 917.028192 1160.7416384 1223.4132768 1397.9765536 1452.23131072 2373.07262144 2104.56524288 2316.711048576 2478.302097152 2481.684194304 2380.51Note that this approach gives lower bandwidths, especially for the larger message sizes, than is the case when using the UBELIX MPI. In general, the performance obtained from using the container MPI might be low compared to the results obtained when using the host’s MPI. For a more in-depth discussion about MPI in containers, we suggest that you read this introduction to MPI in containers.