Skip to content

Commit

Permalink
Updated dockerfiles, and test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnaa423 committed Jul 11, 2024
1 parent 9c7b889 commit 3a1b47d
Show file tree
Hide file tree
Showing 15 changed files with 205 additions and 4 deletions.
7 changes: 6 additions & 1 deletion Dockerfile_bare
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ RUN wget -O miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-$
&& chmod u+x ./miniconda.sh \
&& ./miniconda.sh -b -p $HOME/miniconda \
&& rm -rf ./miniconda.sh \
&& echo "$HOME/miniconda/bin/conda init" > ~/.bashrc
&& echo "" > ~/.bashrc \
&& $HOME/miniconda/bin/conda init

# Configure conda-forge and mamba.
RUN source ~/.bashrc \
&& conda config --add channels conda-forge && conda config --set channel_priority strict \
&& conda install -y mamba


# Finally set the working directory to home directory.
WORKDIR /app

CMD ["/bin/bash"]
12 changes: 12 additions & 0 deletions Dockerfile_cuda
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FROM krishnaa42342/mamba:bare
ARG PLATFORM="Linux-x86_64"
# ARG PLATFORM="MacOSX-arm64"
# ARG PLATFORM="Linux-ppc64le"
# Cuda version used is 12.1.

# Shell.
ENV SHELL=/bin/bash
Expand All @@ -16,6 +17,8 @@ RUN mkdir -p /app
WORKDIR /app

# Install packages.
# packages: numpy, cupy, mpich, mpi4py, pandas, scipy, sympy, scikit-learn, h5py, petsc, petsc4py, slepc, slepc4py
# matplotlib, seaborn, qt, pyvista, pyvistaqt, fenics-dolfinx, jupyterlab, ase, gpaw, pytorch, pytorch_geometric, e3nn, pymatgen, mp_api.

RUN source ~/.bashrc \
&& mamba install -y numpy
Expand Down Expand Up @@ -53,9 +56,15 @@ RUN source ~/.bashrc \
RUN source ~/.bashrc \
&& mamba install -y seaborn

RUN source ~/.bashrc \
&& mamba install -y qt

RUN source ~/.bashrc \
&& pip3 install -q pyvista

RUN source ~/.bashrc \
&& pip3 install -q pyvistaqt

RUN source ~/.bashrc \
&& mamba install -y fenics-dolfinx

Expand Down Expand Up @@ -84,4 +93,7 @@ RUN source ~/.bashrc \
RUN source ~/.bashrc \
&& pip3 install -q mp_api

# Finally set the working directory to home directory.
WORKDIR /app

CMD ["/bin/bash"]
11 changes: 11 additions & 0 deletions Dockerfile_mpich
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ RUN mkdir -p /app
WORKDIR /app

# Install packages.
# packages: numpy, mpich, mpi4py, pandas, scipy, sympy, scikit-learn, h5py, petsc, petsc4py, slepc, slepc4py
# matplotlib, seaborn, pyqt, pyvista, pyvistaqt, fenics-dolfinx, jupyterlab, ase, gpaw, pytorch, pytorch_geometric, e3nn, pymatgen, mp_api (pip).

RUN source ~/.bashrc \
&& mamba install -y numpy
Expand Down Expand Up @@ -50,9 +52,15 @@ RUN source ~/.bashrc \
RUN source ~/.bashrc \
&& mamba install -y seaborn

RUN source ~/.bashrc \
&& mamba install -y pyqt

RUN source ~/.bashrc \
&& pip3 install -q pyvista

RUN source ~/.bashrc \
&& pip3 install -q pyvistaqt

RUN source ~/.bashrc \
&& mamba install -y fenics-dolfinx

Expand Down Expand Up @@ -80,4 +88,7 @@ RUN source ~/.bashrc \
RUN source ~/.bashrc \
&& pip3 install -q mp_api

# Finally set the working directory to home directory.
WORKDIR /app

