Skip to content

Commit

Permalink
update cuda 11.2 to cuda 12.2 (OpenNMT#1590)
Browse files Browse the repository at this point in the history
* update cuda-11 to cuda 12

---------

Co-authored-by: thucpham <[email protected]>
  • Loading branch information
minhthuc2502 and thucpham authored Feb 7, 2024
1 parent c95fd4e commit 8c6715e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04 as builder
FROM nvidia/cuda:12.2.2-cudnn8-devel-ubuntu20.04 as builder

RUN apt-get update && \
apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -66,18 +66,18 @@ RUN cd python && \
python3 -m pip --no-cache-dir install -r install_requirements.txt && \
python3 setup.py bdist_wheel --dist-dir $CTRANSLATE2_ROOT

FROM nvidia/cuda:11.2.2-base-ubuntu20.04
FROM nvidia/cuda:12.2.2-base-ubuntu20.04

# We remove the cuda-compat package because it conflicts with the CUDA Enhanced Compatibility.
# See e.g. https://github.com/NVIDIA/nvidia-docker/issues/1515
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libcublas-11-2 \
libcudnn8=8.1.1.33-1+cuda11.2 \
libcublas-12-2 \
libcudnn8=8.9.7.29-1+cuda12.2 \
libgomp1 \
python3-pip \
&& \
apt-get purge -y cuda-compat-11-2 && \
apt-get purge -y cuda-compat-12-2 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion docker/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ build()
fi
}

build Dockerfile ubuntu20.04-cuda11.2
build Dockerfile ubuntu20.04-cuda12.2
16 changes: 7 additions & 9 deletions python/tools/prepare_build_environment_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ if [ "$CIBW_ARCHS" == "aarch64" ]; then

else

# Install CUDA 11.2, see:
# * https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.2.2/centos7-x86_64/base/Dockerfile
# * https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/11.2.2/centos7-x86_64/devel/Dockerfile
# Install CUDA 12.2:
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo
yum install --setopt=obsoletes=0 -y \
cuda-nvcc-11-2-11.2.152-1 \
cuda-cudart-devel-11-2-11.2.152-1 \
libcurand-devel-11-2-10.2.3.152-1 \
libcudnn8-devel-8.1.1.33-1.cuda11.2 \
libcublas-devel-11-2-11.4.1.1043-1
ln -s cuda-11.2 /usr/local/cuda
cuda-nvcc-12-2-12.2.140-1 \
cuda-cudart-devel-12-2-12.2.140-1 \
libcurand-devel-12-2-10.3.3.141-1 \
libcudnn8-devel-8.9.7.29-1.cuda12.2 \
libcublas-devel-12-2-12.2.5.6-1
ln -s cuda-12.2 /usr/local/cuda

ONEAPI_VERSION=2023.2.0
yum-config-manager --add-repo https://yum.repos.intel.com/oneapi
Expand Down
16 changes: 9 additions & 7 deletions python/tools/prepare_build_environment_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
set -e
set -x

CUDA_ROOT="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2"
curl -L -nv -o cuda.exe https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda_11.2.2_461.33_win10.exe
./cuda.exe -s nvcc_11.2 cudart_11.2 cublas_dev_11.2 curand_dev_11.2
CUDA_ROOT="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2"
curl -L -nv -o cuda.exe https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_537.13_windows.exe
./cuda.exe -s nvcc_12.2 cudart_12.2 cublas_dev_12.2 curand_dev_12.2
rm cuda.exe

curl -L -nv -o cudnn.zip https://developer.download.nvidia.com/compute/redist/cudnn/v8.1.1/cudnn-11.2-windows-x64-v8.1.1.33.zip
unzip cudnn.zip && rm cudnn.zip
cp -r cuda/* "$CUDA_ROOT"
rm -r cuda/
CUDNN_ROOT="C:/Program Files/NVIDIA/CUDNN/v8.8"
curl -L -nv -o cudnn.exe https://developer.download.nvidia.com/compute/redist/cudnn/v8.8.0/local_installers/12.0/cudnn_8.8.0.121_windows.exe
./cudnn.exe -s
sleep 10
cp -r "$CUDNN_ROOT"/* "$CUDA_ROOT"
rm cudnn.exe

# See https://github.com/oneapi-src/oneapi-ci for installer URLs
curl -L -nv -o webimage.exe https://registrationcenter-download.intel.com/akdlm/irc_nas/19078/w_BaseKit_p_2023.0.0.25940_offline.exe
Expand Down

0 comments on commit 8c6715e

Please sign in to comment.