Skip to content

Conversation

junpengdev
Copy link
Member

@junpengdev junpengdev commented May 28, 2025

Issue #, if available:

Install nvidia driver if nvidia GPU is detected.

Description of changes:
In this PR, I add a script nvidia-driver-install.sh to install nvidia drivers if nvidia GPU is detected. The script is part of cloud-init, and will be invoked when the instance is booted for first time. It can install drivers for amd64, arm64 across Ubuntu, RHEL, AL23.

Testing (if applicable):
Tested manually.

AMD 64

OS Result
Ubuntu 2004 pass
Ubuntu 2204 pass
Ubuntu 2404 pass
AmazonLinux 2023 pass
RHEL 8 pass
RHEL 9 pass

ARM 64

OS Result
Ubuntu 2004 pass
Ubuntu 2204 pass
Ubuntu 2404 pass
AmazonLinux 2023 pass
RHEL 8 pass
RHEL 9 pass

Documentation added/planned (if applicable):

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@junpengdev junpengdev force-pushed the install_nvidia_driver branch 2 times, most recently from 0021aac to 698b28e Compare May 29, 2025 22:14
# https://docs.nvidia.com/datacenter/tesla/driver-installation-guide/index.html#ubuntu-installation
# Install required packages
apt-get update
apt-get install -y linux-headers-$(uname -r)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we quote this and every time we substitute this to prevent word splitting?

Suggested change
apt-get install -y linux-headers-$(uname -r)
apt-get install -y "linux-headers-$(uname -r)"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that should be okay. I just extract uname -r into a variable.

@junpengdev junpengdev force-pushed the install_nvidia_driver branch from 4e28605 to a643c27 Compare June 10, 2025 18:40
@junpengdev junpengdev merged commit a15a442 into aws:main Jun 10, 2025
6 checks passed
@junpengdev junpengdev deleted the install_nvidia_driver branch June 10, 2025 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants