Skip to content

Commit 05cf464

Browse files
Merge branch 'main' into patch-1
2 parents 9ea38b0 + d9c2de0 commit 05cf464

9 files changed

+74
-71
lines changed

src/nvidia-cuda/devcontainer-feature.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "nvidia-cuda",
3-
"version": "1.1.3",
3+
"version": "1.2.0",
44
"name": "NVIDIA CUDA",
55
"description": "Installs shared libraries for NVIDIA CUDA.",
66
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/nvidia-cuda",
@@ -48,6 +48,7 @@
4848
"cudnnVersion": {
4949
"type": "string",
5050
"proposals": [
51+
"automatic",
5152
"8.9.5.29",
5253
"8.9.4.25",
5354
"8.9.3.28",
@@ -79,7 +80,7 @@
7980
"9.3.0.75",
8081
"9.4.0.58"
8182
],
82-
"default": "8.6.0.163",
83+
"default": "automatic",
8384
"description": "Version of cuDNN to install"
8485
}
8586
},

src/nvidia-cuda/install.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,30 @@ apt-get update -yq
7474
cuda_pkg="cuda-libraries-${CUDA_VERSION/./-}"
7575
nvtx_pkg="cuda-nvtx-${CUDA_VERSION/./-}"
7676
toolkit_pkg="cuda-toolkit-${CUDA_VERSION/./-}"
77-
major_cudnn_version=$(echo "${CUDNN_VERSION}" | cut -d '.' -f 1)
78-
major_cuda_version=$(echo "${CUDA_VERSION}" | cut -d '.' -f 1)
7977
if ! apt-cache show "$cuda_pkg"; then
8078
echo "The requested version of CUDA is not available: CUDA $CUDA_VERSION"
8179
exit 1
8280
fi
8381

8482
echo "Installing CUDA libraries..."
8583
apt-get install -yq "$cuda_pkg"
84+
apt-get update -yq --fix-missing
85+
86+
# auto find recent cudnn version
87+
major_cuda_version=$(echo "${CUDA_VERSION}" | cut -d '.' -f 1)
88+
if [ "$CUDNN_VERSION" = "automatic" ]; then
89+
if [[ "$CUDA_VERSION" < "12.3" ]]; then
90+
CUDNN_VERSION=$(apt-cache policy libcudnn8 | grep "$CUDA_VERSION" | grep -Eo '^[^-1+]*' | sort -V | tail -n1 | xargs)
91+
else
92+
CUDNN_VERSION=$(apt-cache policy libcudnn9-cuda-$major_cuda_version | grep "Candidate" | awk '{print $2}' | grep -Eo '^[^-1+]*')
93+
fi
94+
fi
95+
major_cudnn_version=$(echo "${CUDNN_VERSION}" | cut -d '.' -f 1)
8696

8797
if [ "$INSTALL_CUDNN" = "true" ]; then
8898
# Ensure that the requested version of cuDNN is available AND compatible
89-
#if major cudnn version is 9, then we need to install libcudnn9-cuda-<major_version> package
90-
#else we need to install libcudnn8-cuda-<major_version> package
99+
#if major cudnn version is 9, then we need to install libcudnn9-cuda-<major_cuda_version>_<CUDNN_VERSION>-1 package
100+
#else we need to install libcudnn8_<CUDNN_VERSION>-1+cuda<CUDA_VERSION>" package
91101
if [[ $major_cudnn_version -ge "9" ]]
92102
then
93103
cudnn_pkg_version="libcudnn9-cuda-${major_cuda_version}=${CUDNN_VERSION}-1"
@@ -106,13 +116,14 @@ fi
106116

