Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/nvidia-cuda/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -10,14 +10,27 @@
"default": false,
"description": "Additionally install CUDA Deep Neural Network (cuDNN) shared library"
Comment thread
samruddhikhandale marked this conversation as resolved.
},
"installCudnnDev": {
"type": "boolean",
"default": false,
"description": "Additionally install CUDA Deep Neural Network (cuDNN) development libraries and headers"
},
"installNvtx": {
"type": "boolean",
"default": false,
"description": "Additionally install NVIDIA Tools Extension (NVTX)"
},
"installToolkit": {
"type": "boolean",
"default": false,
"description": "Additionally install NVIDIA CUDA Toolkit"
},
"cudaVersion": {
"type": "string",
"proposals": [
"12.2",
"12.1",
"12.0",
"11.8",
"11.7",
"11.6",
Expand All @@ -32,6 +45,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",
Expand Down
20 changes: 20 additions & 0 deletions src/nvidia-cuda/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ set -e
rm -rf /var/lib/apt/lists/*

INSTALL_CUDNN=${INSTALLCUDNN}
INSTALL_CUDNNDEV=${INSTALLCUDNNDEV}
INSTALL_NVTX=${INSTALLNVTX}
INSTALL_TOOLKIT=${INSTALLTOOLKIT}
CUDA_VERSION=${CUDAVERSION}
CUDNN_VERSION=${CUDNNVERSION}

Expand Down Expand Up @@ -47,6 +49,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/./-}"
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
Expand All @@ -67,11 +70,28 @@ if [ "$INSTALL_CUDNN" = "true" ]; then
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 dev libraries..."
apt-get install -yq "$cudnn_dev_pkg_version"
fi

if [ "$INSTALL_NVTX" = "true" ]; then
echo "Installing NVTX..."
apt-get install -yq "$nvtx_pkg"
fi

if [ "$INSTALL_TOOLKIT" = "true" ]; then
echo "Installing CUDA Toolkit..."
apt-get install -yq "$toolkit_pkg"
fi

# Clean up
rm -rf /var/lib/apt/lists/*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
samruddhikhandale marked this conversation as resolved.
check "cudnn.h" test 1 -eq "$(find /usr -name 'cudnn.h' | wc -l)"

# Check installation of cuda-nvtx-11-<version>
check "cuda-11+nvtx" test -e '/usr/local/cuda-11/targets/x86_64-linux/include/nvtx3'

# Check installation of cuda-nvcc-11-<version>
check "cuda-11+nvcc" test -e '/usr/local/cuda-11/bin/nvcc'

# Report result
reportResults
8 changes: 5 additions & 3 deletions test/nvidia-cuda/scenarios.json
Original file line number Diff line number Diff line change
@@ -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
}
}
},
Expand All @@ -19,4 +21,4 @@
}
}
}
}
}