CMD ["/bin/bash"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
- With mamba alone. Run ./build_bare.sh.
- With packages over mpich. Run ./build_mpich.sh.
- With packages over mpich and cuda. Run ./build_cuda.sh.


Can also run and stop the images as containers using *run_<>.sh* and *down_<>.sh* scripts.
9 changes: 8 additions & 1 deletion build_bare.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash

docker buildx build --file=Dockerfile_bare --tag=krishnaa42342/mamba:bare --no-cache ./
docker compose build mamba-bare-linux-amd64
# docker compose push mamba-bare-linux-amd64

# docker compose build mamba-bare-linux-arm64
# docker compose push mamba-bare-linux-amd64

# docker compose build mamba-bare-linux-ppc64le
# docker compose push mamba-bare-linux-amd64
3 changes: 2 additions & 1 deletion build_cuda.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash

docker buildx build --file=Dockerfile_cuda --tag=krishnaa42342/mamba:cuda --no-cache ./
docker compose build mamba-cuda-linux-amd64
# docker compose push mamba-cuda-linux-amd64
3 changes: 2 additions & 1 deletion build_mpich.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash

docker buildx build --file=Dockerfile_mpich --tag=krishnaa42342/mamba:mpich --no-cache ./
docker compose build mamba-mpich-linux-amd64
# docker compose push mamba-mpich-linux-amd64
52 changes: 52 additions & 0 deletions dc_run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
services:
mamba-bare-linux-amd64:
image: krishnaa42342/mamba:bare
container_name: mamba-bare
network_mode: "host"
volumes:
- "./:/scratch"
deploy:
resources:
reservations:
devices:
- capabilities: ["gpu"]
count: all
driver: nvidia
environment:
DISPLAY: $DISPLAY
stdin_open: true
tty: true
mamba-mpich-linux-amd64:
image: krishnaa42342/mamba:mpich
container_name: mamba-mpich
network_mode: "host"
volumes:
- "./:/scratch"
deploy:
resources:
reservations:
devices:
- capabilities: ["gpu"]
count: all
driver: nvidia
environment:
DISPLAY: $DISPLAY
stdin_open: true
tty: true
mamba-cuda-linux-amd64:
image: krishnaa42342/mamba:cuda
container_name: mamba-cuda
network_mode: "host"
volumes:
- "./:/scratch"
deploy:
resources:
reservations:
devices:
- capabilities: ["gpu"]
count: all
driver: nvidia
environment:
DISPLAY: $DISPLAY
stdin_open: true
tty: true
85 changes: 85 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
services:
mamba-bare-linux-amd64:
image: krishnaa42342/mamba:bare
build:
context: ./
dockerfile: ./Dockerfile_bare
args:
PLATFORM: Linux-x86_64
platforms:
- linux/amd64
# no_cache: true
mamba-bare-linux-arm64:
image: krishnaa42342/mamba:bare
build:
context: ./
dockerfile: ./Dockerfile_bare
args:
PLATFORM: Linux-aarch64
platforms:
- linux/arm64
mamba-bare-linux-ppc64le:
image: krishnaa42342/mamba:bare
build:
context: ./
dockerfile: ./Dockerfile_bare
args:
PLATFORM: Linux-ppc64le
platforms:
- linux/ppc64le
mamba-mpich-linux-amd64:
image: krishnaa42342/mamba:mpich
build:
context: ./
dockerfile: ./Dockerfile_mpich
args:
PLATFORM: Linux-x86_64
platforms:
- linux/amd64
mamba-mpich-linux-arm64:
image: krishnaa42342/mamba:mpich
build:
context: ./
dockerfile: ./Dockerfile_mpich
args:
PLATFORM: Linux-aarch64
platforms:
- linux/arm64
mamba-mpich-linux-ppc64le:
image: krishnaa42342/mamba:mpich
build:
context: ./
dockerfile: ./Dockerfile_mpich
args:
PLATFORM: Linux-ppc64le
platforms:
- linux/ppc64le
mamba-cuda-linux-amd64:
image: krishnaa42342/mamba:cuda
build:
context: ./
dockerfile: ./Dockerfile_cuda
args:
PLATFORM: Linux-x86_64
platforms:
- linux/amd64
mamba-cuda-linux-arm64:
image: krishnaa42342/mamba:cuda
build:
context: ./
dockerfile: ./Dockerfile_cuda
args:
PLATFORM: Linux-aarch64
platforms:
- linux/arm64
mamba-cuda-linux-ppc64le:
image: krishnaa42342/mamba:cuda
build:
context: ./
dockerfile: ./Dockerfile_cuda
args:
PLATFORM: Linux-ppc64le
platforms:
- linux/ppc64le


3 changes: 3 additions & 0 deletions down_bare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker compose -f dc_run.yml down mamba-bare-linux-amd64
3 changes: 3 additions & 0 deletions down_cuda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker compose -f dc_run.yml down mamba-cuda-linux-amd64
3 changes: 3 additions & 0 deletions down_mpich.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker compose -f dc_run.yml down mamba-mpich-linux-amd64
5 changes: 5 additions & 0 deletions run_bare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

docker compose -f dc_run.yml up -d mamba-bare-linux-amd64

docker container exec -it mamba-bare /bin/bash
5 changes: 5 additions & 0 deletions run_cuda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

docker compose -f dc_run.yml up -d mamba-cuda-linux-amd64

docker container exec -it mamba-cuda /bin/bash
5 changes: 5 additions & 0 deletions run_mpich.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

docker compose -f dc_run.yml up -d mamba-mpich-linux-amd64

docker container exec -it mamba-mpich /bin/bash

0 comments on commit 3a1b47d

Please sign in to comment.