AWS G5 instances are powered by NVIDIA A10G GPUs. There's no Nvidia driver and CUDA in default. The following steps show how to prepare the CUDA environment in AWS G5 instances under Ubuntu 24.04.
sudo apt update
sudo apt install -y ubuntu-drivers-common
sudo ubuntu-drivers install nvidia
sudo reboot
After the reboot, check if the driver works.
nvidia-smi
sudo apt nvidia-cuda-dev nvidia-cuda-toolkit nvidia-cuda-toolkit-gcc
NVIDIA cuDNN, short for CUDA Deep Neural Network library, is a highly optimized library for deep learning applications. It accelerates the training and inference of deep neural networks on NVIDIA GPUs.
sudo apt install nvidia-cudnn
sudo apt install build-essential cmake git unzip
Now, you can start to develop your CUDA applications on AWS G5 instances.