Skip to content

Commit fb50737

Browse files
authored
Wiki addition: how to run containers with GPUs (#128)
Closes #84.
1 parent f468d63 commit fb50737

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

wiki/Installation-Instructions.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,34 @@ docker run -it ghcr.io/mesh-adaptation/firedrake-parmmg:latest
2424

2525
For more information on how to run docker containers, see the [official documentation](https://docs.docker.com/engine/containers/run/). For example, since all data inside a container is only accessible from inside the container, it is useful to create [filesystem mounts](https://docs.docker.com/engine/containers/run/#filesystem-mounts) to be able to access data from outside the container.
2626

27+
28+
### Using GPUs inside a container
29+
30+
Passing the `--gpus` flag to `docker run` allows us to use GPUs inside containers (see [Docker documentation](https://docs.docker.com/reference/cli/docker/container/run/#gpus) for details). For example, to use all available GPUs, run the following:
31+
```
32+
docker run -it --gpus all ghcr.io/mesh-adaptation/firedrake-parmmg:latest
33+
```
34+
35+
Once inside the container, we should first check that the GPUs have been detected. For NVIDIA GPUs we may do so by running `nvidia-smi` from the command line. If successful, information about your NVIDIA GPUs should be displayed, similarly to this:
36+
```
37+
+-----------------------------------------------------------------------------------------+
38+
| NVIDIA-SMI 560.35.02 Driver Version: 560.94 CUDA Version: 12.6 |
39+
|-----------------------------------------+------------------------+----------------------+
40+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
41+
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
42+
| | | MIG M. |
43+
|=========================================+========================+======================|
44+
| 0 NVIDIA GeForce RTX 3060 Ti On | 00000000:01:00.0 On | N/A |
45+
| 0% 39C P8 19W / 220W | 1274MiB / 8192MiB | 3% Default |
46+
| | | N/A |
47+
+-----------------------------------------+------------------------+----------------------+
48+
```
49+
50+
Now you may proceed with installing GPU-supported software as normal. For example, to [install PyTorch](https://pytorch.org/get-started/locally/) with CUDA version 12.6 (as reported by `nvidia-smi` above), we may run:
51+
```
52+
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
53+
```
54+
2755
## Installing Mesh Adaptation modules
2856

2957
The Mesh Adaptation packages can be installed through the following options, denoting the package of interest by `<PACKAGE>`.

0 commit comments

Comments
 (0)