- Introduction
CUDA®is a parallel computing platform and programming model invented by NVIDIA. It enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU).
CUDA-capable GPUs have hundreds of cores that can collectively run thousands of computing threads. These cores have shared resources including a register file and a shared memory. The on-chip shared memory allows parallel tasks running on these cores to share data without sending it over the system memory bus.
This guide will show you how to install and check the correct operation of the CUDA development tools.
1.1 system requirement
To use CUDA on your system, you will need the following installed:
- CUDA-capable GPU
- A supported version of Linux with a gcc compiler and toolchain
NVIDIA CUDA Toolkit (available at http://developer.nvidia.com/cuda-downloads )
Pre-Installation Action
Some actions must be taken before the CUDA Toolkit and Driver can be installed on Linux:
- Verify the system has a CUDA-capable GPU.
- Verify the system is running a supported version of Linux.
- Verify the system has gcc installed.
- Verify the system has the correct kernel headers and development packages installed.
- Download the NVIDIA CUDA Toolkit.
- Handle conflicting installation methods.
2.1 Verify the system has a CUDA-capable GPU.
To verify that your GPU is CUDA-capable, go to your distribution's equivalent of System Properties, or, from the command line, enter:
$ lspci | grep -i nvidia
2.2 Verify You Have a Supported Version of Linux
The CUDA Development Tools are only supported on some specific distributions of Linux.
To determine which distribution and release number you're running, type the following at the command line:
$ uname -m && cat /etc/*release
2.3 Verify the system has gcc installed
To verify the version of gcc installed on your system, type the following on the command line:
$ gcc --version
2.4 Verify the System has the Correct Kernel Headers and Development Packages Installed
The version of the kernel your system is running can be found by running the following command:
$ uname -r
The kernel headers and development packages for the currently running kernel can be installed with:
$ sudo apt-get install linux-headers-$(uname -r)
- Installation
3.1 Update the Apt repository cache
$ sudo apt-get update
3.2. Install CUDA
$ sudo apt-get install cuda
installed in /usr/local
lrwxrwxrwx 1 root root 8 11월 20 00:50 cuda -> cuda-9.1/
drwxr-xr-x 15 root root 4096 11월 20 00:50 cuda-9.1
Post-Installation Action
- Environment Setup
ThePATHvariable needs to include/usr/local/cuda-9.1/bin
To add this path to thePATHvariable:
$ export PATH=/usr/local/cuda-9.1/bin${PATH:+:${PATH}}
In addition, when using the runfile installation method, theLD_LIBRARY_PATHvariable needs to contain/usr/local/cuda-9.1/lib64on a 64-bit system, or/usr/local/cuda-9.1/libon a 32-bit system
To change the environment variables for 64-bit operating systems:
$ export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib64\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
To change the environment variables for 32-bit operating systems:
$ export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Install Samples
samples 를 설치할 수 있는 스크립트를 제공한다.
$ cuda-install-samples-9.1.sh <dir>
Build Samples
~/NVIDIA_CUDA-9.1_Samples$make
Running The Binaries (ex : deviceQuery)
~/NVIDIA_CUDA-9.1_Samples/bin$./deviceQuery