Skip to content

Commit a56e1e3

Browse files
author
Malmahrouqi3
committed
few adjustments
1 parent b9dc1b3 commit a56e1e3

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

.github/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ RUN echo "TARGET=$TARGET CC=$CC_COMPILER FC=$FC_COMPILER" && \
4646

4747
RUN cd /opt/MFC && \
4848
if [ "$TARGET" = "gpu" ]; then \
49-
./mfc.sh test --dry-run --gpu -j $(nproc); \
49+
./mfc.sh test -a --dry-run --gpu -j $(nproc); \
5050
else \
51-
./mfc.sh test --dry-run -j $(nproc); \
51+
./mfc.sh test -a --dry-run -j $(nproc); \
5252
fi
5353

5454
WORKDIR /opt/MFC

docs/documentation/docker.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
- Install Docker on [Mac](https://docs.docker.com/desktop/setup/install/mac-install/), [Windows](https://docs.docker.com/desktop/setup/install/windows-install/), or [Linux](https://docs.docker.com/desktop/setup/install/linux/).
66

77
Via Docker Desktop GUI,
8-
- Search for [sbryngelson/mfc](https://hub.docker.com/r/sbryngelson/mfc) repository where all MFC images are stored then pull a release tag (e.g. `latest-cpu`).
8+
- Search for [sbryngelson/mfc](https://hub.docker.com/r/sbryngelson/mfc) repository where all the MFC images are stored then pull a release tag (e.g., `latest-cpu`).
99

10-
Read through **Tag Details** below to distinguish between them. Docker Desktop's left sidebar has two key tabs: **Images** stores your program copies, while **Containers** shows instances of those images. You can launch multiple containers from a single image.
10+
Read through the **Tag Details** below to distinguish between them. Docker Desktop's left sidebar has two key tabs: **Images** stores your program copies, while **Containers** shows instances of those images. You can launch multiple containers from a single image.
1111

1212
- Start a container by clicking the Run button in the Images tab.
1313

14-
Use the *Exec* section to interact with MFC directly via terminal, the *Files* section to transfer files between your device and container, and the *Stats* section displays resource usage of it.
14+
Use the *Exec* section to interact with MFC directly via terminal, the *Files* section to transfer files between your device and container, and the *Stats* section to display resource usage.
1515

1616
Or via Docker CLI,
1717

@@ -24,41 +24,40 @@ docker run -it --rm --entrypoint bash sbryngelson/mfc:latest-cpu
2424

2525
**Selecting OS/ARCH:**
2626

27-
Docker by default selects the compatible architecture when pulling and running a container. However, you can manually specify your platform (i.e. `linux/amd64` for most devices or `linux/arm64`for Apple Silicon).
27+
Docker by default selects the compatible architecture when pulling and running a container. However, you can manually specify your platform (i.e., `linux/amd64` for most devices or `linux/arm64` for Apple Silicon).
2828
```bash
2929
docker run -it --rm --entrypoint bash --platform linux/amd64 sbryngelson/mfc:latest-cpu
3030
```
3131
<br>
3232

3333
## Running Containers
3434

35-
Start a CPU container
35+
Start a CPU container.
3636
```bash
3737
docker run -it --rm --entrypoint bash sbryngelson/mfc:latest-cpu
3838
```
39-
Start a GPU container
39+
Start a GPU container.
4040
```bash
41-
docker run -it --rm --entrypoint bash --gpus all sbryngelson/mfc:latest-gpu
41+
docker run -it --rm --gpus all --entrypoint bash sbryngelson/mfc:latest-gpu
4242
```
43-
**Note:** `--gpus all` exposes the container to available GPUs, and only Nvidia GPUs are currently supported. Make sure your device CUDA version is at least 12.3 to avoid backward compatibility issues.
43+
**Note:** `--gpus all` exposes the container to available GPUs, and only Nvidia GPUs are currently supported. Make sure your device's CUDA version is at least 12.3 to avoid backward compatibility issues.
4444

45-
*⚠️ Append the `--debug` option to the `./mfc.sh` command inside the container with **Apple Silicon** (ARM-based Architecture) to bypass any potential errors or run `./mfc.sh clean && ./mfc.sh build` if needed.*
4645
<br>
4746
<br>
4847

4948
**Mounting Directory:**
5049

51-
Mount a directory to `mnt` inside the container to easily transfer files between the host and the container, e.g. `cp -r <source> /mnt/`.
50+
Mount a directory to `mnt` inside the container to easily transfer files between the host and the container, e.g. `cp -r <source> /mnt/destination>`.
5251
```bash
5352
docker run -it --rm --entrypoint bash -v "$PWD":/mnt sbryngelson/mfc:latest-cpu
5453
```
5554
<br>
5655

5756
**Shared Memory:**
5857

59-
Increase the shared memory size to prevent MPI memory binding errors which may fail some tests and cases. Otherwise, you can disable MPI inside the container `--no-mpi`.
58+
Increase the shared memory size to prevent MPI memory binding errors which may fail some tests and cases. Otherwise, you can disable MPI inside the container (`--no-mpi`).
6059
```bash
61-
docker run -it --rm --entrypoint bash --shm-size=<e.g. 4gb> sbryngelson/mfc:latest-cpu
60+
docker run -it --rm --entrypoint bash --shm-size=<e.g., 4gb> sbryngelson/mfc:latest-cpu
6261
```
6362

6463

@@ -67,13 +66,13 @@ docker run -it --rm --entrypoint bash --shm-size=<e.g. 4gb> sbryngelson/mfc:late
6766
### **For Portability,**
6867

6968
On the source machine,
70-
- Pull and save the image
69+
- Pull and save the image.
7170
```bash
7271
docker pull sbryngelson/mfc:latest-cpu
7372
docker save -o mfc:latest-cpu.tar sbryngelson/mfc:latest-cpu
7473
```
7574
On the target machine,
76-
- Load and run the image
75+
- Load and run the image.
7776
```bash
7877
docker load -i mfc:latest-cpu.tar
7978
docker run -it --rm mfc:latest-cpu
@@ -85,24 +84,24 @@ docker run -it --rm mfc:latest-cpu
8584

8685
### **Interactive Shell**
8786
```bash
88-
apptainer exec --fakeroot --writable-tmpfs --bind "$PWD":/mnt docker://sbryngelson/mfc:latest-gpu bash -c "cd /opt/MFC && bash"
87+
apptainer shell --nv --fakeroot --writable-tmpfs --bind "$PWD":/mnt docker://sbryngelson/mfc:latest-gpu
88+
Apptainer>cd /opt/MFC
8989
```
90-
or
90+
or
9191
```bash
92-
apptainer shell --fakeroot --writable-tmpfs --bind "$PWD":/mnt docker://sbryngelson/mfc:latest-gpu
93-
Apptainer>cd /opt/MFC
92+
apptainer exec --nv --fakeroot --writable-tmpfs --bind "$PWD":/mnt docker://sbryngelson/mfc:latest-gpu bash -c "cd /opt/MFC && bash"
9493
```
9594

9695
### **For Portability,**
9796
On the source machine,
98-
- Pull and translate the image into `.sif` format
97+
- Pull and translate the image into `.sif` format.
9998
```bash
10099
apptainer build mfc:latest-gpu.sif docker://sbryngelson/mfc:latest-gpu
101100
```
102101
On the target machine,
103-
- Load and start an interactive shell
102+
- Load and start an interactive shell.
104103
```bash
105-
apptainer shell --fakeroot --writable-tmpfs --bind "$PWD":/mnt mfc:latest-gpu.sif
104+
apptainer shell --nv --fakeroot --writable-tmpfs --bind "$PWD":/mnt mfc:latest-gpu.sif
106105
```
107106

108107

@@ -126,18 +125,19 @@ cd $SLURM_SUBMIT_DIR
126125
# Define container image
127126
CONTAINER="mfc:latest-gpu.sif"
128127

129-
apptainer exec --fakeroot --writable-tmpfs \
128+
apptainer exec --nv --fakeroot --writable-tmpfs \
130129
--bind "$PWD":/mnt \
131130
$CONTAINER \
132-
bash -c "cd /opt/MFC && ./mfc.sh run sim/case.py -c <computer>"
131+
bash -c "cd /opt/MFC && ./mfc.sh run sim/case.py -- -c <computer>"
133132
```
134-
Where
133+
Where,
135134

136-
`/sim` directory contains all simulation files including case setup (`case.py`).
135+
`/sim` directory should all the simulation files, including the case setup (`case.py`).
137136

138-
`--fakeroot --writable-tmpfs` are critical to:
139-
- Enable root-like permissions inside the container without actual root access
140-
- Allow temporary write access to the container filesystem
137+
`--nv --fakeroot --writable-tmpfs`, these flags are critical to:
138+
- Grant access to the host system's Nvidia GPU and its CUDA libraries.
139+
- Enable root-like permissions inside the container without actual root access.
140+
- Allow temporary write access to the container filesystem.
141141

142142

143143

@@ -160,7 +160,7 @@ mfc:vx.x.x-xxx-ubuntu-xx.xx # amd64 natively-supported version
160160
mfc:vx.x.x-xxx-ubuntu-xx.xx-arm # arm64 natively-supported version
161161
```
162162
### **Architecture Support**
163-
You can specify the desired architecture with `--platform <os>/<arch>` - either `linux/amd64` or `linux/arm64`. If not sure, Docker automatically selects the available image compatible with your system architecture. If native support isn't available, QEMU emulation is enabled for the following architectures albeit with degraded performance.
163+
You can specify the desired architecture with `--platform <os>/<arch>` - either `linux/amd64` or `linux/arm64`. If unsure, Docker automatically selects the compatible image with your system architecture. If native support isn't available, QEMU emulation is enabled for the following architectures albeit with degraded performance.
164164
```
165165
linux/amd64
166166
linux/amd64/v2

0 commit comments

Comments
 (0)