You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by wk...@apache.org on 2019/05/12 05:29:33 UTC

[incubator-mxnet] branch master updated: Updates to cudnn package installation (#14923)

This is an automated email from the ASF dual-hosted git repository.

wkcn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 669ab2c  Updates to cudnn package installation (#14923)
669ab2c is described below

commit 669ab2c0d02eeec8c8c191e6fc41465ac15a279e
Author: perdasilva <pe...@gmail.com>
AuthorDate: Sun May 12 07:28:57 2019 +0200

    Updates to cudnn package installation (#14923)
    
    * Generalizes centos7 cudnn download and install script
    
    * Updates setting of cudnn version to a position in the Dockerfile that will have the least impact on caching
---
 ci/docker/Dockerfile.build.centos7_gpu      |  4 +--
 ci/docker/Dockerfile.build.ubuntu_gpu_cu100 |  3 +--
 ci/docker/Dockerfile.build.ubuntu_gpu_cu90  |  3 +--
 ci/docker/Dockerfile.build.ubuntu_gpu_cu92  |  3 +--
 ci/docker/install/centos7_cudnn.sh          | 39 ++++++++++++++++++++++++-----
 5 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/ci/docker/Dockerfile.build.centos7_gpu b/ci/docker/Dockerfile.build.centos7_gpu
index cb3ae82..cf76f22 100644
--- a/ci/docker/Dockerfile.build.centos7_gpu
+++ b/ci/docker/Dockerfile.build.centos7_gpu
@@ -20,8 +20,6 @@
 
 FROM nvidia/cuda:10.0-devel-centos7
 
-ENV CUDNN_VERSION=7.3.1.20
-
 WORKDIR /work/deps
 
 COPY install/centos7_core.sh /work/
@@ -30,6 +28,8 @@ COPY install/centos7_ccache.sh /work/
 RUN /work/centos7_ccache.sh
 COPY install/centos7_python.sh /work/
 RUN /work/centos7_python.sh
+
+ENV CUDNN_VERSION=7.3.1.20
 COPY install/centos7_cudnn.sh /work/
 RUN /work/centos7_cudnn.sh
 
diff --git a/ci/docker/Dockerfile.build.ubuntu_gpu_cu100 b/ci/docker/Dockerfile.build.ubuntu_gpu_cu100
index 63fd597..6ec4a1f 100644
--- a/ci/docker/Dockerfile.build.ubuntu_gpu_cu100
+++ b/ci/docker/Dockerfile.build.ubuntu_gpu_cu100
@@ -20,8 +20,6 @@
 
 FROM nvidia/cuda:10.0-devel-ubuntu16.04
 
-ENV CUDNN_VERSION=7.3.1.20
-
 WORKDIR /work/deps
 
 COPY install/ubuntu_core.sh /work/
@@ -74,6 +72,7 @@ ARG GROUP_ID=0
 COPY install/ubuntu_adduser.sh /work/
 RUN /work/ubuntu_adduser.sh
 
+ENV CUDNN_VERSION=7.3.1.20
 COPY install/ubuntu_cudnn.sh /work/
 RUN /work/ubuntu_cudnn.sh
 
diff --git a/ci/docker/Dockerfile.build.ubuntu_gpu_cu90 b/ci/docker/Dockerfile.build.ubuntu_gpu_cu90
index f1e6570..2730cc2 100644
--- a/ci/docker/Dockerfile.build.ubuntu_gpu_cu90
+++ b/ci/docker/Dockerfile.build.ubuntu_gpu_cu90
@@ -20,8 +20,6 @@
 
 FROM nvidia/cuda:9.0-devel-ubuntu16.04
 
-ENV CUDNN_VERSION=7.3.1.20
-
 WORKDIR /work/deps
 
 COPY install/ubuntu_core.sh /work/
@@ -74,6 +72,7 @@ ARG GROUP_ID=0
 COPY install/ubuntu_adduser.sh /work/
 RUN /work/ubuntu_adduser.sh
 
+ENV CUDNN_VERSION=7.3.1.20
 COPY install/ubuntu_cudnn.sh /work/
 RUN /work/ubuntu_cudnn.sh
 
diff --git a/ci/docker/Dockerfile.build.ubuntu_gpu_cu92 b/ci/docker/Dockerfile.build.ubuntu_gpu_cu92
index 81b337e..316c81d 100644
--- a/ci/docker/Dockerfile.build.ubuntu_gpu_cu92
+++ b/ci/docker/Dockerfile.build.ubuntu_gpu_cu92
@@ -20,8 +20,6 @@
 
 FROM nvidia/cuda:9.2-devel-ubuntu16.04
 
-ENV CUDNN_VERSION=7.3.1.20
-
 WORKDIR /work/deps
 
 COPY install/ubuntu_core.sh /work/
@@ -74,6 +72,7 @@ ARG GROUP_ID=0
 COPY install/ubuntu_adduser.sh /work/
 RUN /work/ubuntu_adduser.sh
 
+ENV CUDNN_VERSION=7.3.1.20
 COPY install/ubuntu_cudnn.sh /work/
 RUN /work/ubuntu_cudnn.sh
 
diff --git a/ci/docker/install/centos7_cudnn.sh b/ci/docker/install/centos7_cudnn.sh
index 43ff89b..69f2850 100755
--- a/ci/docker/install/centos7_cudnn.sh
+++ b/ci/docker/install/centos7_cudnn.sh
@@ -22,11 +22,38 @@
 
 set -ex
 
+if [ -z ${CUDA_VERSION} ]; then
+    echo "Error: CUDA_VERSION environment variable undefined"
+    exit 1
+fi
+
+if [ -z ${CUDNN_VERSION} ]; then
+    echo "Error: CUDNN_VERSION environment variable undefined"
+    exit 1
+fi
+
+SHORT_CUDA_VERSION=""
+SHORT_CUDNN_VERSION=""
+
+if [[ ${CUDA_VERSION} =~ ([0-9]+\.[0-9]+)\.* ]]; then
+    SHORT_CUDA_VERSION=${BASH_REMATCH[1]}
+else
+    echo "Error: CUDA_VERSION (${CUDA_VERSION}) did not match expected format [0-9]+.[0-9]+.*"
+fi
+
+if [[ ${CUDNN_VERSION} =~ ([0-9]+\.[0-9]+\.[0-9]+)\.* ]]; then
+    SHORT_CUDNN_VERSION=${BASH_REMATCH[1]}
+else
+    echo "Error: CUDNN_VERSION (${CUDNN_VERSION}) did not match expected format [0-9]+.[0-9]+.[0-9]+.*"
+fi
+
 # Multipackage installation does not fail in yum
-CUDNN_DOWNLOAD_SUM=4e15a323f2edffa928b4574f696fc0e449a32e6bc35c9ccb03a47af26c2de3fa
-curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v7.3.1/cudnn-10.0-linux-x64-v7.3.1.20.tgz -O
-echo "$CUDNN_DOWNLOAD_SUM cudnn-10.0-linux-x64-v7.3.1.20.tgz" | sha256sum -c -
-tar --no-same-owner -xzf cudnn-10.0-linux-x64-v7.3.1.20.tgz -C /usr/local
-rm cudnn-10.0-linux-x64-v7.3.1.20.tgz
-ldconfig
+CUDNN_PKG="cudnn-${SHORT_CUDA_VERSION}-linux-x64-v${CUDNN_VERSION}.tgz"
+CUDNN_PKG_URL="http://developer.download.nvidia.com/compute/redist/cudnn/v${SHORT_CUDNN_VERSION}/${CUDNN_PKG}"
+CUDNN_DOWNLOAD_SUM=`curl -fsSL "${CUDNN_PKG_URL}.sha256"`
 
+curl -fsSL ${CUDNN_PKG_URL} -O
+echo "${CUDNN_DOWNLOAD_SUM}" | sha256sum -c -
+tar --no-same-owner -xzf ${CUDNN_PKG} -C /usr/local
+rm ${CUDNN_PKG}
+ldconfig