Software & AppsOperating SystemLinux

How To Install CUDA Toolkit Version 11.6 in Ubuntu 18.04 When Latest in Repos is 9.1

Ubuntu 8

In this article, we will guide you through the process of installing CUDA Toolkit version 11.6 on Ubuntu 18.04. The latest CUDA Toolkit version available in the Ubuntu repositories is 9.1, but for various reasons, you might need to install a newer version. Let’s get started!

What is CUDA?

CUDA, or Compute Unified Device Architecture, is a parallel computing platform and application programming interface (API) model created by NVIDIA. It allows developers to use a CUDA-enabled graphics processing unit (GPU) for general purpose processing – an approach termed GPGPU (General-Purpose computing on Graphics Processing Units).

Why Install CUDA Toolkit Version 11.6?

The CUDA Toolkit includes GPU-accelerated libraries, a compiler, development tools, and the CUDA runtime. It is designed to work with programming languages like C, C++, and Fortran. The latest version, 11.6, provides several new features and improvements over the older version available in the Ubuntu repositories.

Prerequisites

Before we begin, please ensure that you have a CUDA-capable GPU and a compatible version of Linux. You can check whether your GPU is CUDA-capable here.

Installation Steps

Step 1: Add the CUDA Repository

First, we will add the CUDA repository to our system. This will allow us to install the latest version of the CUDA Toolkit.

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600

In these commands, wget is used to download the repository pin file, and mv is used to move the downloaded file to the /etc/apt/preferences.d/ directory.

Step 2: Download the CUDA Repository Package

Next, we will download the CUDA repository package for version 11.6.

wget https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda-repo-ubuntu1804-11-6-local_11.6.0-510.39.01-1_amd64.deb

Step 3: Install the CUDA Repository Package

Now, we will install the downloaded CUDA repository package using the dpkg command.

sudo dpkg -i cuda-repo-ubuntu1804-11-6-local_11.6.0-510.39.01-1_amd64.deb

Step 4: Add the CUDA Repository Key

We need to add the CUDA repository key to our system. This ensures that the packages we install are authentic and have not been tampered with.

sudo apt-key add /var/cuda-repo-ubuntu1804-11-6-local/7fa2af80.pub

Step 5: Update the Package List

Before we can install the CUDA Toolkit, we need to update the package list on our system.

sudo apt-get update

Step 6: Install the CUDA Toolkit

Finally, we can install the CUDA Toolkit using the apt-get command.

sudo apt-get -y install cuda

Verifying the Installation

After the installation is complete, you can verify that the correct version of the CUDA Toolkit is installed by checking the version of nvcc, the CUDA compiler.

nvcc --version

If the installation was successful, you should see output similar to the following:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Fri_Dec_17_18:16:03_PST_2021
Cuda compilation tools, release 11.6, V11.6.55
Build cuda_11.6.r11.6/compiler.30794723_0

Conclusion

In this article, we have guided you through the process of installing CUDA Toolkit version 11.6 on Ubuntu 18.04. We hope that this guide has been helpful to you. If you have any questions or run into any issues, please feel free to leave a comment below.

Can I install CUDA Toolkit version 11.6 on Ubuntu 18.04 even though the latest version in the repositories is 9.1?

Yes, you can install CUDA Toolkit version 11.6 on Ubuntu 18.04 by following the steps outlined in this guide.

What are the prerequisites for installing CUDA Toolkit version 11.6?

Before installing CUDA Toolkit version 11.6, you need to have a CUDA-capable GPU and a compatible version of Linux. You can check if your GPU is CUDA-capable by visiting the NVIDIA website provided in the prerequisites section of this guide.

How do I add the CUDA repository to my system?

To add the CUDA repository, you need to download the repository pin file using the wget command and then move the downloaded file to the /etc/apt/preferences.d/ directory using the mv command. The specific commands are provided in Step 1 of the installation steps.

What is the purpose of adding the CUDA repository key?

Adding the CUDA repository key ensures that the packages you install from the repository are authentic and haven’t been tampered with. It is an important security measure.

How can I verify the installation of CUDA Toolkit version 11.6?

After the installation is complete, you can verify it by checking the version of nvcc, the CUDA compiler, using the nvcc --version command. The expected output is provided in Step 6 of the installation steps.

Leave a Comment

Your email address will not be published. Required fields are marked *