We are going to teach you How to Install and Use CUDA on Debian 11. CUDA is a parallel computing platform and programming model developed by NVIDIA. CUDA enables developers to use the power of GPUs to implement parallel programming and process complex and massive calculations much faster.

Introduction To CUDA

CUDA has been widely used in accelerating high-performance computing (HPC) and research applications in consumer and industrial ecosystems. Thousands of GPU-accelerated applications have been built on the NVIDIA CUDA parallel computing platform, giving CUDA flexibility and scheduling of the platform of choice for research and deployment of new deep learning algorithms and parallel computing.

Prerequisites to Install CUDA on Debian 11

1. A Linux VPS Server with Debian 11 OS

1. Install the GPU Computing Platform (GPGPU (General-Purpose computing on Graphics Processing Units)) for CUDA (Compute Unified Device Architecture) provided by NVIDIA.

2. NVIDIA graphics card from CUDA-Enabled

How to Install NVIDIA Graphics Driver

If your computer has an NVIDIA graphics card, install the NVIDIA Graphic Driver to improve graphics performance.

install-nvidia-driver - CUDA on Debian 11

After installation, restart the computer to load the default general driver into the new NVIDIA driver.

vi /etc/apt/sources.list

Then, you should add [non-free] to the main line. also if contrib is not set, add it, too as the following commands:

deb http://deb.debian.org/debian/ bullseye main contrib non-free

If your card is before the GeForce 600 series or similar products, install [nvidia-legacy-390xx-driver] using the following command:

apt update
apt -y install nvidia-driver firmware-misc-nonfree

Disable the default nouveau driver using the following command:

cat /etc/modprobe.d/nvidia-blacklists-nouveau.conf

After editing the file, you must run “update-initramfs -u“. Finally, you can reboot the system using the following command:

reboot

Confirm the installation to display the status of the graphics card. Using the following command:

nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.91.03    Driver Version: 460.91.03    CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 106...  On   | 00000000:05:00.0 Off |                  N/A |
|  0%   43C    P8     6W / 120W |      1MiB /  6078MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

How to Install CUDA on Debian 11

Before starting How to Install CUDA on Debian 11, it is necessary to install NVIDIA Graphics Driver by running the following command. Therefore, it is necessary to perform the following steps in order.

By default, you add the words [contrib non-free] to the following command in the APT source, as in the previous step:

apt -y install nvidia-cuda-toolkit nvidia-cuda-dev
nvcc --version

In the next step, you should verify the installation with a common user to run a sample program using the following command:

git clone https://github.com/zchee/cuda-sample.git
cd ./cuda-sample/1_Utilities/deviceQuery
/cuda-sample/1_Utilities/deviceQuery$ vi Makefile

Now you should change line 37 as follow:

CUDA_PATH?=/usr

you should also change line 192 as follow:

SMS ?= 70

compile the device query sample using the following command:

/cuda-sample/1_Utilities/deviceQuery$ make

run the deviceQuery sample using the following command:

/cuda-sample/1_Utilities/deviceQuery$ ./deviceQuery
./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

It should be noted that you should try to run a bandwidth test sample using the following command:

cd ~/cuda-sample/1_Utilities/bandwidthTest
/cuda-sample/1_Utilities/bandwidthTest$ vi Makefile

Again you need to change line 37 as follows:

CUDA_PATH?=/usr

change line 192 as follows:

SMS ?= 70
/cuda-sample/1_Utilities/bandwidthTest$ make
/cuda-sample/1_Utilities/bandwidthTest$ ./bandwidthTest

Conclusion

At the beginning of this article, we explained the prerequisites for installing CUDA on Debian. Then we taught you how to install NVIDIA. This article taught you how to install and Use CUDA on Debian 11. CUDA on Debian 11 is now ready to use. We hope you find this article useful. Share your comments with us via the form below.

Rate this post