From aba2457fdd2395dcc3ccff81645f30ee619a38b6 Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Sun, 24 Sep 2023 12:46:49 +0000 Subject: [PATCH 01/11] add cuda tookit installing support --- src/nvidia-cuda/devcontainer-feature.json | 5 +++++ src/nvidia-cuda/install.sh | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/nvidia-cuda/devcontainer-feature.json b/src/nvidia-cuda/devcontainer-feature.json index 81e1dff8d..b2b2d33b3 100644 --- a/src/nvidia-cuda/devcontainer-feature.json +++ b/src/nvidia-cuda/devcontainer-feature.json @@ -15,6 +15,11 @@ "default": false, "description": "Additionally install NVIDIA Tools Extension (NVTX)" }, + "installToolkit": { + "type": "boolean", + "default": false, + "description": "Additionally install NVIDIA CUDA Toolkit" + }, "cudaVersion": { "type": "string", "proposals": [ diff --git a/src/nvidia-cuda/install.sh b/src/nvidia-cuda/install.sh index f7db18e5e..4959f415a 100644 --- a/src/nvidia-cuda/install.sh +++ b/src/nvidia-cuda/install.sh @@ -7,6 +7,7 @@ rm -rf /var/lib/apt/lists/* INSTALL_CUDNN=${INSTALLCUDNN} INSTALL_NVTX=${INSTALLNVTX} +INSTALL_TOOLKIT=${INSTALLTOOLKIT} CUDA_VERSION=${CUDAVERSION} CUDNN_VERSION=${CUDNNVERSION} @@ -47,6 +48,7 @@ apt-get update -yq # Ensure that the requested version of CUDA is available cuda_pkg="cuda-libraries-${CUDA_VERSION/./-}" nvtx_pkg="cuda-nvtx-${CUDA_VERSION/./-}" +tookit_pkg="cuda-toolkit-${CUDA_VERSION/./-}" if ! apt-cache show "$cuda_pkg"; then echo "The requested version of CUDA is not available: CUDA $CUDA_VERSION" exit 1 @@ -72,6 +74,11 @@ if [ "$INSTALL_NVTX" = "true" ]; then apt-get install -yq "$nvtx_pkg" fi +if [ "$INSTALL_TOOLKIT" = "true" ]; then + echo "Installing Toolkit..." + apt-get install -yq "$toolkit_pkg" +fi + # Clean up rm -rf /var/lib/apt/lists/* From 665fd62a4409e7f4997c8c6f3382781dccbb1250 Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Sun, 24 Sep 2023 14:24:43 +0000 Subject: [PATCH 02/11] add nvcc installing support --- src/nvidia-cuda/devcontainer-feature.json | 5 +++++ src/nvidia-cuda/install.sh | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/nvidia-cuda/devcontainer-feature.json b/src/nvidia-cuda/devcontainer-feature.json index b2b2d33b3..dd371e8b9 100644 --- a/src/nvidia-cuda/devcontainer-feature.json +++ b/src/nvidia-cuda/devcontainer-feature.json @@ -15,6 +15,11 @@ "default": false, "description": "Additionally install NVIDIA Tools Extension (NVTX)" }, + "installNvcc": { + "type": "boolean", + "default": false, + "description": "Additionally install NVIDIA CUDA Compiler (NVCC)" + }, "installToolkit": { "type": "boolean", "default": false, diff --git a/src/nvidia-cuda/install.sh b/src/nvidia-cuda/install.sh index 4959f415a..474966f6a 100644 --- a/src/nvidia-cuda/install.sh +++ b/src/nvidia-cuda/install.sh @@ -7,6 +7,7 @@ rm -rf /var/lib/apt/lists/* INSTALL_CUDNN=${INSTALLCUDNN} INSTALL_NVTX=${INSTALLNVTX} +INSTALL_NVCC=${INSTALLNVCC} INSTALL_TOOLKIT=${INSTALLTOOLKIT} CUDA_VERSION=${CUDAVERSION} CUDNN_VERSION=${CUDNNVERSION} @@ -48,7 +49,8 @@ apt-get update -yq # Ensure that the requested version of CUDA is available cuda_pkg="cuda-libraries-${CUDA_VERSION/./-}" nvtx_pkg="cuda-nvtx-${CUDA_VERSION/./-}" -tookit_pkg="cuda-toolkit-${CUDA_VERSION/./-}" +nvcc_pkg="cuda-nvcc-${CUDA_VERSION/./-}" +toolkit_pkg="cuda-toolkit-${CUDA_VERSION/./-}" if ! apt-cache show "$cuda_pkg"; then echo "The requested version of CUDA is not available: CUDA $CUDA_VERSION" exit 1 @@ -74,8 +76,13 @@ if [ "$INSTALL_NVTX" = "true" ]; then apt-get install -yq "$nvtx_pkg" fi +if [ "$INSTALL_NVCC" = "true" ]; then + echo "Installing NVCC..." + apt-get install -yq "$nvcc_pkg" +fi + if [ "$INSTALL_TOOLKIT" = "true" ]; then - echo "Installing Toolkit..." + echo "Installing CUDA Toolkit..." apt-get install -yq "$toolkit_pkg" fi From 54cb1ccb233f570dd26a8dde64b21c942ff41cde Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Sun, 24 Sep 2023 14:25:29 +0000 Subject: [PATCH 03/11] add libcudnn8-dev installing support --- src/nvidia-cuda/devcontainer-feature.json | 5 +++++ src/nvidia-cuda/install.sh | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/nvidia-cuda/devcontainer-feature.json b/src/nvidia-cuda/devcontainer-feature.json index dd371e8b9..ecd54efbb 100644 --- a/src/nvidia-cuda/devcontainer-feature.json +++ b/src/nvidia-cuda/devcontainer-feature.json @@ -10,6 +10,11 @@ "default": false, "description": "Additionally install CUDA Deep Neural Network (cuDNN) shared library" }, + "installCudnnDev": { + "type": "boolean", + "default": false, + "description": "Additionally install CUDA Deep Neural Network (cuDNN) development libraries and headers" + }, "installNvtx": { "type": "boolean", "default": false, diff --git a/src/nvidia-cuda/install.sh b/src/nvidia-cuda/install.sh index 474966f6a..8d7566b36 100644 --- a/src/nvidia-cuda/install.sh +++ b/src/nvidia-cuda/install.sh @@ -6,6 +6,7 @@ set -e rm -rf /var/lib/apt/lists/* INSTALL_CUDNN=${INSTALLCUDNN} +INSTALL_CUDNNDEV=${INSTALLCUDNNDEV} INSTALL_NVTX=${INSTALLNVTX} INSTALL_NVCC=${INSTALLNVCC} INSTALL_TOOLKIT=${INSTALLTOOLKIT} @@ -59,7 +60,7 @@ fi echo "Installing CUDA libraries..." apt-get install -yq "$cuda_pkg" -if [ "$INSTALL_CUDNN" = "true" ]; then +if [ "$INSTALL_CUDNN" = "true" ] || [ "$INSTALL_CUDNNDEV" = "true" ]; then # Ensure that the requested version of cuDNN is available AND compatible cudnn_pkg_version="libcudnn8=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" if ! apt-cache show "$cudnn_pkg_version"; then @@ -67,8 +68,13 @@ if [ "$INSTALL_CUDNN" = "true" ]; then exit 1 fi + cudnn_dev_pkg_version="" + if [ "$INSTALL_CUDNNDEV" = "true" ]; then + cudnn_dev_pkg_version="libcudnn8-dev=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" + fi + echo "Installing cuDNN libraries..." - apt-get install -yq "$cudnn_pkg_version" + apt-get install -yq "$cudnn_pkg_version" "$cudnn_dev_pkg_version" fi if [ "$INSTALL_NVTX" = "true" ]; then From 5e06743d794a84cf94b9e11e6935064ad1e85e02 Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Sun, 24 Sep 2023 14:30:06 +0000 Subject: [PATCH 04/11] add new cuda versions adn cudnn versions --- src/nvidia-cuda/devcontainer-feature.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/nvidia-cuda/devcontainer-feature.json b/src/nvidia-cuda/devcontainer-feature.json index ecd54efbb..39a4d8b85 100644 --- a/src/nvidia-cuda/devcontainer-feature.json +++ b/src/nvidia-cuda/devcontainer-feature.json @@ -33,6 +33,9 @@ "cudaVersion": { "type": "string", "proposals": [ + "12.2", + "12.1", + "12.0", "11.8", "11.7", "11.6", @@ -47,6 +50,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.6.0.163", "8.5.0.96", "8.4.1.50", From 0dcdb92406e38caa297643eab5af641f814b4f69 Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Sun, 24 Sep 2023 14:30:40 +0000 Subject: [PATCH 05/11] add specificaitons of new option --- src/nvidia-cuda/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nvidia-cuda/README.md b/src/nvidia-cuda/README.md index 7a0343de4..71cdaf338 100644 --- a/src/nvidia-cuda/README.md +++ b/src/nvidia-cuda/README.md @@ -16,7 +16,10 @@ Installs shared libraries for NVIDIA CUDA. | Options Id | Description | Type | Default Value | |-----|-----|-----|-----| | installCudnn | Additionally install CUDA Deep Neural Network (cuDNN) shared library | boolean | false | +| installCudnnDev | Additionally install CUDA Deep Neural Network (cuDNN) development libraries and headers | boolean | false | | installNvtx | Additionally install NVIDIA Tools Extension (NVTX) | boolean | false | +| installNvcc | Additionally install NVIDIA CUDA Compiler (NVCC) | boolean | false | +| installToolkit | Additionally install NVIDIA CUDA Compiler Toolkit | boolean | false | | cudaVersion | Version of CUDA to install | string | 11.8 | | cudnnVersion | Version of cuDNN to install | string | 8.6.0.163 | From 9aa23ee5fdb4b79428ec96dade388ab0ff741e1d Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Tue, 26 Sep 2023 11:21:15 +0000 Subject: [PATCH 06/11] remove installNvcc installNvcc process is included in installToolkit --- src/nvidia-cuda/devcontainer-feature.json | 5 ----- src/nvidia-cuda/install.sh | 7 ------- 2 files changed, 12 deletions(-) diff --git a/src/nvidia-cuda/devcontainer-feature.json b/src/nvidia-cuda/devcontainer-feature.json index 39a4d8b85..fb202b084 100644 --- a/src/nvidia-cuda/devcontainer-feature.json +++ b/src/nvidia-cuda/devcontainer-feature.json @@ -20,11 +20,6 @@ "default": false, "description": "Additionally install NVIDIA Tools Extension (NVTX)" }, - "installNvcc": { - "type": "boolean", - "default": false, - "description": "Additionally install NVIDIA CUDA Compiler (NVCC)" - }, "installToolkit": { "type": "boolean", "default": false, diff --git a/src/nvidia-cuda/install.sh b/src/nvidia-cuda/install.sh index 8d7566b36..c174c2a52 100644 --- a/src/nvidia-cuda/install.sh +++ b/src/nvidia-cuda/install.sh @@ -8,7 +8,6 @@ rm -rf /var/lib/apt/lists/* INSTALL_CUDNN=${INSTALLCUDNN} INSTALL_CUDNNDEV=${INSTALLCUDNNDEV} INSTALL_NVTX=${INSTALLNVTX} -INSTALL_NVCC=${INSTALLNVCC} INSTALL_TOOLKIT=${INSTALLTOOLKIT} CUDA_VERSION=${CUDAVERSION} CUDNN_VERSION=${CUDNNVERSION} @@ -50,7 +49,6 @@ apt-get update -yq # Ensure that the requested version of CUDA is available cuda_pkg="cuda-libraries-${CUDA_VERSION/./-}" nvtx_pkg="cuda-nvtx-${CUDA_VERSION/./-}" -nvcc_pkg="cuda-nvcc-${CUDA_VERSION/./-}" toolkit_pkg="cuda-toolkit-${CUDA_VERSION/./-}" if ! apt-cache show "$cuda_pkg"; then echo "The requested version of CUDA is not available: CUDA $CUDA_VERSION" @@ -82,11 +80,6 @@ if [ "$INSTALL_NVTX" = "true" ]; then apt-get install -yq "$nvtx_pkg" fi -if [ "$INSTALL_NVCC" = "true" ]; then - echo "Installing NVCC..." - apt-get install -yq "$nvcc_pkg" -fi - if [ "$INSTALL_TOOLKIT" = "true" ]; then echo "Installing CUDA Toolkit..." apt-get install -yq "$toolkit_pkg" From 50a7b160f0c7ea1956e7897f5843ef57332e6141 Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Tue, 26 Sep 2023 11:20:36 +0000 Subject: [PATCH 07/11] add tests for new nvidia-cuda options --- .../{install_cudnn_nvxt.sh => install_all_options.sh} | 6 ++++++ 1 file changed, 6 insertions(+) rename test/nvidia-cuda/{install_cudnn_nvxt.sh => install_all_options.sh} (63%) diff --git a/test/nvidia-cuda/install_cudnn_nvxt.sh b/test/nvidia-cuda/install_all_options.sh similarity index 63% rename from test/nvidia-cuda/install_cudnn_nvxt.sh rename to test/nvidia-cuda/install_all_options.sh index 7b20f4361..7d9e03107 100644 --- a/test/nvidia-cuda/install_cudnn_nvxt.sh +++ b/test/nvidia-cuda/install_all_options.sh @@ -8,8 +8,14 @@ source dev-container-features-test-lib # Check installation of libcudnn8 check "libcudnn.so.8" test 1 -eq "$(find /usr -name 'libcudnn.so.8' | wc -l)" +# Check installation of libcudnn8-dev +check "cudnn.h" test 1 -eq "$(find /usr -name 'cudnn.h' | wc -l)" + # Check installation of cuda-nvtx-11- check "cuda-11+nvtx" test -e '/usr/local/cuda-11/targets/x86_64-linux/include/nvtx3' +# Check installation of cuda-nvcc-11- +check "cuda-11+nvcc" test -e '/usr/local/cuda-11/bin/nvcc' + # Report result reportResults From 58ae521c84a715d1856bbe05473f621e56015c68 Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Tue, 26 Sep 2023 23:29:00 +0000 Subject: [PATCH 08/11] fix wrong scenario name --- test/nvidia-cuda/scenarios.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/nvidia-cuda/scenarios.json b/test/nvidia-cuda/scenarios.json index 1993dcd96..3018330e2 100644 --- a/test/nvidia-cuda/scenarios.json +++ b/test/nvidia-cuda/scenarios.json @@ -1,10 +1,12 @@ { - "install_cudnn_nvxt": { + "install_all_options": { "image": "debian", "features": { "nvidia-cuda": { "installCudnn": true, - "installNvtx": true + "installCudnnDev": true, + "installNvtx": true, + "installToolkit": true } } }, @@ -19,4 +21,4 @@ } } } -} \ No newline at end of file +} From 3ec682aaf94c700adb6901cde46fbe2077a75253 Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Wed, 27 Sep 2023 02:42:50 +0000 Subject: [PATCH 09/11] Revert "add specificaitons of new option" This reverts commit 0dcdb92406e38caa297643eab5af641f814b4f69. README.md should be generated by CI workflow. --- src/nvidia-cuda/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/nvidia-cuda/README.md b/src/nvidia-cuda/README.md index 71cdaf338..7a0343de4 100644 --- a/src/nvidia-cuda/README.md +++ b/src/nvidia-cuda/README.md @@ -16,10 +16,7 @@ Installs shared libraries for NVIDIA CUDA. | Options Id | Description | Type | Default Value | |-----|-----|-----|-----| | installCudnn | Additionally install CUDA Deep Neural Network (cuDNN) shared library | boolean | false | -| installCudnnDev | Additionally install CUDA Deep Neural Network (cuDNN) development libraries and headers | boolean | false | | installNvtx | Additionally install NVIDIA Tools Extension (NVTX) | boolean | false | -| installNvcc | Additionally install NVIDIA CUDA Compiler (NVCC) | boolean | false | -| installToolkit | Additionally install NVIDIA CUDA Compiler Toolkit | boolean | false | | cudaVersion | Version of CUDA to install | string | 11.8 | | cudnnVersion | Version of cuDNN to install | string | 8.6.0.163 | From 7ff1845806636bf56fc2300030de47f80a4cdae7 Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Wed, 27 Sep 2023 02:49:37 +0000 Subject: [PATCH 10/11] make cudnn-dev installation isolated --- src/nvidia-cuda/install.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/nvidia-cuda/install.sh b/src/nvidia-cuda/install.sh index c174c2a52..cb66d3955 100644 --- a/src/nvidia-cuda/install.sh +++ b/src/nvidia-cuda/install.sh @@ -58,7 +58,7 @@ fi echo "Installing CUDA libraries..." apt-get install -yq "$cuda_pkg" -if [ "$INSTALL_CUDNN" = "true" ] || [ "$INSTALL_CUDNNDEV" = "true" ]; then +if [ "$INSTALL_CUDNN" = "true" ]; then # Ensure that the requested version of cuDNN is available AND compatible cudnn_pkg_version="libcudnn8=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" if ! apt-cache show "$cudnn_pkg_version"; then @@ -66,13 +66,20 @@ if [ "$INSTALL_CUDNN" = "true" ] || [ "$INSTALL_CUDNNDEV" = "true" ]; then exit 1 fi - cudnn_dev_pkg_version="" - if [ "$INSTALL_CUDNNDEV" = "true" ]; then - cudnn_dev_pkg_version="libcudnn8-dev=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}" + echo "Installing cuDNN libraries..." + apt-get install -yq "$cudnn_pkg_version" +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 ! 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 fi - echo "Installing cuDNN libraries..." - apt-get install -yq "$cudnn_pkg_version" "$cudnn_dev_pkg_version" + echo "Installing cuDNN dev libraries..." + apt-get install -yq "$cudnn_dev_pkg_version" fi if [ "$INSTALL_NVTX" = "true" ]; then From 9cfcf6c2ff9415c23a54ab790b6d636961d1edc5 Mon Sep 17 00:00:00 2001 From: Masahiro Wada Date: Wed, 27 Sep 2023 02:53:19 +0000 Subject: [PATCH 11/11] dump minor version to 1.1.0 --- 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 fb202b084..78ad10cd9 100644 --- a/src/nvidia-cuda/devcontainer-feature.json +++ b/src/nvidia-cuda/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "nvidia-cuda", - "version": "1.0.7", + "version": "1.1.0", "name": "NVIDIA CUDA", "description": "Installs shared libraries for NVIDIA CUDA.", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/nvidia-cuda",