Skip to content

Commit

Permalink
Merge branch 'devcontainers:main' into docker-outside-of-docker_#1120
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravsaini04 authored Sep 24, 2024
2 parents 697a720 + 1a6b715 commit c05af61
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/git-lfs/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "git-lfs",
"version": "1.2.2",
"version": "1.2.3",
"name": "Git Large File Support (LFS)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/git-lfs",
"description": "Installs Git Large File Support (Git LFS) along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like git and curl.",
Expand Down
26 changes: 15 additions & 11 deletions src/git-lfs/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,33 @@ find_version_from_git_tags() {

# Get the list of GPG key servers that are reachable
get_gpg_key_servers() {
declare -A keyservers_curl_map=(
["hkp://keyserver.ubuntu.com"]="http://keyserver.ubuntu.com:11371"
["hkp://keyserver.ubuntu.com:80"]="http://keyserver.ubuntu.com"
["hkps://keys.openpgp.org"]="https://keys.openpgp.org"
["hkp://keyserver.pgp.com"]="http://keyserver.pgp.com:11371"
)

local curl_args=""
local keyserver_reachable=false # Flag to indicate if any keyserver is reachable

if [ ! -z "${KEYSERVER_PROXY}" ]; then
curl_args="--proxy ${KEYSERVER_PROXY}"
fi

for keyserver in "${!keyservers_curl_map[@]}"; do
local keyserver_curl_url="${keyservers_curl_map[${keyserver}]}"
if curl -s ${curl_args} --max-time 5 ${keyserver_curl_url} > /dev/null; then
test_keyserver() {
local keyserver="$1"
local keyserver_curl_url="$2"
if curl -s ${curl_args} --max-time 5 "${keyserver_curl_url}" > /dev/null; then
echo "keyserver ${keyserver}"
keyserver_reachable=true
else
echo "(*) Keyserver ${keyserver} is not reachable." >&2
fi
done
}

# Explicitly test these in order because Bash v4.4.20 (Ubuntu Bionic)
# enumerates associative array keys in a different order than Bash v5
test_keyserver "hkp://keyserver.ubuntu.com" "http://keyserver.ubuntu.com:11371"
test_keyserver "hkp://keyserver.ubuntu.com:80" "http://keyserver.ubuntu.com"
test_keyserver "hkp://keyserver.pgp.com" "http://keyserver.pgp.com:11371"
# Test this server last because keys.openpgp.org strips user IDs from keys unless
# the owner gives permission, which causes gpg in Ubuntu Bionic to reject the key
# (https://github.com/devcontainers/features/issues/1055)
test_keyserver "hkps://keys.openpgp.org" "https://keys.openpgp.org"

if ! $keyserver_reachable; then
echo "(!) No keyserver is reachable." >&2
Expand Down
32 changes: 21 additions & 11 deletions 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.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",
Expand Down Expand Up @@ -28,6 +28,9 @@
"cudaVersion": {
"type": "string",
"proposals": [
"12.5",
"12.4",
"12.3",
"12.2",
"12.1",
"12.0",
Expand All @@ -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",
Expand All @@ -67,7 +70,14 @@
"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"
],
"default": "8.6.0.163",
"description": "Version of cuDNN to install"
Expand Down
20 changes: 18 additions & 2 deletions src/nvidia-cuda/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -69,7 +71,15 @@ apt-get install -yq "$cuda_pkg"

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 major cudnn version is 9, then we need to install libcudnn9-cuda-<major_version> package
#else we need to install libcudnn8-cuda-<major_version> package
if [[ $major_cudnn_version -ge "9" ]]
then
cudnn_pkg_version="libcudnn9-cuda-${major_cuda_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
Expand All @@ -81,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 -ge "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
Expand Down
16 changes: 16 additions & 0 deletions test/nvidia-cuda/install_cudnn_123_version.sh
Original file line number Diff line number Diff line change
@@ -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

16 changes: 16 additions & 0 deletions test/nvidia-cuda/install_cudnn_124_version.sh
Original file line number Diff line number Diff line change
@@ -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

16 changes: 16 additions & 0 deletions test/nvidia-cuda/install_cudnn_latest_version.sh
Original file line number Diff line number Diff line change
@@ -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

39 changes: 39 additions & 0 deletions test/nvidia-cuda/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}

0 comments on commit c05af61

Please sign in to comment.