Skip to content

Commit 5507bc7

Browse files
committed
python-conda 3.8 (CUDA11.0)
1 parent 4c9f0b7 commit 5507bc7

File tree

3 files changed

+224
-0
lines changed

3 files changed

+224
-0
lines changed

python-conda/Dockerfile

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
FROM centos:8
2+
LABEL maintainer "Mario Cho <[email protected]>"
3+
4+
ENV DEBIAN_FRONTEND=noninteractive \
5+
MPLBACKEND=Svg \
6+
PYTHONUNBUFFERED=1 \
7+
LIBRARY_PATH=/usr/local/cuda/lib64/stubs \
8+
_CUDA_COMPAT_PATH="/usr/local/cuda/compat" \
9+
LD_LIBRARY_PATH="/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/compat/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/include/x86_64-linux-gnu"\
10+
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/opt/conda/bin:/usr/local/sbin:/usr/bin/cmake/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/tensorrt/bin" \
11+
LANG=C.UTF-8
12+
13+
ENV CUDA_VER 11.0
14+
ENV CUDA_VERSION 11.0.3
15+
ENV CUDA_PKG_VERSION 11-0=$CUDA_VERSION-1
16+
ENV NCCL_VERSION 2.9.6
17+
ENV CUDNN_VERSION 8.0.5.39
18+
ENV TH_VERSION 1.7.1
19+
LABEL com.nvidia.cudnn.version="${CUDNN_VERSION}"
20+
21+
# nvidia-container-runtime
22+
ENV NVIDIA_VISIBLE_DEVICES all
23+
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
24+
ENV NVIDIA_REQUIRE_CUDA "cuda>=11.0 brand=tesla,driver>=418,driver<419 brand=tesla,driver>=440,driver<441 driver>=450"
25+
ENV CUDA_HOME /usr/local/cuda
26+
27+
RUN yum update -y && \
28+
yum install -y \
29+
fonts-nanum \
30+
fonts-nanum-coding \
31+
fonts-nanum-extra \
32+
libasound-dev \
33+
libcairo2-dev \
34+
libgif-dev \
35+
libjpeg-dev \
36+
liblapack-dev \
37+
libnuma-dev \
38+
libopenblas-dev \
39+
libpmi2-0-dev \
40+
nano \
41+
numactl \
42+
vim \
43+
openssh-client openssh-server \
44+
apt-utils \
45+
autoconf \
46+
automake \
47+
bc \
48+
build-essential \
49+
ca-certificates \
50+
cmake \
51+
curl \
52+
debhelper dh-virtualenv \
53+
ffmpeg \
54+
flac \
55+
gawk \
56+
gfortran \
57+
git \
58+
libatlas-base-dev \
59+
libatlas3-base libtool \
60+
libsndfile1-dev \
61+
libssl-dev \
62+
libtool \
63+
python2.7 \
64+
python3 \
65+
sox \
66+
subversion \
67+
unzip \
68+
wget \
69+
zip \
70+
zlib1g-dev
71+
72+
RUN NVIDIA_GPGKEY_SUM=d1be581509378368edeec8c1eb2958702feedf3bc3d17011adbf24efacce4ab5 && \
73+
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/7fa2af80.pub | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \
74+
echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict -
75+
76+
COPY cuda.repo /etc/yum.repos.d/cuda.repo
77+
COPY nvidia-ml.repo /etc/yum.repos.d/nvidia-ml.repo
78+
COPY NGC-DL-CONTAINER-LICENSE /
79+
80+
RUN yum upgrade -y && yum install -y \
81+
cuda-cudart-11-0-11.0.221-1 \
82+
cuda-compat-11-0 \
83+
&& \
84+
ln -s cuda-11.0 /usr/local/cuda && \
85+
echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
86+
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
87+
88+
RUN yum install -y \
89+
cuda-libraries-11-0-11.0.3-1 \
90+
cuda-nvtx-11-0-11.0.167-1 \
91+
libnpp-11-0-11.1.0.245-1 \
92+
libcublas-11-0-11.2.0.252-1 \
93+
libnccl-2.9.6-1+cuda11.0 \
94+
libnccl2=$NCCL_VERSION-1+cuda11.0
95+
96+
RUN yum install -y \
97+
make \
98+
cuda-command-line-tools-11-0-11.0.3-1 \
99+
cuda-libraries-devel-11-0-11.0.3-1 \
100+
cuda-minimal-build-11-0-11.0.3-1 \
101+
cuda-cudart-devel-11-0-11.0.221-1 \
102+
cuda-nvprof-11-0-11.0.221-1 \
103+
cuda-nvml-devel-11-0-11.0.167-1 \
104+
libcublas-devel-11-0-11.2.0.252-1 \
105+
libnpp-devel-11-0-11.1.0.245-1 \
106+
libnccl-devel-2.9.6-1+cuda11.0 \
107+
libcusparse-dev-11-0=11.1.1.245-1 \
108+
libcudnn8=$CUDNN_VERSION-1+cuda11.0 \
109+
libcudnn8-dev=$CUDNN_VERSION-1+cuda11.0
110+
111+
# Install miniconda 3.7
112+
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py38_4.9.2-Linux-x86_64.sh -O miniconda.sh && \
113+
mkdir -p /opt && \
114+
sh miniconda.sh -b -p /opt/conda && \
115+
rm miniconda.sh && \
116+
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
117+
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
118+
echo "conda activate base" >> ~/.bashrc && \
119+
find /opt/conda/ -follow -type f -name '*.a' -delete && \
120+
find /opt/conda/ -follow -type f -name '*.js.map' -delete && \
121+
/opt/conda/bin/conda clean -afy
122+
123+
# Install OpenBlas
124+
WORKDIR /tmp
125+
RUN git clone -q --branch=master git://github.com/xianyi/OpenBLAS.git && \
126+
cd OpenBLAS && \
127+
make DYNAMIC_ARCH=1 NO_AFFINITY=1 NUM_THREADS=48 FC=gfortran && \
128+
make install
129+
130+
# Install Open UCX
131+
WORKDIR /tmp
132+
RUN wget https://github.com/openucx/ucx/archive/v1.9.0.tar.gz && \
133+
tar xvf v1.9.0.tar.gz && \
134+
cd ucx-1.9.0 && \
135+
bash ./autogen.sh && \
136+
mkdir build && \
137+
cd build && \
138+
../configure --prefix=/usr/local/ucx && \
139+
make -j$(nproc) && \
140+
make install
141+
142+
# Install Open MPI
143+
RUN mkdir /tmp/openmpi && \
144+
cd /tmp/openmpi && \
145+
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.gz && \
146+
tar zxf openmpi-4.1.0.tar.gz && \
147+
cd openmpi-4.1.0 && \
148+
./configure --enable-orterun-prefix-by-default --with-cuda --with-ucx=/usr/local/ucx --enable-mca-no-build=btl-uct && \
149+
make -j $(nproc) all && \
150+
make install && \
151+
ldconfig && \
152+
rm -rf /tmp/openmpi*
153+
154+
# Allow OpenSSH to talk to containers without asking for confirmation
155+
RUN mkdir -p /var/run/sshd && \
156+
cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
157+
echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \
158+
mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config
159+
160+
# Create a wrapper for OpenMPI to allow running as root by default
161+
RUN mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real && \
162+
echo '#!/bin/bash' > /usr/local/bin/mpirun && \
163+
echo 'mpirun.real --allow-run-as-root "$@"' >> /usr/local/bin/mpirun && \
164+
chmod a+x /usr/local/bin/mpirun
165+
166+
# Configure OpenMPI to run good defaults:
167+
RUN echo "btl_tcp_if_exclude = lo,docker0" >> /usr/local/etc/openmpi-mca-params.conf
168+
169+
# Install git-lfs
170+
WORKDIR /tmp
171+
RUN curl -sLO https://github.com/git-lfs/git-lfs/releases/download/v2.13.1/git-lfs-linux-amd64-v2.13.1.tar.gz && \
172+
tar -zxf git-lfs-linux-amd64-v2.13.1.tar.gz && \
173+
bash install.sh && \
174+
rm -rf /tmp/*
175+
176+
# Install VSCode
177+
RUN curl -fL https://github.com/cdr/code-server/releases/download/v3.8.0/code-server-3.8.0-linux-amd64.tar.gz \
178+
| tar -C /usr/local/lib -xz && \
179+
mv /usr/local/lib/code-server-3.8.0-linux-amd64 /usr/local/lib/code-server-3.8.0 && \
180+
ln -s /usr/local/lib/code-server-3.8.0/bin/code-server /usr/local/bin/code-server
181+
182+
RUN /opt/conda/bin/python3 -m pip install --no-cache-dir \
183+
git+https://github.com/lanpa/tensorboardX \
184+
tornado==6.0.4 \
185+
pystan==2.19.1.1 \
186+
pycairo==1.19.0 \
187+
jupyter==1.0.0 \
188+
python-language-server[all]
189+
190+
# Copy Backend.Ai multi-node support
191+
COPY ./runner-scripts/bootstrap.sh /opt/container/
192+
COPY ./service-defs /etc/backend.ai/service-defs
193+
194+
# Install ipython kernelspec
195+
Run /opt/conda/bin/python3 -m ipykernel install --display-name "Conda 3.8 on Python 3.8 & CUDA 11.0)" && \
196+
cat /usr/local/share/jupyter/kernels/python3/kernel.json
197+
198+
# Backend.AI specifics
199+
LABEL ai.backend.kernelspec="1" \
200+
ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \
201+
ai.backend.features="batch query uid-match user-input" \
202+
ai.backend.base-distro="ubuntu16.04" \
203+
ai.backend.resource.min.cpu="1" \
204+
ai.backend.resource.min.mem="1g" \
205+
ai.backend.resource.min.cuda.device=0 \
206+
ai.backend.resource.min.cuda.shares=0 \
207+
ai.backend.runtime-type="python" \
208+
ai.backend.runtime-path="/opt/conda/bin/python3" \
209+
ai.backend.service-ports="ipython:pty:3000,jupyter:http:8081,jupyterlab:http:8090,vscode:http:8180,tensorboard:http:6006"
210+
211+
WORKDIR /home/work
212+
# vim: ft=dockerfile

python-conda/cuda.repo

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[cuda]
2+
name=cuda
3+
baseurl=https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64
4+
enabled=1
5+
gpgcheck=1
6+
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA

python-conda/nvidia-ml.repo

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[nvidia-ml]
2+
name=nvidia-ml
3+
baseurl=https://developer.download.nvidia.com/compute/machine-learning/repos/rhel8/x86_64
4+
enabled=1
5+
gpgcheck=1
6+
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA

0 commit comments

Comments
 (0)