From d5c3b0a180587556d6a513b3423895ff909c6756 Mon Sep 17 00:00:00 2001 From: Per Goncalves da Silva Date: Thu, 9 May 2019 08:33:52 +0200 Subject: [PATCH 1/2] Generalizes centos7 cudnn download and install script --- ci/docker/install/centos7_cudnn.sh | 39 +++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/ci/docker/install/centos7_cudnn.sh b/ci/docker/install/centos7_cudnn.sh index 43ff89b121cc..69f285017447 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 From 689cd771a4c5aef54de84b8b48823d729f3fda16 Mon Sep 17 00:00:00 2001 From: Per Goncalves da Silva Date: Fri, 10 May 2019 15:43:24 +0200 Subject: [PATCH 2/2] 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 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ci/docker/Dockerfile.build.centos7_gpu b/ci/docker/Dockerfile.build.centos7_gpu index cb3ae82acd05..cf76f22a9f0a 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 63fd5973fcd0..6ec4a1fe415f 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 f1e6570f03b9..2730cc2caee1 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 81b337e4d9a7..316c81d8a6e1 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