Skip to content

Commit

Permalink
[ubicloud] Add GPU runner image template
Browse files Browse the repository at this point in the history
Add nvidia-cuda-toolkit to the GPU image (#2)

Add nvidia-cuda-toolkit and cuda-drivers

cuda-12-4

add cudnn

add cudnn to env

just install cudnn
  • Loading branch information
enescakir committed Jun 12, 2024
1 parent ae13737 commit b320274
Show file tree
Hide file tree
Showing 4 changed files with 545 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ubicloud-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- ubuntu-20.04.arm64
- ubuntu-22.04
- ubuntu-22.04.arm64
- ubuntu-22.04.gpu
- ubuntu-minimal
image_suffix:
description: "Suffix for image name, if not provided the image version"
Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
"ubuntu-20.04.arm64" { 'Ubuntu2004-Readme.md' }
"ubuntu-22.04" { 'Ubuntu2204-Readme.md' }
"ubuntu-22.04.arm64" { 'Ubuntu2204-Readme.md' }
"ubuntu-22.04.gpu" { 'Ubuntu2204-Readme.md' }
"ubuntu-minimal" { 'Ubuntu2204-Readme.md' }
}
"Readme_Name=$ReadmeName" >> $env:GITHUB_ENV
Expand Down Expand Up @@ -250,6 +252,7 @@ jobs:
"ubuntu-20.04.arm64") image_name="github-ubuntu-2004-arm64" ;;
"ubuntu-22.04") image_name="github-ubuntu-2204-x64" ;;
"ubuntu-22.04.arm64") image_name="github-ubuntu-2204-arm64" ;;
"ubuntu-22.04.gpu") image_name="github-gpu-ubuntu-2204-x64" ;;
"ubuntu-minimal") image_name="github-ubuntu-minimal-x64" ;;
"ubuntu-postgres") image_name="postgres-ubuntu-2204-x64" ;;
esac
Expand Down
24 changes: 24 additions & 0 deletions images/ubuntu/scripts/ubicloud/nvidia-container-toolkit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -euo pipefail

# Inspired by: https://github.com/nv-gha-runners/vm-images/blob/main/linux/installers/nvidia-container-toolkit.sh

KEYRING="/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg"
APT="/etc/apt/sources.list.d/nvidia-container-toolkit.list"

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o "${KEYRING}"
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed "s#deb https://#deb [signed-by=${KEYRING}] https://#g" | \
sudo tee "${APT}"

sudo apt-get update

sudo apt-get install -y --no-install-recommends nvidia-container-toolkit

sudo rm -rf "${APT}" "${KEYRING}"

# Add nvidia runtime to docker and set as default
sudo nvidia-ctk runtime configure --runtime docker --set-as-default

sudo systemctl restart docker
docker info
21 changes: 21 additions & 0 deletions images/ubuntu/scripts/ubicloud/nvidia-driver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -euo pipefail

# Inspired by: https://github.com/nv-gha-runners/vm-images/blob/main/linux/installers/nvidia-driver.sh

# Source the helpers for use with the script
source $HELPER_SCRIPTS/etc-environment.sh

KEYRING=cuda-keyring_1.1-1_all.deb
ARCH=x86_64
#NV_DRIVER_VERSION=550
CUDA_TOOLKIT_VERSION=12-4

wget -q "https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/${ARCH}/${KEYRING}"
sudo dpkg --install "${KEYRING}"
sudo apt-get update

sudo apt-get -y install "cuda-${CUDA_TOOLKIT_VERSION}" "cudnn9-cuda-12"
prepend_etc_environment_path "/usr/local/cuda/bin"

sudo dpkg --purge "$(dpkg -f "${KEYRING}" Package)"
Loading

0 comments on commit b320274

Please sign in to comment.