diff --git a/.circleci/docker/build.sh b/.circleci/docker/build.sh index dcd83f7ee0bbc..de3c6ed9b7581 100755 --- a/.circleci/docker/build.sh +++ b/.circleci/docker/build.sh @@ -283,6 +283,13 @@ fi tmp_tag=$(basename "$(mktemp -u)" | tr '[:upper:]' '[:lower:]') +#when using cudnn version 8 install it separately from cuda +if [[ "$image" == *cuda* && ${OS} == "ubuntu" ]]; then + IMAGE_NAME="nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VERSION}-devel-ubuntu${UBUNTU_VERSION}" + if [[ ${CUDNN_VERSION} == 8 ]]; then + IMAGE_NAME="nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}" + fi +fi # Build image # TODO: build-arg THRIFT is not turned on for any image, remove it once we confirm @@ -321,6 +328,7 @@ docker build \ --build-arg "KATEX=${KATEX:-}" \ --build-arg "ROCM_VERSION=${ROCM_VERSION:-}" \ --build-arg "PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH:-gfx900;gfx906}" \ + --build-arg "IMAGE_NAME=${IMAGE_NAME}" \ -f $(dirname ${DOCKERFILE})/Dockerfile \ -t "$tmp_tag" \ "$@" \ diff --git a/.circleci/docker/common/install_cudnn.sh b/.circleci/docker/common/install_cudnn.sh new file mode 100644 index 0000000000000..1f1c34ea200d4 --- /dev/null +++ b/.circleci/docker/common/install_cudnn.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [[ ${CUDNN_VERSION} == 8 ]]; then + # cuDNN license: https://developer.nvidia.com/cudnn/license_agreement + mkdir tmp_cudnn && cd tmp_cudnn + CUDNN_NAME="cudnn-linux-x86_64-8.3.2.44_cuda11.5-archive" + curl -OLs https://developer.download.nvidia.com/compute/redist/cudnn/v8.3.2/local_installers/11.5/${CUDNN_NAME}.tar.xz + tar xf ${CUDNN_NAME}.tar.xz + cp -a ${CUDNN_NAME}/include/* /usr/include/ + cp -a ${CUDNN_NAME}/include/* /usr/local/cuda/include/ + cp -a ${CUDNN_NAME}/include/* /usr/include/x86_64-linux-gnu/ + + cp -a ${CUDNN_NAME}/lib/* /usr/local/cuda/lib64/ + cp -a ${CUDNN_NAME}/lib/* /usr/lib/x86_64-linux-gnu/ + cd .. + rm -rf tmp_cudnn + ldconfig +fi diff --git a/.circleci/docker/ubuntu-cuda/Dockerfile b/.circleci/docker/ubuntu-cuda/Dockerfile index 326fa66deef50..241b91cff394d 100644 --- a/.circleci/docker/ubuntu-cuda/Dockerfile +++ b/.circleci/docker/ubuntu-cuda/Dockerfile @@ -1,12 +1,11 @@ ARG UBUNTU_VERSION ARG CUDA_VERSION -ARG CUDNN_VERSION +ARG IMAGE_NAME -FROM nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VERSION}-devel-ubuntu${UBUNTU_VERSION} +FROM ${IMAGE_NAME} ARG UBUNTU_VERSION ARG CUDA_VERSION -ARG CUDNN_VERSION ENV DEBIAN_FRONTEND noninteractive @@ -101,5 +100,11 @@ ENV CUDA_PATH /usr/local/cuda # Install LLVM dev version (Defined in the pytorch/builder github repository) COPY --from=pytorch/llvm:9.0.1 /opt/llvm /opt/llvm +# Install CUDNN +ARG CUDNN_VERSION +ADD ./common/install_cudnn.sh install_cudnn.sh +RUN if [ "${CUDNN_VERSION}" -eq 8 ]; then bash install_cudnn.sh; fi +RUN rm install_cudnn.sh + USER jenkins CMD ["bash"]