From 0b53c1bbc0cf35c48cb3ff11afe0dd05b0acc297 Mon Sep 17 00:00:00 2001 From: Prathamesh Zarkar <159782310+prathameshzarkar9@users.noreply.github.com> Date: Thu, 12 Sep 2024 14:02:35 +0000 Subject: [PATCH 1/4] cuda support for 12.3 .. 12.5 --- src/nvidia-cuda/devcontainer-feature.json | 39 ++++++++++++++++------- src/nvidia-cuda/install.sh | 12 ++++++- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/nvidia-cuda/devcontainer-feature.json b/src/nvidia-cuda/devcontainer-feature.json index 4a0fb0834..12c311c6a 100644 --- a/src/nvidia-cuda/devcontainer-feature.json +++ b/src/nvidia-cuda/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "nvidia-cuda", - "version": "1.1.2", + "version": "1.1.3", "name": "NVIDIA CUDA", "description": "Installs shared libraries for NVIDIA CUDA.", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/nvidia-cuda", @@ -28,6 +28,9 @@ "cudaVersion": { "type": "string", "proposals": [ + "12.5", + "12.4", + "12.3", "12.2", "12.1", "12.0", @@ -45,15 +48,15 @@ "cudnnVersion": { "type": "string", "proposals": [ - "8.9.5.29", - "8.9.4.25", - "8.9.3.28", - "8.9.2.26", - "8.9.1.23", - "8.9.0.131", - "8.8.1.3", - "8.8.0.121", - "8.7.0.84", + "8.9.5.29", + "8.9.4.25", + "8.9.3.28", + "8.9.2.26", + "8.9.1.23", + "8.9.0.131", + "8.8.1.3", + "8.8.0.121", + "8.7.0.84", "8.6.0.163", "8.5.0.96", "8.4.1.50", @@ -67,7 +70,21 @@ "8.2.1.32", "8.2.0.53", "8.1.1.33", - "8.1.0.77" + "8.1.0.77", + "9.0.0.312", + "9.1.0.70", + "9.1.1.17", + "9.2.0.82", + "9.2.1.18", + "9.3.0.75", + "9.4.0.58", + "9.0.0.312", + "9.1.0.70", + "9.1.1.17", + "9.2.0.82", + "9.2.1.18", + "9.3.0.75", + "9.4.0.58" ], "default": "8.6.0.163", "description": "Version of cuDNN to install" diff --git a/src/nvidia-cuda/install.sh b/src/nvidia-cuda/install.sh index 79a7a9a20..4ca99158f 100644 --- a/src/nvidia-cuda/install.sh +++ b/src/nvidia-cuda/install.sh @@ -68,8 +68,18 @@ echo "Installing CUDA libraries..." apt-get install -yq "$cuda_pkg" if [ "$INSTALL_CUDNN" = "true" ]; then + major_cudnn_version=$(echo "${CUDNN_VERSION}" | cut -d '.' -f 1) # Ensure that the requested version of cuDNN is available AND compatible - cudnn_pkg_version="libcudnn8=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" + #if major cudnn version is 9, then we need to install libcudnn9-cuda- package + #else we need to install libcudnn8-cuda- package + if [[ $major_cudnn_version = "9" ]] + then + major_version=$(echo "${CUDA_VERSION}" | cut -d '.' -f 1) + cudnn_pkg_version="libcudnn9=libcudnn9-cuda-${major_version} ${CUDNN_VERSION}-1" + else + cudnn_pkg_version="libcudnn8=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" + fi + if ! apt-cache show "$cudnn_pkg_version"; then echo "The requested version of cuDNN is not available: cuDNN $CUDNN_VERSION for CUDA $CUDA_VERSION" exit 1 From 4276368bd95e1507adb07916ed6a1c104e3c4469 Mon Sep 17 00:00:00 2001 From: Prathamesh Zarkar <159782310+prathameshzarkar9@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:54:44 +0000 Subject: [PATCH 2/4] cuda 12.3 to 12.5 support --- src/nvidia-cuda/devcontainer-feature.json | 9 +---- src/nvidia-cuda/install.sh | 14 +++++-- test/nvidia-cuda/install_cudnn_123_version.sh | 16 ++++++++ test/nvidia-cuda/install_cudnn_124_version.sh | 16 ++++++++ .../install_cudnn_latest_version.sh | 16 ++++++++ test/nvidia-cuda/scenarios.json | 39 +++++++++++++++++++ 6 files changed, 98 insertions(+), 12 deletions(-) create mode 100644 test/nvidia-cuda/install_cudnn_123_version.sh create mode 100644 test/nvidia-cuda/install_cudnn_124_version.sh create mode 100644 test/nvidia-cuda/install_cudnn_latest_version.sh diff --git a/src/nvidia-cuda/devcontainer-feature.json b/src/nvidia-cuda/devcontainer-feature.json index 12c311c6a..11de47f9f 100644 --- a/src/nvidia-cuda/devcontainer-feature.json +++ b/src/nvidia-cuda/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "nvidia-cuda", - "version": "1.1.3", + "version": "1.1.4", "name": "NVIDIA CUDA", "description": "Installs shared libraries for NVIDIA CUDA.", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/nvidia-cuda", @@ -77,13 +77,6 @@ "9.2.0.82", "9.2.1.18", "9.3.0.75", - "9.4.0.58", - "9.0.0.312", - "9.1.0.70", - "9.1.1.17", - "9.2.0.82", - "9.2.1.18", - "9.3.0.75", "9.4.0.58" ], "default": "8.6.0.163", diff --git a/src/nvidia-cuda/install.sh b/src/nvidia-cuda/install.sh index 4ca99158f..7ba963535 100644 --- a/src/nvidia-cuda/install.sh +++ b/src/nvidia-cuda/install.sh @@ -59,6 +59,8 @@ apt-get update -yq cuda_pkg="cuda-libraries-${CUDA_VERSION/./-}" nvtx_pkg="cuda-nvtx-${CUDA_VERSION/./-}" toolkit_pkg="cuda-toolkit-${CUDA_VERSION/./-}" +major_cudnn_version=$(echo "${CUDNN_VERSION}" | cut -d '.' -f 1) +major_cuda_version=$(echo "${CUDA_VERSION}" | cut -d '.' -f 1) if ! apt-cache show "$cuda_pkg"; then echo "The requested version of CUDA is not available: CUDA $CUDA_VERSION" exit 1 @@ -68,14 +70,12 @@ echo "Installing CUDA libraries..." apt-get install -yq "$cuda_pkg" if [ "$INSTALL_CUDNN" = "true" ]; then - major_cudnn_version=$(echo "${CUDNN_VERSION}" | cut -d '.' -f 1) # Ensure that the requested version of cuDNN is available AND compatible #if major cudnn version is 9, then we need to install libcudnn9-cuda- package #else we need to install libcudnn8-cuda- package if [[ $major_cudnn_version = "9" ]] then - major_version=$(echo "${CUDA_VERSION}" | cut -d '.' -f 1) - cudnn_pkg_version="libcudnn9=libcudnn9-cuda-${major_version} ${CUDNN_VERSION}-1" + cudnn_pkg_version="libcudnn9-cuda-${major_cuda_version}=${CUDNN_VERSION}-1" else cudnn_pkg_version="libcudnn8=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" fi @@ -91,7 +91,13 @@ fi if [ "$INSTALL_CUDNNDEV" = "true" ]; then # Ensure that the requested version of cuDNN development package is available AND compatible - cudnn_dev_pkg_version="libcudnn8-dev=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" + if [[ $major_cudnn_version = "9" ]] + then + cudnn_dev_pkg_version="libcudnn9-dev-cuda-${major_cuda_version}=${CUDNN_VERSION}-1" + else + cudnn_dev_pkg_version="libcudnn8-dev=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" + fi + if ! apt-cache show "$cudnn_dev_pkg_version"; then echo "The requested version of cuDNN development package is not available: cuDNN $CUDNN_VERSION for CUDA $CUDA_VERSION" exit 1 diff --git a/test/nvidia-cuda/install_cudnn_123_version.sh b/test/nvidia-cuda/install_cudnn_123_version.sh new file mode 100644 index 000000000..f331a591f --- /dev/null +++ b/test/nvidia-cuda/install_cudnn_123_version.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# Check installation of libcudnn9-cuda-12 (9.4.0) +check "libcudnn.so.9.4.0" test 1 -eq "$(find /usr -name 'libcudnn.so.9.4.0' | wc -l)" + +# Check installation of cuda-nvtx-11-7 (11.7) +# check "cuda-12-4+nvtx" test -e '/usr/local/cuda-12.4/targets/x86_64-linux/include/nvtx3' + +# Report result +reportResults + \ No newline at end of file diff --git a/test/nvidia-cuda/install_cudnn_124_version.sh b/test/nvidia-cuda/install_cudnn_124_version.sh new file mode 100644 index 000000000..f331a591f --- /dev/null +++ b/test/nvidia-cuda/install_cudnn_124_version.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# Check installation of libcudnn9-cuda-12 (9.4.0) +check "libcudnn.so.9.4.0" test 1 -eq "$(find /usr -name 'libcudnn.so.9.4.0' | wc -l)" + +# Check installation of cuda-nvtx-11-7 (11.7) +# check "cuda-12-4+nvtx" test -e '/usr/local/cuda-12.4/targets/x86_64-linux/include/nvtx3' + +# Report result +reportResults + \ No newline at end of file diff --git a/test/nvidia-cuda/install_cudnn_latest_version.sh b/test/nvidia-cuda/install_cudnn_latest_version.sh new file mode 100644 index 000000000..f331a591f --- /dev/null +++ b/test/nvidia-cuda/install_cudnn_latest_version.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +# Check installation of libcudnn9-cuda-12 (9.4.0) +check "libcudnn.so.9.4.0" test 1 -eq "$(find /usr -name 'libcudnn.so.9.4.0' | wc -l)" + +# Check installation of cuda-nvtx-11-7 (11.7) +# check "cuda-12-4+nvtx" test -e '/usr/local/cuda-12.4/targets/x86_64-linux/include/nvtx3' + +# Report result +reportResults + \ No newline at end of file diff --git a/test/nvidia-cuda/scenarios.json b/test/nvidia-cuda/scenarios.json index bd73263b3..d2400503b 100644 --- a/test/nvidia-cuda/scenarios.json +++ b/test/nvidia-cuda/scenarios.json @@ -20,5 +20,44 @@ "cudnnVersion": "8.5.0.96" } } + }, + "install_cudnn_123_version": { + "image": "debian", + "features": { + "nvidia-cuda": { + "installCudnn": true, + "installNvtx": true, + "installCudnnDev": true, + "installToolkit": true, + "cudaVersion": "12.3", + "cudnnVersion": "9.4.0.58" + } + } + }, + "install_cudnn_124_version": { + "image": "debian", + "features": { + "nvidia-cuda": { + "installCudnn": true, + "installNvtx": true, + "installCudnnDev": true, + "installToolkit": true, + "cudaVersion": "12.4", + "cudnnVersion": "9.4.0.58" + } + } + }, + "install_cudnn_latest_version": { + "image": "debian", + "features": { + "nvidia-cuda": { + "installCudnn": true, + "installNvtx": true, + "installCudnnDev": true, + "installToolkit": true, + "cudaVersion": "12.5", + "cudnnVersion": "9.4.0.58" + } + } } } From 7974d6f668e5be1bb495755650a5caed1ec7424c Mon Sep 17 00:00:00 2001 From: Prathamesh Zarkar <159782310+prathameshzarkar9@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:56:43 +0000 Subject: [PATCH 3/4] patch version update --- src/nvidia-cuda/devcontainer-feature.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvidia-cuda/devcontainer-feature.json b/src/nvidia-cuda/devcontainer-feature.json index 11de47f9f..b46d7c433 100644 --- a/src/nvidia-cuda/devcontainer-feature.json +++ b/src/nvidia-cuda/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "nvidia-cuda", - "version": "1.1.4", + "version": "1.1.3", "name": "NVIDIA CUDA", "description": "Installs shared libraries for NVIDIA CUDA.", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/nvidia-cuda", From 4e17dd3d995c79f84b5666248da66cdd4375c953 Mon Sep 17 00:00:00 2001 From: Prathamesh Zarkar <159782310+prathameshzarkar9@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:16:24 +0000 Subject: [PATCH 4/4] review comments addressed --- src/nvidia-cuda/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvidia-cuda/install.sh b/src/nvidia-cuda/install.sh index 7ba963535..37ba7f0f4 100644 --- a/src/nvidia-cuda/install.sh +++ b/src/nvidia-cuda/install.sh @@ -73,7 +73,7 @@ if [ "$INSTALL_CUDNN" = "true" ]; then # Ensure that the requested version of cuDNN is available AND compatible #if major cudnn version is 9, then we need to install libcudnn9-cuda- package #else we need to install libcudnn8-cuda- package - if [[ $major_cudnn_version = "9" ]] + if [[ $major_cudnn_version -ge "9" ]] then cudnn_pkg_version="libcudnn9-cuda-${major_cuda_version}=${CUDNN_VERSION}-1" else @@ -91,7 +91,7 @@ fi if [ "$INSTALL_CUDNNDEV" = "true" ]; then # Ensure that the requested version of cuDNN development package is available AND compatible - if [[ $major_cudnn_version = "9" ]] + if [[ $major_cudnn_version -ge "9" ]] then cudnn_dev_pkg_version="libcudnn9-dev-cuda-${major_cuda_version}=${CUDNN_VERSION}-1" else