diff --git a/docs/docker-image.md b/docs/docker-image.md index f9832bc..194d97e 100644 --- a/docs/docker-image.md +++ b/docs/docker-image.md @@ -36,21 +36,17 @@ 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. @@ -58,13 +54,12 @@ To run the SiMLInt Docker image follow these steps: 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. diff --git a/files/container/Dockerfile b/files/container/Dockerfile index 48666c5..578a78a 100644 --- a/files/container/Dockerfile +++ b/files/container/Dockerfile @@ -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 diff --git a/files/container/entrypoint.sh b/files/container/entrypoint.sh index 3c9d190..0531c65 100755 --- a/files/container/entrypoint.sh +++ b/files/container/entrypoint.sh @@ -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 $@ diff --git a/files/containerised-runs/data/BOUT.inp b/files/containerised-runs/data/BOUT.inp new file mode 100644 index 0000000..d32029b --- /dev/null +++ b/files/containerised-runs/data/BOUT.inp @@ -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 diff --git a/files/containerised-runs/data/BOUT.restart.0.nc b/files/containerised-runs/data/BOUT.restart.0.nc new file mode 100644 index 0000000..39a53c6 Binary files /dev/null and b/files/containerised-runs/data/BOUT.restart.0.nc differ