Skip to content

Commit fca5055

Browse files
committed
Update formatting
1 parent 39d5eff commit fca5055

File tree

1 file changed

+88
-129
lines changed

1 file changed

+88
-129
lines changed

docs/software/container-engine.md

Lines changed: 88 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,39 @@
11
[](){#ref-container-engine}
22
# Container Engine
33

4-
The Container Engine (CE) toolset is designed to enable computing jobs to
5-
seamlessly run inside Linux application containers, thus providing support for
6-
containerized user environments.
4+
The Container Engine (CE) toolset is designed to enable computing jobs to seamlessly run inside Linux application containers, thus providing support for containerized user environments.
75

86
## Concept
97

10-
Containers effectively encapsulate a software stack; however, to be useful in
11-
HPC computing environments, they often require the customization of bind
12-
mounts, environment variables, working directories, hooks, plugins, etc. To
13-
simplify this process, the Container Engine (CE) toolset supports the
14-
specification of user environments through Environment Definition Files.
8+
Containers effectively encapsulate a software stack; however, to be useful in HPC computing environments, they often require the customization of bind mounts, environment variables, working directories, hooks, plugins, etc.
9+
To simplify this process, the Container Engine (CE) toolset supports the specification of user environments through Environment Definition Files.
1510

16-
An Environment Definition File (EDF) is a text file in the [TOML
17-
format](https://toml.io/en/) that declaratively and prescriptively represents
18-
the creation of a computing environment based on a container image. Users can
19-
create their own custom environments and share, edit, or build upon already
20-
existing environments.
11+
An Environment Definition File (EDF) is a text file in the [TOML format](https://toml.io/en/) that declaratively and prescriptively represents the creation of a computing environment based on a container image.
12+
Users can create their own custom environments and share, edit, or build upon already existing environments.
2113

22-
The Container Engine (CE) toolset leverages its tight integration with the
23-
Slurm workload manager to parse EDFs directly from the command line or batch
24-
script and instantiate containerized user environments seamlessly and
25-
transparently.
14+
The Container Engine (CE) toolset leverages its tight integration with the Slurm workload manager to parse EDFs directly from the command line or batch script and instantiate containerized user environments seamlessly and transparently.
2615

27-
Through the EDF, container use cases can be abstracted to the point where end
28-
users perform their workflows as if they were operating natively on the
29-
computing system.
16+
Through the EDF, container use cases can be abstracted to the point where end users perform their workflows as if they were operating natively on the computing system.
3017

3118
**Key Benefits**
3219

33-
* *Freedom*: Container gives users full control of the user space. The user
34-
can decide what to install without involving a sysadmin.
35-
* *Reproducibility*: Workloads consistently run in the same environment,
36-
ensuring uniformity across job experimental runs.
37-
* *Portability*: The self-contained nature of containers simplifies the
38-
deployment across architecture-compatible HPC systems.
39-
* *Seamless Access to HPC Resources*: CE facilitates native access to
40-
specialized HPC resources like GPUs, interconnects, and other
41-
system-specific tools crucial for performance
20+
* *Freedom*: Container gives users full control of the user space. The user can decide what to install without involving a sysadmin.
21+
* *Reproducibility*: Workloads consistently run in the same environment, ensuring uniformity across job experimental runs.
22+
* *Portability*: The self-contained nature of containers simplifies the deployment across architecture-compatible HPC systems.
23+
* *Seamless Access to HPC Resources*: CE facilitates native access to specialized HPC resources like GPUs, interconnects, and other system-specific tools crucial for performance.
4224

4325
## Quick Start
4426

45-
Let's set up a containerized Ubuntu 24.04 environment inside a scratch folder
46-
(`${SCRATCH}`).
47-
48-
### Example EDF
27+
Let's set up a containerized Ubuntu 24.04 environment on the scratch folder (`${SCRATCH}`).
28+
Save this file below as `ubuntu.toml` in `${HOME}/.edf` directory (the default location of EDF files).
29+
A more detailed explanation of each entry for the EDF can be seen in the [EDF reference][ref-ce-edf-reference].
4930

5031
```bash
5132
image = "library/ubuntu:24.04"
5233
mounts = ["/capstor/scratch/cscs/${USER}:/capstor/scratch/cscs/${USER}"]
5334
workdir = "/capstor/scratch/cscs/${USER}"
5435
```
5536

56-
Save this file as `ubuntu.toml` file in `${HOME}/.edf` directory (the default
57-
location of EDF files). A more detailed explanation of each entry for the EDF
58-
can be seen in the [EDF reference][ref-ce-edf-reference]
5937

6038
!!! note
6139
Create `${HOME}/.edf` if the folder doesn't exist.
@@ -69,9 +47,8 @@ $ srun --environment=ubuntu --pty bash
6947
```
7048

7149
!!! example "Launching a containerized environment"
72-
The terminal snippet below demonstrates how to launch a containerized
73-
environment using Slurm with the `--environment` option. Click on the
74-
:fontawesome-solid-circle-plus: icon for information on each command.
50+
The terminal snippet below demonstrates how to launch a containerized environment using Slurm with the `--environment` option.
51+
Click on the :fontawesome-solid-circle-plus: icon for information on each command.
7552

7653
```console
7754
[daint-ln002]$ srun --environment=ubuntu --pty bash (1)
@@ -89,134 +66,116 @@ $ srun --environment=ubuntu --pty bash
8966
[daint-ln002]$
9067
```
9168

92-
1. Starting an interactive shell session within the Ubuntu 24.04 container
93-
deployed on a compute node using `srun --environment=ubuntu --pty bash`.
94-
2. Check the current folder (dubbed _the working directory_) is set to the
95-
user's scratch folder, as per EDF.
96-
3. Show the OS version of your container (using `cat /etc/os-release`)
97-
based on Ubuntu 24.04 LTS.
69+
1. Starting an interactive shell session within the Ubuntu 24.04 container deployed on a compute node using `srun --environment=ubuntu --pty bash`.
70+
2. Check the current folder (dubbed _the working directory_) is set to the user's scratch folder, as per EDF.
71+
3. Show the OS version of your container (using `cat /etc/os-release`) based on Ubuntu 24.04 LTS.
9872
4. Exiting the container (`exit`), returning to the login node.
9973

10074
!!! note
10175
CE pulls the image automatically when the container starts.
10276

10377
## Running containerized environments
10478

105-
Specifying the `--environment` option to the Slurm command (e.g., `srun` or
106-
`salloc`) will make it run inside the EDF environment. For example:
79+
Specifying the `--environment` option to the Slurm command (e.g., `srun` or `salloc`) will make it run inside the EDF environment:
10780

108-
```bash
109-
$ srun --environment=$SCRATCH/edf/debian.toml cat /etc/os-release
110-
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
111-
NAME="Debian GNU/Linux"
112-
VERSION_ID="12"
113-
...
114-
```
81+
!!! example
82+
```bash
83+
$ srun --environment=$SCRATCH/edf/debian.toml cat /etc/os-release
84+
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
85+
NAME="Debian GNU/Linux"
86+
VERSION_ID="12"
87+
...
88+
```
11589

116-
`--environment` can be a relative path from the current working directory
117-
(i.e., where the Slurm command is executed). A relative path should be prepended
118-
by `./`. For example:
90+
`--environment` can be a relative path from the current working directory (i.e., where the Slurm command is executed).
91+
A relative path should be prepended by `./`:
11992

120-
```bash
121-
$ ls
122-
debian.toml
123-
124-
$ srun --environment=./debian.toml cat /etc/os-release
125-
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
126-
NAME="Debian GNU/Linux"
127-
VERSION_ID="12"
128-
...
129-
```
93+
!!! example
94+
```bash
95+
$ ls
96+
debian.toml
13097

131-
If an EDF is located in the [EDF search path][ref-ce-edf-search-path],
132-
`--environment` also accepts the EDF filename without the `.toml` extension. For
133-
example:
98+
$ srun --environment=./debian.toml cat /etc/os-release
99+
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
100+
NAME="Debian GNU/Linux"
101+
VERSION_ID="12"
102+
...
103+
```
134104

135-
```bash
136-
$ srun --environment=debian cat /etc/os-release
137-
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
138-
NAME="Debian GNU/Linux"
139-
VERSION_ID="12"
140-
...
141-
```
105+
If an EDF is located in the [EDF search path][ref-ce-edf-search-path], `--environment` also accepts the EDF filename without the `.toml` extension:
106+
107+
!!! example
108+
```bash
109+
$ srun --environment=debian cat /etc/os-release
110+
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
111+
NAME="Debian GNU/Linux"
112+
VERSION_ID="12"
113+
...
114+
```
142115

143116
### Use from batch scripts
144117

145-
The recommended approach is to use `--environment` as part of the Slurm command
146-
(e.g., `srun` or `salloc`). For example, when launching job steps:
118+
The recommended approach is to use `--environment` as part of the Slurm command (e.g., `srun` or `salloc`):
147119

148-
```bash
149-
#!/bin/bash
150-
#SBATCH --job-name=edf-example
151-
...
120+
!!! example
121+
```bash
122+
#!/bin/bash
123+
#SBATCH --job-name=edf-example
124+
...
152125

153-
# Run job step
154-
srun --environment=debian cat /etc/os-release
155-
```
126+
# Run job step
127+
srun --environment=debian cat /etc/os-release
128+
```
156129

157-
Alternatively, the `--environment` option can also be specified with an
158-
`#SBATCH` option. However, the support status is still **experimental** and may
159-
result in unexpected behaviors.
130+
Alternatively, the `--environment` option can also be specified with an `#SBATCH` option.
131+
However, the support status is still **experimental** and may result in unexpected behaviors.
160132

161133
!!! note
162-
Specifying `--environment` with `#SBATCH` will put the entire batch script
163-
inside the containerized environment, requiring the Slurm hook to use any
164-
Slurm commands within the batch script (e.g., `srun` or `scontrol`). The
165-
hook is controlled by the `ENROOT_SLURM_HOOK` environment variable and
166-
activated by default on most vClusters.
134+
Specifying `--environment` with `#SBATCH` will put the entire batch script inside the containerized environment, requiring the Slurm hook to use any Slurm commands within the batch script (e.g., `srun` or `scontrol`).
135+
The hook is controlled by the `ENROOT_SLURM_HOOK` environment variable and activated by default on most vClusters.
167136

168137
[](){#ref-ce-edf-search-path}
169138
### EDF search path
170139

171-
By default, the EDFs for each user are looked up in `$HOME/.edf`. The default
172-
EDF search path can be changed through the `EDF_PATH` environment variable.
173-
`EDF_PATH` must be a colon-separated list of absolute paths to directories,
174-
where the CE searches each directory in order. If an EDF is located in the
175-
search path, its name can be used in the `--environment` option without the
176-
`.toml` extension. For example:
140+
By default, the EDFs for each user are looked up in `$HOME/.edf`.
141+
The default EDF search path can be changed through the `EDF_PATH` environment variable.
142+
`EDF_PATH` must be a colon-separated list of absolute paths to directories, where the CE searches each directory in order.
143+
If an EDF is located in the search path, its name can be used in the `--environment` option without the `.toml` extension.
177144

178-
```bash
179-
$ ls ~/.edf
180-
debian.toml
145+
!!! example
146+
```bash
147+
$ ls ~/.edf
148+
debian.toml
181149

182-
$ ls ~/example-project
183-
fedora-env.toml
150+
$ ls ~/example-project
151+
fedora-env.toml
184152

185-
$ export EDF_PATH="$HOME/example-project"
153+
$ export EDF_PATH="$HOME/example-project"
186154

187-
$ srun --environment=fedora-env cat /etc/os-release
188-
NAME="Fedora Linux"
189-
VERSION="40 (Container Image)"
190-
ID=fedora
191-
...
192-
```
155+
$ srun --environment=fedora-env cat /etc/os-release
156+
NAME="Fedora Linux"
157+
VERSION="40 (Container Image)"
158+
ID=fedora
159+
...
160+
```
193161

194162
## Image Management
195163

196164
### Image cache
197165

198-
By default, images defined in the EDF as remote registry references (e.g. a
199-
Docker reference) are automatically pulled and locally cached. A cached image
200-
would be preferred to pulling the image again in later usage.
166+
By default, images defined in the EDF as remote registry references (e.g. a Docker reference) are automatically pulled and locally cached.
167+
A cached image would be preferred to pulling the image again in later usage.
201168

202-
An image cache is automatically created at `.edf_imagestore` in the user's
203-
scratch folder (i.e., `${SCRATCH}/.edf_imagestore`), under which cached images
204-
are stored with the corresponding CPU architecture suffix (e.g., `x86` and
205-
`aarch64`). Cached images may be subject to the automatic cleaning policy of
206-
the scratch folder.
169+
An image cache is automatically created at `.edf_imagestore` in the user's scratch folder (i.e., `${SCRATCH}/.edf_imagestore`), under which cached images are stored with the corresponding CPU architecture suffix (e.g., `x86` and `aarch64`).
170+
Cached images may be subject to the automatic cleaning policy of the scratch folder.
207171

208-
Should users want to re-pull a cached image, they have to remove the
209-
corresponding image in the cache.
172+
Should users want to re-pull a cached image, they have to remove the corresponding image in the cache.
210173

211-
To choose an alternative image store path (e.g., to use a directory owned by a
212-
group and not to an individual user), users can specify an image cache path
213-
explicitly by defining the environment variable `EDF_IMAGESTORE`.
214-
`EDF_IMAGESTORE` must be an absolute path to an existing folder.
174+
To choose an alternative image store path (e.g., to use a directory owned by a group and not to an individual user), users can specify an image cache path explicitly by defining the environment variable `EDF_IMAGESTORE`.
175+
`EDF_IMAGESTORE` must be an absolute path to an existing folder.
215176

216177
!!! note
217-
If the CE cannot create a directory for the image cache, it operates in
218-
cache-free mode, meaning that it pulls an ephemeral image before every
219-
container launch and discards it upon termination.
178+
If the CE cannot create a directory for the image cache, it operates in cache-free mode, meaning that it pulls an ephemeral image before every container launch and discards it upon termination.
220179

221180
### Pulling images manually
222181

0 commit comments

Comments
 (0)