Skip to content

Commit 22653e9

Browse files
committed
fixed conflicted pacakges
2 parents f667f53 + 92615c0 commit 22653e9

File tree

8 files changed

+939
-9
lines changed

8 files changed

+939
-9
lines changed

python-conda/Dockerfile

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
FROM centos:7
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 10.1
14+
ENV CUDA_VERSION 10.1.243
15+
ENV CUDA_PKG_VERSION 10-1-$CUDA_VERSION-1
16+
ENV NCCL_VERSION 2.8.4
17+
ENV CUDNN_VERSION 7.6.5.32
18+
LABEL com.nvidia.cudnn.version="${CUDNN_VERSION}"
19+
20+
# nvidia-container-runtime
21+
ENV NVIDIA_VISIBLE_DEVICES all
22+
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
23+
ENV NVIDIA_REQUIRE_CUDA "cuda>=10.1 brand=tesla,driver>=396,driver<397 brand=tesla,driver>=410,driver<411 brand=tesla,driver>=418,driver<419"
24+
ENV CUDA_HOME /usr/local/cuda
25+
26+
RUN yum update -y && \
27+
yum install -y epel-release && \
28+
# yum install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm && \
29+
yum install -y \
30+
atlas-devel \
31+
numactl-devel \
32+
alsa-lib \
33+
cairo \
34+
cairo-devel \
35+
gcc-c++ \
36+
giflib-devel \
37+
lapack-devel \
38+
libjpeg-turbo-devel \
39+
libtool \
40+
make \
41+
nano \
42+
numactl \
43+
numactl-libs \
44+
openblas-devel \
45+
openssh-server \
46+
pmix-devel \
47+
vim \
48+
openssh-clients \
49+
autoconf \
50+
automake \
51+
bc \
52+
ca-certificates \
53+
cmake \
54+
curl \
55+
ffmpeg \
56+
flac \
57+
gawk \
58+
gcc-gfortran \
59+
git \
60+
libsndfile-devel \
61+
openssl-devel \
62+
python3 \
63+
sox \
64+
subversion \
65+
unzip \
66+
wget \
67+
zip \
68+
zlib && \
69+
curl -sL https://rpm.nodesource.com/setup_14.x | bash - && \
70+
yum install -y nodejs
71+
72+
RUN NVIDIA_GPGKEY_SUM=d1be581509378368edeec8c1eb2958702feedf3bc3d17011adbf24efacce4ab5 && \
73+
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/rhel7/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-$CUDA_PKG_VERSION \
82+
cuda-compat-10-1 && \
83+
ln -s cuda-10.1 /usr/local/cuda && \
84+
echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
85+
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
86+
87+
88+
# setopt flag prevents yum from auto upgrading. See https://gitlab.com/nvidia/container-images/cuda/-/issues/88
89+
RUN yum install --setopt=obsoletes=0 -y \
90+
cuda-libraries-$CUDA_PKG_VERSION \
91+
cuda-nvtx-$CUDA_PKG_VERSION \
92+
cuda-npp-$CUDA_PKG_VERSION \
93+
libcublas10-10.2.1.243-1 \
94+
&& yum clean all \
95+
&& rm -rf /var/cache/yum/*
96+
97+
RUN yum install -y yum-plugin-versionlock && yum versionlock libcublas10
98+
99+
# setopt flag prevents yum from auto upgrading. See https://gitlab.com/nvidia/container-images/cuda/-/issues/88
100+
RUN yum install --setopt=obsoletes=0 -y \
101+
make \
102+
cuda-nvml-dev-$CUDA_PKG_VERSION \
103+
cuda-command-line-tools-$CUDA_PKG_VERSION \
104+
libcublas-devel-10.2.1.243-1 \
105+
cuda-cudart-dev-$CUDA_PKG_VERSION \
106+
cuda-libraries-dev-$CUDA_PKG_VERSION \
107+
cuda-minimal-build-$CUDA_PKG_VERSION \
108+
cuda-nvprof-$CUDA_PKG_VERSION \
109+
cuda-npp-dev-$CUDA_PKG_VERSION \
110+
&& yum clean all \
111+
&& rm -rf /var/cache/yum/*
112+
113+
RUN yum install -y yum-plugin-versionlock && yum versionlock libcublas10
114+
115+
RUN yum install -y xz && NCCL_DOWNLOAD_SUM=bcff1cf98e4b24d7ca189577a9d909980d8df88075223d70dc4638e428c53f84 && \
116+
curl -fsSL https://developer.download.nvidia.com/compute/redist/nccl/v2.8/nccl_2.8.4-1+cuda10.1_x86_64.txz -O && \
117+
echo "$NCCL_DOWNLOAD_SUM nccl_2.8.4-1+cuda10.1_x86_64.txz" | sha256sum -c - && \
118+
unxz nccl_2.8.4-1+cuda10.1_x86_64.txz && \
119+
tar --no-same-owner --keep-old-files -xvf nccl_2.8.4-1+cuda10.1_x86_64.tar -C /usr/local/cuda/include/ --strip-components=2 --wildcards '*/include/*' && \
120+
tar --no-same-owner --keep-old-files -xvf nccl_2.8.4-1+cuda10.1_x86_64.tar -C /usr/local/cuda/lib64/ --strip-components=2 --wildcards '*/lib/libnccl.so' && \
121+
rm -f nccl_2.8.4-1+cuda10.1_x86_64.tar && \
122+
ldconfig
123+
124+
125+
# cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
126+
RUN CUDNN_DOWNLOAD_SUM=7eaec8039a2c30ab0bc758d303588767693def6bf49b22485a2c00bf2e136cb3 && \
127+
curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v7.6.5/cudnn-10.1-linux-x64-v7.6.5.32.tgz -O && \
128+
echo "$CUDNN_DOWNLOAD_SUM cudnn-10.1-linux-x64-v7.6.5.32.tgz" | sha256sum -c - && \
129+
gunzip cudnn-10.1-linux-x64-v7.6.5.32.tgz && \
130+
tar --no-same-owner -xf cudnn-10.1-linux-x64-v7.6.5.32.tar -C /usr/local --wildcards 'cuda/lib64/libcudnn.so.*' && \
131+
rm cudnn-10.1-linux-x64-v7.6.5.32.tar && \
132+
ldconfig
133+
134+
135+
# Install miniconda 3.8
136+
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py38_4.9.2-Linux-x86_64.sh -O miniconda.sh && \
137+
mkdir -p /opt && \
138+
sh miniconda.sh -b -p /opt/conda && \
139+
rm miniconda.sh && \
140+
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
141+
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
142+
echo "conda activate base" >> ~/.bashrc && \
143+
find /opt/conda/ -follow -type f -name '*.a' -delete && \
144+
find /opt/conda/ -follow -type f -name '*.js.map' -delete && \
145+
/opt/conda/bin/conda clean -afy
146+
147+
# Install OpenBlas
148+
WORKDIR /tmp
149+
RUN git clone -q --branch=master git://github.com/xianyi/OpenBLAS.git && \
150+
cd OpenBLAS && \
151+
make DYNAMIC_ARCH=1 NO_AFFINITY=1 NUM_THREADS=48 FC=gfortran && \
152+
make install
153+
154+
# Install Open UCX
155+
WORKDIR /tmp
156+
RUN wget https://github.com/openucx/ucx/archive/v1.9.0.tar.gz && \
157+
tar xvf v1.9.0.tar.gz && \
158+
cd ucx-1.9.0 && \
159+
bash ./autogen.sh && \
160+
mkdir build && \
161+
cd build && \
162+
../configure --prefix=/usr/local/ucx && \
163+
make -j$(nproc) && \
164+
make install
165+
166+
# Install Open MPI
167+
RUN mkdir /tmp/openmpi && \
168+
cd /tmp/openmpi && \
169+
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.gz && \
170+
tar zxf openmpi-4.1.0.tar.gz && \
171+
cd openmpi-4.1.0 && \
172+
./configure --enable-orterun-prefix-by-default --with-cuda --with-ucx=/usr/local/ucx --enable-mca-no-build=btl-uct && \
173+
make -j $(nproc) all && \
174+
make install && \
175+
ldconfig && \
176+
rm -rf /tmp/openmpi*
177+
178+
# Allow OpenSSH to talk to containers without asking for confirmation
179+
RUN mkdir -p /var/run/sshd && \
180+
cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
181+
echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \
182+
mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config
183+
184+
# Create a wrapper for OpenMPI to allow running as root by default
185+
RUN mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real && \
186+
echo '#!/bin/bash' > /usr/local/bin/mpirun && \
187+
echo 'mpirun.real --allow-run-as-root "$@"' >> /usr/local/bin/mpirun && \
188+
chmod a+x /usr/local/bin/mpirun
189+
190+
# Configure OpenMPI to run good defaults:
191+
RUN echo "btl_tcp_if_exclude = lo,docker0" >> /usr/local/etc/openmpi-mca-params.conf
192+
193+
# Install git-lfs
194+
WORKDIR /tmp
195+
RUN curl -sLO https://github.com/git-lfs/git-lfs/releases/download/v2.13.1/git-lfs-linux-amd64-v2.13.1.tar.gz && \
196+
tar -zxf git-lfs-linux-amd64-v2.13.1.tar.gz && \
197+
bash install.sh && \
198+
rm -rf /tmp/*
199+
200+
# Install VSCode
201+
RUN curl -fL https://github.com/cdr/code-server/releases/download/v3.8.0/code-server-3.8.0-linux-amd64.tar.gz \
202+
| tar -C /usr/local/lib -xz && \
203+
mv /usr/local/lib/code-server-3.8.0-linux-amd64 /usr/local/lib/code-server-3.8.0 && \
204+
ln -s /usr/local/lib/code-server-3.8.0/bin/code-server /usr/local/bin/code-server
205+
206+
RUN /opt/conda/bin/conda install \
207+
pytorch \
208+
torchvision \
209+
torchaudio \
210+
cudatoolkit=10.1 \
211+
-c pytorch \
212+
-c conda-forge
213+
RUN /opt/conda/bin/python3 -m pip install --no-cache-dir \
214+
Cython==0.29.22 \
215+
tornado==6.1 \
216+
pystan==3.0.1 \
217+
pycairo==1.20.0 \
218+
numpy==1.19.2 \
219+
tensorflow==2.3.2 \
220+
tensorboard==2.3.0 \
221+
scipy==1.5.3 \
222+
scikit-learn==0.24.2 \
223+
typeguard==2.11.1 \
224+
python-language-server[all] \
225+
matplotlib==3.4.1
226+
227+
WORKDIR /tmp
228+
COPY ./requirements.txt /tmp
229+
RUN /opt/conda/bin/python3 -m pip install --no-cache-dir --ignore-installed -r requirements.txt && \
230+
rm -f /tmp/*.whl /tmp/requirements.txt
231+
232+
# Install Jupyterlab extensions
233+
RUN jupyter nbextensions_configurator enable && \
234+
jupyter contrib nbextension install && \
235+
jupyter nbextension enable --py --sys-prefix widgetsnbextension && \
236+
jupyter serverextension enable --py jupyterlab --sys-prefix && \
237+
jupyter labextension install --no-build @jupyter-widgets/jupyterlab-manager && \
238+
jupyter labextension install --no-build @krassowski/jupyterlab-lsp && \
239+
jupyter serverextension enable --py jupyter_lsp && \
240+
jupyter labextension install --no-build @jupyterlab/toc && \
241+
jupyter nbextension enable execute_time/ExecuteTime && \
242+
jupyter nbextension enable toc2/main
243+
RUN jupyter labextension install \
244+
@hokyjack/jupyterlab-monokai-plus \
245+
@ryantam626/jupyterlab_code_formatter \
246+
@jupyterlab/toc \
247+
@axlair/jupyterlab_vim \
248+
@pyviz/jupyterlab_pyviz && \
249+
@bokeh/jupyter_bokeh && \
250+
jupyter labextension install --no-build jupyterlab-nvdashboard && \
251+
# jupyter serverextension enable --py jupyterlab_code_formatter && \
252+
jupyter lab build --dev-build=False --minimize=False
253+
WORKDIR /tmp
254+
RUN wget https://linux.kite.com/dls/linux/current && \
255+
chmod 777 current && \
256+
sed -i 's/"--no-launch"//g' current > /dev/null && \
257+
./current --install ./kite-installer
258+
259+
260+
# Copy Backend.Ai multi-node support
261+
COPY ./runner-scripts/bootstrap.sh /opt/container/
262+
COPY ./service-defs /etc/backend.ai/service-defs
263+
# Install ipython kernelspec
264+
Run /opt/conda/bin/python3 -m ipykernel install --display-name "Conda python 3.8 on CUDA 10.1 & CentOS 7" && \
265+
cat /usr/local/share/jupyter/kernels/python3/kernel.json
266+
267+
# Backend.AI specifics
268+
LABEL ai.backend.kernelspec="1" \
269+
ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \
270+
ai.backend.features="batch query uid-match user-input" \
271+
ai.backend.base-distro="centos7.6" \
272+
ai.backend.resource.min.cpu="1" \
273+
ai.backend.resource.min.mem="1g" \
274+
ai.backend.resource.min.cuda.device=0 \
275+
ai.backend.resource.min.cuda.shares=0 \
276+
ai.backend.runtime-type="python" \
277+
ai.backend.runtime-path="/opt/conda/bin/python3" \
278+
ai.backend.service-ports="ipython:pty:3000,jupyter:http:8081,vscode:http:8180,tensorboard:http:6006"
279+
280+
WORKDIR /home/work
281+
# vim: ft=dockerfile

0 commit comments

Comments
 (0)