To install the correct NVIDIA drivers for your NVIDIA RTX 5090 on Ubuntu while ensuring CUDA support for AI generation tasks, you need to follow a systematic process. Below is a step-by-step guide:
1. Verify Your GPU and System
Before proceeding, confirm that your system recognizes the NVIDIA RTX 5090 GPU:
lspci | grep -i nvidia
This command should list your GPU. If it doesn't appear, ensure the GPU is properly connected and recognized by your motherboard.
2. Update Your System
Ensure your system is up-to-date:
sudo apt update && sudo apt upgrade -y
3. Add the NVIDIA PPA (Optional but Recommended)
The official Ubuntu repositories may not always have the latest NVIDIA drivers. To get the most up-to-date drivers, add the NVIDIA PPA:
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
4. Identify the Correct Driver Version
To check which driver version is recommended for your GPU:
- Visit the NVIDIA Driver Downloads page.
- Enter your GPU details (RTX 5090 in this case).
- Note the recommended driver version.
Alternatively, you can use the following command to see available drivers for your GPU:
ubuntu-drivers devices
This will list the recommended driver version for your GPU.
5. Install the NVIDIA Driver
Install the recommended driver version. For example, if the recommended version is 535:
sudo apt install nvidia-driver-535
Replace 535 with the version number identified in the previous step.
6. Reboot Your System
After installing the driver, reboot your system to apply the changes:
sudo reboot
7. Verify the Driver Installation
Once the system reboots, verify that the NVIDIA driver is active:
nvidia-smi
This command should display details about your GPU, including the driver version and CUDA version. If it works, the driver installation was successful.
8. Install CUDA Toolkit
To use the CUDA cores for AI generation tasks, you need to install the CUDA toolkit. Follow these steps:
Option A: Install CUDA via NVIDIA's Official Repository
- Download the CUDA toolkit installer from the NVIDIA CUDA Toolkit page.
- Select your platform (Linux > x86_64 > Ubuntu > your version).
- Follow the instructions provided by NVIDIA for installation.
Option B: Install CUDA via Ubuntu's Package Manager
You can install CUDA directly using apt:
sudo apt install nvidia-cuda-toolkit
Verify the installation:
nvcc --version
This should display the installed CUDA version.
9. Install cuDNN (Optional but Recommended for AI Tasks)
cuDNN is a library for deep neural networks optimized for NVIDIA GPUs. To install it:
- Visit the NVIDIA cuDNN page.
- Download the appropriate version for your CUDA toolkit.
- Follow the installation instructions provided by NVIDIA.
10. Test Your Setup
To ensure everything is working correctly, run a simple CUDA test:
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
If the output shows "Result = PASS," your CUDA setup is functioning correctly.
11. Install AI Frameworks (Optional)
For AI generation tasks, you may need frameworks like TensorFlow or PyTorch. Install them using pip:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install tensorflow
Ensure you select the correct CUDA version (cu118 in this example corresponds to CUDA 11.8).
Final Notes
- Always ensure compatibility between your NVIDIA driver, CUDA toolkit, and AI frameworks.
- If you encounter issues, consult the NVIDIA Forums or Ubuntu community for troubleshooting.
By following these steps, you will have a fully functional NVIDIA RTX 5090 setup with CUDA support for AI generation tasks on Ubuntu.
Boxed Final Answer:
1. Update your system: `sudo apt update && sudo apt upgrade -y`.
2. Add the NVIDIA PPA: `sudo add-apt-repository ppa:graphics-drivers/ppa && sudo apt update`.
3. Install the recommended NVIDIA driver: `sudo apt install nvidia-driver-<version>`.
4. Reboot: `sudo reboot`.
5. Install CUDA toolkit: `sudo apt install nvidia-cuda-toolkit` or download from NVIDIA's website.
6. Optionally, install cuDNN for deep learning tasks.
7. Test your setup with `nvidia-smi` and CUDA samples.