Integrate with Apptainer

Charmed HPC can integrate with Apptainer to enable container workload scheduling with Slurm. This guide explains how to enable container workload scheduling by deploying and integrating Apptainer with Charmed HPC.

New to Apptainer?

If you’re unfamiliar with operating Apptainer installations, see the Apptainer admin quick start guide for a high-level introduction to administering Apptainer.

Prerequisites

Deploy and integrate Apptainer

First, in the same model holding your Slurm deployment, deploy Apptainer with juju deploy:

user@host:~$
juju deploy apptainer
Tip: Determining the current Juju model

You can use juju switch to determine the current model you’re operating on:

user@host:~$
juju switch
charmed-hpc-controller:admin/slurm

The output above shows that we’re operating on the slurm model as the admin user through the Juju controller charmed-hpc-controller.

Now integrate Apptainer with Slurm using juju integrate:

user@host:~$
juju integrate apptainer sackd
user@host:~$
juju integrate apptainer slurmd
user@host:~$
juju integrate apptainer slurmctld

Apptainer will be installed on all the sackd and slurmd units, and will share its configuration with the Slurm controller, slurmctld.

Test that Apptainer is integrated with Slurm

Submit a test job with juju exec. If Apptainer has been successfully integrated with Slurm, the output of your test job will be similar to the following:

user@host:~$
juju exec -u sackd/0 -- srun --partition slurmd --container=docker://ubuntu:22.04 cat /etc/os-release | grep ^VERSION
INFO:    Converting OCI blobs to SIF format
INFO:    Starting build...
INFO:    Fetching OCI image...
INFO:    Extracting OCI image...
INFO:    Inserting Apptainer configuration...
INFO:    Creating SIF file...
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy

Next steps

You can now use Apptainer to run workloads and build container images on your Charmed HPC cluster. Explore the Use Apptainer how-to for more information on using Apptainer on your Charmed HPC cluster.