Skip to content

Commit

Permalink
updated Dockerfile and docker-image.md
Browse files Browse the repository at this point in the history
  • Loading branch information
davedavemckay committed May 17, 2024
1 parent f8f92a5 commit 4550dba
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 20 deletions.
27 changes: 11 additions & 16 deletions docs/docker-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,30 @@ To run the SiMLInt Docker image follow these steps:
1. "Pure" BOUT++ Simulation: Run the following command:

```shell
docker run -v $SIMLINT_HOME/files/containerised-runs:/sim -v $SIMLINT_HOME/files/6-simulation:/6-sim \
ghcr.io/epcced/simlint:latest \
sh -c \
"cp /6-sim/BOUT.inp /sim/data/BOUT.inp && cp /sim/BOUT.restart.0.nc /sim/data/BOUT.restart.0.nc \
&& mpirun -np 1 bout-hw"
cp $SIMLINT_HOME/files/6-simulation/BOUT.inp $SIMLINT_HOME/files/containerised-runs/data; \
cp $SIMLINT_HOME/files/containerised-runs/BOUT.restart.0.nc $SIMLINT_HOME/files/containerised-runs/data; \
docker run -v $SIMLINT_HOME/files/containerised-runs:/sim -u $(id -u):$(id -g) ghcr.io/epcced/simlint:latest mpirun -np 1 bout-hw nout=10
```

2. Ground-truth simulation:

```shell
docker run -v $SIMLINT_HOME/files/containerised-runs:/sim -v $SIMLINT_HOME/files/6-simulation:/6-sim \
ghcr.io/epcced/simlint:latest \
sh -c \
"cp /6-sim/BOUT.inp /sim/data/BOUT.inp && cp /sim/BOUT.restart.0.nc /sim/data/BOUT.restart.0.nc \
&& mpirun -np 1 gt-hw"
cp $SIMLINT_HOME/files/6-simulation/BOUT.inp $SIMLINT_HOME/files/containerised-runs/data; \
cp $SIMLINT_HOME/files/containerised-runs/BOUT.restart.0.nc $SIMLINT_HOME/files/containerised-runs/data; \
docker run -v $SIMLINT_HOME/files/containerised-runs:/sim -u $(id -u):$(id -g) ghcr.io/epcced/simlint:latest mpirun -np 1 gt-hw nout=10
```

For these first two commands, the OpenMPI command `mpirun -n 1`, which instructs BOUT++ to use one processor only due to the format of the example input data, can be instructed to use *N* processors `mpirun -n N`, however appropriately decomposed input data must be provided.

3. Inference runs:

```shell
docker run -v $SIMLINT_HOME/files/containerised-runs:/sim -v $SIMLINT_HOME/files/models:/models -v $SIMLINT_HOME/files/6-simulation:/6-sim \
ghcr.io/epcced/simlint:latest \
sh -c \
"cp /6-sim/BOUT.inp /sim/data/BOUT.inp && cp /sim/BOUT.restart.0.nc /sim/data/BOUT.restart.0.nc \
&& python /start_db.py /models/model-hw-20240427-164026-vort.pb /models/model-hw-20240427-210530-dens.pb \
cp $SIMLINT_HOME/files/6-simulation/BOUT.inp $SIMLINT_HOME/files/containerised-runs/data && \
cp $SIMLINT_HOME/files/containerised-runs/BOUT.restart.0.nc $SIMLINT_HOME/files/containerised-runs/data && \
docker run -v $SIMLINT_HOME/files/containerised-runs:/sim -v $SIMLINT_HOME/files/models:/models -u $(id -u):$(id -g) ghcr.io/epcced/simlint:latest sh -c \
"python /start_db.py /models/model-hw-20240427-164026-vort.pb /models/model-hw-20240427-210530-dens.pb \
&& export SSDB=127.0.0.1:6899 \
&& mpirun -np 1 smartsim-hw"
&& mpirun -np 1 smartsim-hw nout=10"
```

That's it! You have successfully built the SiMLInt Docker image and run it with a volume. Feel free to explore and modify the code inside the container as needed.
Expand Down
7 changes: 4 additions & 3 deletions files/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,14 @@ RUN $conda init && . $bashrc && conda activate boutsmartsim \
&& chmod 777 /simlint-bin/smartsim-hw

COPY files/container/entrypoint.sh /entrypoint.sh
COPY files/6-simulation/start_db.py /start_db.py

RUN mkdir /sim && chmod -R 777 /sim
RUN mkdir -p /sim/data && chmod -R 777 /sim
RUN chmod -R 777 /miniconda3

RUN useradd -ms /bin/bash simlint
# RUN useradd -ms /bin/bash simlint

USER simlint
# USER simlint

WORKDIR /sim

Expand Down
2 changes: 1 addition & 1 deletion files/container/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ conda activate "${_CONDA_DEFAULT_ENV}"
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PATH=/simlint-bin:$PATH

$@
echo $@
49 changes: 49 additions & 0 deletions files/containerised-runs/data/BOUT.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Hasegawa-Wakatani training data
#

timestep = 1.0 # Output timestep
nout = 100 # Number of output steps

MYG = 0 # No need for Y communications

periodicX = true # Domain is periodic in X

[mesh]

nx = 260 # Note 4 guard cells in X
ny = 1
nz = 256 # Periodic, so no guard cells in Z

dx = 0.025
dy = 1.0
dz = 0.025

[hw]

alpha = 1.0 # Adiabaticity (~ conductivity)
kappa = 2.0 # Density gradient drive
Dvort = 0.005 # Vorticity diffusion
Dn = 0.005 # Density diffusion

modified = true

bracket = 2 # 0 = std, 1 = simple, 2 = arakawa

[solver]
type = rk4
adaptive = false
timestep = 0.0065

[all]
#scale = 0.0
bndry_all = dirichlet_o2

[n]
#bndry_all = neumann_o2

[vort]
#bndry_all = dirichlet_o2

#scale = 0.1 # Fluctuation amplitude
#function = mixmode(2*pi*x) * mixmode(z) # Fluctuation function
Binary file added files/containerised-runs/data/BOUT.restart.0.nc
Binary file not shown.

0 comments on commit 4550dba

Please sign in to comment.