This guide is for advanced users. Scaleway does not provide official support for custom OS images. This documentation aims to offer guidance to expert users interested in creating their own GPU image setups. We encourage users to use our GPU OS 12 images, which are ready to use and maintained by Scaleway.
Installing NVIDIA drivers on Ubuntu 22.04
In this guide, we will walk you through the process of installing NVIDIA drivers for L4/L40S GPU Instances on a customized Ubuntu 22.04 image, adapted from the default OS image.
Before installation, it is important to identify the correct NVIDIA driver version for your system. You can check the recommended driver versions from the official NVIDIA drivers website.
Installing NVIDIA drivers
-
Install the NVIDIA repository key. You can follow instructions from the NVIDIA website to install the latest version of the key.
-
Update the command line defined in
/etc/default/grub
by adding the parameterpci=realloc
. This parameter ensures proper GPU detection and allocation. -
Enable the
scw-set-numa-node
service. This service is installed from the Scaleway ecosystem package. -
Install the necessary NVIDIA drivers using the package manager (apt-get):
sudo apt-get install nvidia-docker2 nvidia-headless-<version> nvidia-utils-<version>Replace
<version>
with the specific version number of the NVIDIA drivers compatible with your GPU model.TipWe recommend using Nvidia NGC Docker containers, such as CUDA or PyTorch. This eliminates the need to install CUDA and cuDNN separately. Only the NVIDIA driver and NVIDIA Docker are required. The NGC Docker images contain the correct versions of CUDA, cuDNN, etc. This approach offers several benefits:
- Ability to choose your preferred framework and version.
- Ready-to-use setup (CUDA, cuDNN, Python, etc.).
- Building your custom Docker image on top of Nvidia images.
- Portable code (Local, Instance, K8S/Slurm clusters).
- Up-to-date with the latest Nvidia fixes and optimizations.
-
After installation, confirm the drivers are working correctly by running:
sudo nvidia-smiThis command should display information about the installed NVIDIA GPU(s) and their status.
TipDepending on your specific requirements, you may need to perform additional configuration steps, such as setting environment variables or adjusting kernel parameters. Refer to the official NVIDIA documentation for guidance on these configurations.
Troubleshooting
If you encounter errors or issues during the installation process, consider the following troubleshooting steps:
- Check system logs (
dmesg
,/var/log/syslog
) for any error messages related to NVIDIA drivers. - Ensure the correct driver version is compatible with your GPU model.
- Verify that the NVIDIA repository is correctly added to your package manager’s sources list.
- Consult relevant documentation or forums for additional troubleshooting steps specific to your setup.