From 476678040466d9eb9ef8ec877b0757f4286051ba Mon Sep 17 00:00:00 2001 From: mm644706215 Date: Sat, 18 Jan 2025 17:49:21 +0800 Subject: [PATCH] update add test dockerfile --- Dockerfile.gromacs_amber_stage | 2 +- Dockerfile.gromacs_amber_staget | 363 ++++++++++++++++++++++++++++++++ docker-compose_amber_staget.yml | 47 +++++ 3 files changed, 411 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.gromacs_amber_staget create mode 100755 docker-compose_amber_staget.yml diff --git a/Dockerfile.gromacs_amber_stage b/Dockerfile.gromacs_amber_stage index 7000e3e..be7a3e2 100644 --- a/Dockerfile.gromacs_amber_stage +++ b/Dockerfile.gromacs_amber_stage @@ -298,7 +298,7 @@ FROM nvidia/cuda:${TAG_VERSION} ENV CUDA_HOME=/usr/local/cuda ENV PATH=$CUDA_HOME/bin:$PATH -ENV LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH +ENV LD_LIBRARY_PATH=$CUDA_HOME/lib64:/usr/local/plumed/lib:$LD_LIBRARY_PATH ENV CPATH=$CUDA_HOME/include:$CPATH ENV LIBRARY_PATH=$CUDA_HOME/lib64:$LIBRARY_PATH ARG SSH_PORT=2222 diff --git a/Dockerfile.gromacs_amber_staget b/Dockerfile.gromacs_amber_staget new file mode 100644 index 0000000..07dbc05 --- /dev/null +++ b/Dockerfile.gromacs_amber_staget @@ -0,0 +1,363 @@ +# syntax=docker/dockerfile:1.3-labs +# NOTE: Building this image requires Docker version >= 23.0. + +# Stage 1: Build environment +ARG TAG_VERSION="12.4.1-cudnn-devel-ubuntu22.04" +FROM nvidia/cuda:${TAG_VERSION} AS build-env + +ENV CUDA_HOME=/usr/local/cuda +ENV PATH=$CUDA_HOME/bin:$PATH +ENV LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH +ENV CPATH=$CUDA_HOME/include:$CPATH +ENV LIBRARY_PATH=$CUDA_HOME/lib64:$LIBRARY_PATH +ARG HTTP_PROXY +ARG HTTPS_PROXY +ENV http_proxy=${HTTP_PROXY} +ENV https_proxy=${HTTPS_PROXY} +ARG DEBIAN_FRONTEND="noninteractive" +ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND} +ARG ROOT_PASSWD="root" +ENV ROOT_PASSWD=${ROOT_PASSWD} +ENV SSH_PORT=2222 +WORKDIR /root +SHELL ["/bin/bash", "-c"] + +# Replace sources.list with Aliyun mirror +RUN < /etc/apt/sources.list +deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse +deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse +deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse +deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse +deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse +deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse +deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse +deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse +EOF +EOT + +# Install base tools for compilation +RUN <> /etc/profile +echo "source /opt/modules/init/profile.sh" >> ~/.bashrc +EOT + +# Install FFTW +ARG FFTW_VERSION="3.3.10" +ENV FFTW_VERSION=${FFTW_VERSION} +ENV PATH=/usr/local/fftw:$PATH +RUN <> /root/.bashrc +EOT + +# Install AmberTools and Amber +COPY file/Amber24.tar.bz2 file/AmberTools24.tar.bz2 /root +RUN <> project-config.jam +./b2 -j$(nproc) --layout=tagged link=static,shared threading=multi install +mkdir -p /opt/modulefiles/boost +cat << EOF > /opt/modulefiles/boost/1.86.0-openmpi-5.1.0a1 +#%Module1.0 +set prefix /opt/boost +prepend-path LD_LIBRARY_PATH \$prefix/lib +prepend-path CPATH \$prefix/include +prepend-path LIBRARY_PATH \$prefix/lib +prepend-path PATH \$prefix/bin +EOF +EOT + +# Install Intel HPCKit and oneMKL +COPY file/l_HPCKit_p_2024.2.1.79_offline.sh file/l_onemkl_p_2024.2.2.17_offline.sh /root +RUN <> ~/.bashrc +echo "source /opt/intel/onemkl/setvars.sh" >> ~/.bashrc +EOT + +# SSH setup +RUN < ~/.ssh/config +cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak +sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config +sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config +sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config +sed -i 's/^\(\s*\)GSSAPIAuthentication yes/\1GSSAPIAuthentication no/' /etc/ssh/ssh_config +sed -i "s/^#Port 22/Port ${SSH_PORT}/" /etc/ssh/sshd_config +ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa -N "" <<< y +cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys +chmod 600 /root/.ssh/authorized_keys +mkdir /var/run/sshd +echo "root:${ROOT_PASSWD}" | chpasswd +EOT + +# Timezone setup +RUN < /etc/timezone +EOT + +# Install micromamba silently +WORKDIR /root +ENV BIN_FOLDER=/usr/local/bin +ENV INIT_YES=yes +ENV CONDA_FORGE_YES=yes +ENV PREFIX_LOCATION=/opt/micromamba +RUN <> /root/.bashrc +# # Initialize micromamba for bash +# eval "$(micromamba shell hook --shell )" +# /usr/local/bin/micromamba shell init --shell=bash --root-prefix=/opt/micromamba +# # Activate micromamba +# source /root/.bashrc +# micromamba self-update +# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ +# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ +# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ +# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/ +# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r +# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 +# micromamba config append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free +# micromamba config append channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/ +# micromamba config append channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/ +# # Activate the PyAutoFEP environment +# micromamba activate PyAutoFEP +# mkdir -p ~/.pip +# cat << EOF > ~/.pip/pip.conf +# [global] +# index-url = https://mirrors.aliyun.com/pypi/simple/ + +# [install] +# trusted-host=mirrors.aliyun.com +# EOF +# EOT + +# SSH setup +EXPOSE ${SSH_PORT} +CMD ["/usr/sbin/sshd", "-D"] \ No newline at end of file diff --git a/docker-compose_amber_staget.yml b/docker-compose_amber_staget.yml new file mode 100755 index 0000000..1ac6301 --- /dev/null +++ b/docker-compose_amber_staget.yml @@ -0,0 +1,47 @@ +version: '3.8' + +services: + gromacs: + build: + context: . + dockerfile: Dockerfile.gromacs_amber_staget + args: + CACHEBUST: 1 + TAG_VERSION: "12.4.1-cudnn-devel-ubuntu22.04" + PLUMED_VERSION: "2.9.2" + FFTW_VERSION: "3.3.10" + GROMACS_VERSION: "2021.7" + BUILDKIT_INLINE_CACHE: 1 + # env_file: + # - .env + volumes: + - ./data:/data + container_name: gromacs_amber_staget + pull_policy: if_not_present + ulimits: + memlock: + soft: -1 + hard: -1 + restart: unless-stopped + image: hotwa/gromacs:ambert + privileged: true + cap_add: + - ALL + - CAP_SYS_PTRACE + shm_size: '16gb' + environment: + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=compute,utility + - TMPDIR=/var/tmp + ports: + - "53322:2222" + # network_mode: host + # command: ["/usr/sbin/sshd", "-D"] + command: ["tail", "-f", "/dev/null"] + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: all + capabilities: [gpu]