From 3a1b47ddf9f72c8b4804e1741f6e794192445326 Mon Sep 17 00:00:00 2001 From: krishnaa423 Date: Thu, 11 Jul 2024 19:58:25 -0400 Subject: [PATCH] Updated dockerfiles, and test scripts --- Dockerfile_bare | 7 +++- Dockerfile_cuda | 12 +++++++ Dockerfile_mpich | 11 ++++++ README.md | 3 ++ build_bare.sh | 9 ++++- build_cuda.sh | 3 +- build_mpich.sh | 3 +- dc_run.yml | 52 ++++++++++++++++++++++++++++ docker-compose.yml | 85 ++++++++++++++++++++++++++++++++++++++++++++++ down_bare.sh | 3 ++ down_cuda.sh | 3 ++ down_mpich.sh | 3 ++ run_bare.sh | 5 +++ run_cuda.sh | 5 +++ run_mpich.sh | 5 +++ 15 files changed, 205 insertions(+), 4 deletions(-) create mode 100644 dc_run.yml create mode 100644 docker-compose.yml create mode 100644 down_bare.sh create mode 100644 down_cuda.sh create mode 100644 down_mpich.sh create mode 100644 run_bare.sh create mode 100644 run_cuda.sh create mode 100644 run_mpich.sh diff --git a/Dockerfile_bare b/Dockerfile_bare index 63956a1..191dacf 100644 --- a/Dockerfile_bare +++ b/Dockerfile_bare @@ -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"] \ No newline at end of file diff --git a/Dockerfile_cuda b/Dockerfile_cuda index bbd6535..ba3d076 100644 --- a/Dockerfile_cuda +++ b/Dockerfile_cuda @@ -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 @@ -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 @@ -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 @@ -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"] \ No newline at end of file diff --git a/Dockerfile_mpich b/Dockerfile_mpich index d7431ee..4e56631 100644 --- a/Dockerfile_mpich +++ b/Dockerfile_mpich @@ -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 @@ -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 @@ -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"] \ No newline at end of file diff --git a/README.md b/README.md index 6c36aec..b5075d4 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file diff --git a/build_bare.sh b/build_bare.sh index 8de75e1..94046fb 100644 --- a/build_bare.sh +++ b/build_bare.sh @@ -1,3 +1,10 @@ #!/bin/bash -docker buildx build --file=Dockerfile_bare --tag=krishnaa42342/mamba:bare --no-cache ./ \ No newline at end of file +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 \ No newline at end of file diff --git a/build_cuda.sh b/build_cuda.sh index 9debf4f..b343c19 100644 --- a/build_cuda.sh +++ b/build_cuda.sh @@ -1,3 +1,4 @@ #!/bin/bash -docker buildx build --file=Dockerfile_cuda --tag=krishnaa42342/mamba:cuda --no-cache ./ \ No newline at end of file +docker compose build mamba-cuda-linux-amd64 +# docker compose push mamba-cuda-linux-amd64 \ No newline at end of file diff --git a/build_mpich.sh b/build_mpich.sh index 5190a06..1ecff98 100644 --- a/build_mpich.sh +++ b/build_mpich.sh @@ -1,3 +1,4 @@ #!/bin/bash -docker buildx build --file=Dockerfile_mpich --tag=krishnaa42342/mamba:mpich --no-cache ./ \ No newline at end of file +docker compose build mamba-mpich-linux-amd64 +# docker compose push mamba-mpich-linux-amd64 \ No newline at end of file diff --git a/dc_run.yml b/dc_run.yml new file mode 100644 index 0000000..31a9e7d --- /dev/null +++ b/dc_run.yml @@ -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 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8b75615 --- /dev/null +++ b/docker-compose.yml @@ -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 + + \ No newline at end of file diff --git a/down_bare.sh b/down_bare.sh new file mode 100644 index 0000000..d44a629 --- /dev/null +++ b/down_bare.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker compose -f dc_run.yml down mamba-bare-linux-amd64 \ No newline at end of file diff --git a/down_cuda.sh b/down_cuda.sh new file mode 100644 index 0000000..45be488 --- /dev/null +++ b/down_cuda.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker compose -f dc_run.yml down mamba-cuda-linux-amd64 \ No newline at end of file diff --git a/down_mpich.sh b/down_mpich.sh new file mode 100644 index 0000000..c23bec4 --- /dev/null +++ b/down_mpich.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker compose -f dc_run.yml down mamba-mpich-linux-amd64 \ No newline at end of file diff --git a/run_bare.sh b/run_bare.sh new file mode 100644 index 0000000..3eab9b3 --- /dev/null +++ b/run_bare.sh @@ -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 \ No newline at end of file diff --git a/run_cuda.sh b/run_cuda.sh new file mode 100644 index 0000000..a737ed8 --- /dev/null +++ b/run_cuda.sh @@ -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 \ No newline at end of file diff --git a/run_mpich.sh b/run_mpich.sh new file mode 100644 index 0000000..c8ee861 --- /dev/null +++ b/run_mpich.sh @@ -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 \ No newline at end of file