- Hands-On GPU:Accelerated Computer Vision with OpenCV and CUDA
- Bhaumik Vaidya
- 302字
- 2021-08-13 15:48:18
Linux
This section covers the steps to install CUDA on Linux distributions. In this section, the installation of CUDA in Ubuntu, which is a popular Linux distribution, is discussed using distribution-specific packages or using the apt-get command (which is specific to Ubuntu).
The steps to install CUDA using the *.deb installer downloaded from the CUDA website are as follows:
- Open Terminal and run the dpkg command, which is used to install packages in Debian-based systems:
sudo dpkg -i cuda-repo-<distro>_<version>_<architecture>.deb
- Install the CUDA public GPG key using the following command:
sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub
- Then, update the apt repository cache using the following command:
sudo apt-get update
- Then you can install CUDA using the following command:
sudo apt-get install cuda
- Include the CUDA installation path in the PATH environment variable using the following command:
export PATH=/usr/local/cuda-x.x/bin${PATH:+:${PATH}}
- Set the LD_LIBRARY_PATH environment variable:
export LD_LIBRARY_PATH=/usr/local/cuda-x.x/lib64\
${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
You can also install the CUDA toolkit by using the apt-get package manager, available with Ubuntu OS. You can run the following command in Terminal:
sudo apt-get install nvidia-cuda-toolkit
To check whether the CUDA GPU compiler has been installed, you can run the nvcc -V command from Terminal. It calls the GCC compiler for C code and the NVIDIA PTX compiler for the CUDA code.
You can install the NVIDIA Nsight Eclipse plugin, which will give the GUI Integrated Development Environment for executing CUDA programs, using the following command:
sudo apt install nvidia-nsight
After installation, you can run the deviceQuery project located at ~/NVIDIA_CUDA-x.x_Samples. If the CUDA toolkit is installed and configured correctly, the output for deviceQuery should look similar to the following:

- C# 7 and .NET Core Cookbook
- Objective-C應用開發全程實錄
- 跟“龍哥”學C語言編程
- Apache Spark 2 for Beginners
- 新手學Visual C# 2008程序設計
- INSTANT Mercurial SCM Essentials How-to
- Python Web數據分析可視化:基于Django框架的開發實戰
- UI設計全書(全彩)
- Programming Microsoft Dynamics? NAV 2015
- IDA Pro權威指南(第2版)
- AutoCAD基礎教程
- Visual Basic語言程序設計上機指導與練習(第3版)
- MongoDB Cookbook
- Java 7 Concurrency Cookbook
- Oracle SOA Suite 12c Administrator's Guide