-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile-cuDNN
83 lines (75 loc) · 4.55 KB
/
Dockerfile-cuDNN
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
FROM vishnumohan/beakerx-dcos
ARG CONDA_ENV_YML="beakerx-root-conda-cudnn-env.yml"
ARG IBM_GPU_ENABLER_JAR_SHA256="4d5919003fdf915a747f51af83d851bc07588706b415f2a8a24c666bb5a7f977"
ARG IBM_GPU_ENABLER_URL="https://s3.amazonaws.com/vishnu-mohan/ibm/gpu-enabler"
ARG IBM_GPU_ENABLER_VERSION="2.0.0"
ARG NVIDIA_CUDA_MAJOR_VERSION="9-0"
ARG NVIDIA_CUDA_PKG_VERSION="9.0.176-1"
ARG NVIDIA_CUDA_VERSION="9.0"
ARG NVIDIA_CUDA_TOOLS_GPG_KEY="7fa2af80"
ARG NVIDIA_CUDNN_MAJOR_VERSION="7"
ARG NVIDIA_CUDNN_PKG_VERSION="7.1.1.5-1+cuda9.0"
ARG NVIDIA_DISTRO="ubuntu1604"
ARG NVIDIA_DRIVER_CAPABILITIES="compute,utility"
ARG NVIDIA_NCCL_MAJOR_VERSION="2"
ARG NVIDIA_NCCL_PKG_VERSION="2.1.2-1+cuda9.0"
ARG NVIDIA_REQUIRE_CUDA="cuda>=9.0"
ARG NVIDIA_URL="http://developer.download.nvidia.com/compute"
ARG NVIDIA_VISIBLE_DEVICES="all"
ARG NVIDIA_VOLUMES_NEEDED="nvidia_driver"
ARG TENSORFLOW_JNI_SHA256="e657b0966c963cb9a0e5ff42917b589268b361bf463604c34e5fcf85ac87007e"
ARG TENSORFLOW_URL="https://storage.googleapis.com/tensorflow"
ARG TENSORFLOW_VARIANT="gpu"
ARG TENSORFLOW_VERSION="1.8.0"
LABEL com.nvidia.volumes.needed=${NVIDIA_VOLUMES_NEEDED:-"nvidia_driver"} \
com.nvidia.cuda.version="${NVIDIA_CUDA_PKG_VERSION}" \
com.nvidia.cudnn.version="${NVIDIA_CUDNN_VERSION}"
USER root
# Need to unset LD_LIBRARY_PATH first so that libraries in ${MESOSPHERE_PREFIX}/libmesos-bundle/lib don't interfere with apt
RUN unset LD_LIBRARY_PATH \
&& apt-key adv --keyserver "${GPG_KEYSERVER}" --recv-keys "${NVIDIA_CUDA_TOOLS_GPG_KEY}" \
&& echo "deb ${NVIDIA_URL}/cuda/repos/${NVIDIA_DISTRO}/x86_64 /" > /etc/apt/sources.list.d/nvidia-cuda.list \
&& echo "deb ${NVIDIA_URL}/machine-learning/repos/${NVIDIA_DISTRO}/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list \
&& apt-get update -yq --fix-missing \
&& apt-get install -yq --no-install-recommends \
"cuda-cudart-${NVIDIA_CUDA_MAJOR_VERSION}=${NVIDIA_CUDA_PKG_VERSION}" \
"cuda-libraries-${NVIDIA_CUDA_MAJOR_VERSION}=${NVIDIA_CUDA_PKG_VERSION}" \
"cuda-libraries-dev-${NVIDIA_CUDA_MAJOR_VERSION}=${NVIDIA_CUDA_PKG_VERSION}" \
"libnccl${NVIDIA_NCCL_MAJOR_VERSION}=${NVIDIA_NCCL_PKG_VERSION}" \
"libcudnn${NVIDIA_CUDNN_MAJOR_VERSION}=${NVIDIA_CUDNN_PKG_VERSION}" \
&& cd /usr/local \
&& ln -s "cuda-${NVIDIA_CUDA_VERSION}" cuda \
&& cd cuda-"${NVIDIA_CUDA_VERSION}/targets/x86_64-linux/lib" \
&& ln -s stubs/libcuda.so libcuda.so.1 \
&& echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf \
&& echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf \
&& cd /opt/spark/jars \
&& curl --retry 3 -fsSL -O "${IBM_GPU_ENABLER_URL}/${IBM_GPU_ENABLER_VERSION}/gpu-enabler_2.11-${IBM_GPU_ENABLER_VERSION}.jar" \
&& echo "${IBM_GPU_ENABLER_JAR_SHA256}" "gpu-enabler_2.11-${IBM_GPU_ENABLER_VERSION}.jar" | sha256sum -c - \
&& cd /tmp \
&& curl --retry 3 -fsSL -O "${TENSORFLOW_URL}/libtensorflow/libtensorflow_jni-${TENSORFLOW_VARIANT}-linux-x86_64-${TENSORFLOW_VERSION}.tar.gz" \
&& echo "${TENSORFLOW_JNI_SHA256}" "libtensorflow_jni-${TENSORFLOW_VARIANT}-linux-x86_64-${TENSORFLOW_VERSION}.tar.gz" | sha256sum -c - \
&& tar xf "libtensorflow_jni-${TENSORFLOW_VARIANT}-linux-x86_64-${TENSORFLOW_VERSION}.tar.gz" "./libtensorflow_jni.so" \
&& mv "libtensorflow_jni.so" "/usr/lib" \
&& rm "libtensorflow_jni-${TENSORFLOW_VARIANT}-linux-x86_64-${TENSORFLOW_VERSION}.tar.gz" \
&& rm /usr/lib/x86_64-linux-gnu/libcurl.so.4 \
&& cp "${MESOSPHERE_PREFIX}/libmesos-bundle/lib/libcurl.so.4" /usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0 \
&& ln -s /usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0 /usr/lib/x86_64-linux-gnu/libcurl.so.4 \
&& ldconfig \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --chown="1000:100" "${CONDA_ENV_YML}" "${CONDA_DIR}/"
USER $NB_UID
RUN ${CONDA_DIR}/bin/conda env update --json -q -f "${CONDA_DIR}/${CONDA_ENV_YML}" \
&& ${CONDA_DIR}/bin/conda update --json --all -yq \
&& ${CONDA_DIR}/bin/npm cache clean --force \
&& rm -rf "${CONDA_DIR}/share/jupyter/lab/staging" \
&& rm -rf "${HOME}/.cache/pip" "${HOME}/.cache/yarn" "${HOME}/.node-gyp" \
&& ${CONDA_DIR}/bin/conda clean --json -tipsy \
&& fix-permissions ${CONDA_DIR} \
&& fix-permissions ${HOME}
ENV NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES:-"all"} \
NVIDIA_DRIVER_CAPABILITIES=${NVIDIA_DRIVER_CAPABILITIES:-"compute,utility"} \
NVIDIA_REQUIRE_CUDA=${NVIDIA_REQUIRE_CUDA:-"cuda>=9.0"} \
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}" \
LD_LIBRARY_PATH="/usr/local/nvidia/lib:/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}"