107117
if [ "$INSTALL_CUDNNDEV" = "true" ]; then
108118
# Ensure that the requested version of cuDNN development package is available AND compatible
119+
#if major cudnn version is 9, then we need to install libcudnn9-dev-cuda-<major_cuda_version>_<CUDNN_VERSION>-1 package
120+
#else we need to install libcudnn8-dev_<CUDNN_VERSION>-1+cuda<CUDA_VERSION>" package
109121
if [[ $major_cudnn_version -ge "9" ]]
110122
then
111123
cudnn_dev_pkg_version="libcudnn9-dev-cuda-${major_cuda_version}=${CUDNN_VERSION}-1"
112124
else
113125
cudnn_dev_pkg_version="libcudnn8-dev=${CUDNN_VERSION}-1+cuda${CUDA_VERSION}"
114126
fi
115-
116127
if ! apt-cache show "$cudnn_dev_pkg_version"; then
117128
echo "The requested version of cuDNN development package is not available: cuDNN $CUDNN_VERSION for CUDA $CUDA_VERSION"
118129
exit 1
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# # Check installation of libcudnn9-cuda-12 (9.4.0)
9+
check "libcudnn.so.9.5.0" test 1 -eq "$(find /usr -name 'libcudnn.so.9.5.0' | wc -l)"
10+
11+
# Check installation of cuda-nvtx-12-3 (12.3)
12+
check "cuda-12-3+nvtx" test -e '/usr/local/cuda-12.3/targets/x86_64-linux/include/nvtx3/'
13+
14+
# Report result
15+
reportResults
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# # Check installation of libcudnn9-cuda-12 (9.4.0)
9+
check "libcudnn.so.9.5.0" test 1 -eq "$(find /usr -name 'libcudnn.so.9.5.0' | wc -l)"
10+
11+
# Check installation of cuda-nvtx-12-4 (12.4)
12+
check "cuda-12-4+nvtx" test -e '/usr/local/cuda-12.4/targets/x86_64-linux/include/nvtx3/'
13+
14+
# Report result
15+
reportResults
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# # Check installation of libcudnn9-cuda-12 (9.4.0)
9+
check "libcudnn.so.9.5.0" test 1 -eq "$(find /usr -name 'libcudnn.so.9.5.0' | wc -l)"
10+
11+
# Check installation of cuda-nvtx-12-5 (12.5)
12+
check "cuda-12-5+nvtx" test -e '/usr/local/cuda-12.5/targets/x86_64-linux/include/nvtx3/'
13+
14+
# Report result
15+
reportResults

test/nvidia-cuda/install_cudnn_123_version.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

test/nvidia-cuda/install_cudnn_124_version.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

test/nvidia-cuda/install_cudnn_latest_version.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

test/nvidia-cuda/scenarios.json

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,47 +16,41 @@
1616
"nvidia-cuda": {
1717
"installCudnn": true,
1818
"installNvtx": true,
19-
"cudaVersion": "11.7",
20-
"cudnnVersion": "8.5.0.96"
19+
"cudaVersion": "11.7"
2120
}
2221
}
2322
},
24-
"install_cudnn_123_version": {
23+
"install_cuda_12_3_version": {
2524
"image": "debian",
2625
"features": {
2726
"nvidia-cuda": {
2827
"installCudnn": true,
29-
"installNvtx": true,
3028
"installCudnnDev": true,
31-
"installToolkit": true,
32-
"cudaVersion": "12.3",
33-
"cudnnVersion": "9.4.0.58"
29+
"installNvtx": true,
30+
"cudaVersion": "12.3"
3431
}
3532
}
3633
},
37-
"install_cudnn_124_version": {
34+
"install_cuda_12_4_version": {
3835
"image": "debian",
3936
"features": {
4037
"nvidia-cuda": {
4138
"installCudnn": true,
42-
"installNvtx": true,
4339
"installCudnnDev": true,
44-
"installToolkit": true,
45-
"cudaVersion": "12.4",
46-
"cudnnVersion": "9.4.0.58"
40+
"installNvtx": true,
41+
"cudaVersion": "12.4"
4742
}
4843
}
4944
},
50-
"install_cudnn_latest_version": {
45+
"install_cuda_12_5_version": {
5146
"image": "debian",
5247
"features": {
5348
"nvidia-cuda": {
5449
"installCudnn": true,
55-
"installNvtx": true,
5650
"installCudnnDev": true,
57-
"installToolkit": true,
51+
"installNvtx": true,
5852
"cudaVersion": "12.5",
59-
"cudnnVersion": "9.4.0.58"
53+
"cudnnVersion": "9.5.0.50"
6054
}
6155
}
6256
}

0 commit comments

Comments
 (0)