Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Updates to cudnn package installation (#14923)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
perdasilva authored and wkcn committed May 12, 2019
1 parent 8a4ad9f commit 669ab2c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 14 deletions.
4 changes: 2 additions & 2 deletions ci/docker/Dockerfile.build.centos7_gpu
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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

Expand Down
3 changes: 1 addition & 2 deletions ci/docker/Dockerfile.build.ubuntu_gpu_cu100
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions ci/docker/Dockerfile.build.ubuntu_gpu_cu90
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions ci/docker/Dockerfile.build.ubuntu_gpu_cu92
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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

Expand Down
39 changes: 33 additions & 6 deletions ci/docker/install/centos7_cudnn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 669ab2c

Please sign in to comment.