CUDA Driver API vs Runtime API

Changyeol Choi·2021년 1월 19일
0

GPU

목록 보기
2/4

Different CUDA version


Tue Jan 19 14:04:29 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.56       Driver Version: 418.56       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 208...  Off  | 00000000:65:00.0  On |                  N/A |
| 41%   35C    P8    20W / 250W |    454MiB / 10987MiB |      2%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce RTX 208...  Off  | 00000000:B6:00.0 Off |                  N/A |
| 41%   32C    P8     3W / 250W |      1MiB / 10989MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1337      G   /usr/lib/xorg/Xorg                            18MiB |
|    0      1392      G   /usr/bin/gnome-shell                          58MiB |
|    0      1595      G   /usr/lib/xorg/Xorg                           137MiB |
|    0      1707      G   /usr/bin/gnome-shell                         140MiB |
|    0      2248      G   ...AAAAAAAAAAAIAAAAAAAAAA== --shared-files    98MiB |
+-----------------------------------------------------------------------------+
$ nvcc --version

Command 'nvcc' not found, but can be installed with:

sudo apt install nvidia-cuda-toolkit

위 처럼 driver version과 CUDA버전을 확인 할 수 있는데 이 경우 nvcc -V 명령이 안먹는 경우가 있다.

CUDA has 2 primary APIs, the runtime and the driver API. Both have a corresponding version (e.g. 8.0, 9.0, etc.)

The necessary support for the driver API (e.g. libcuda.so on linux) is installed by the GPU driver installer.

The necessary support for the runtime API (e.g. libcudart.so on linux, and also nvcc) is installed by the CUDA toolkit installer (which may also have a GPU driver installer bundled in it).

In any event, the (installed) driver API version may not always match the (installed) runtime API version, especially if you install a GPU driver independently from installing CUDA (i.e. the CUDA toolkit).

(발췌) https://stackoverflow.com/questions/53422407/different-cuda-versions-shown-by-nvcc-and-nvidia-smi

sudo apt install nvidia-cuda-toolkit

이 경우는 PATH가 빠진 것으로 /usr/local/폴더에 cuda가 있는지 확인해 보자. SDK Manager를 통해 CUDA 10.0을 설치 했으므로 /usr/local/cuda-10.0 폴더가 존재 한다. /usr/local/cuda-10.0/bin 폴더에 nvcc명령도 있는 것을 확인 할 수 있다. 즉 .bashrc에 PATH환경 설정을 해주면 된다.
export PATH=/usr/local/cuda-10.0/bin:/usr/local/cuda-10.0/NsightCompute-2019.1{PATH:+:{PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64{LD_LIBRARY_PATH:+:{LD_LIBRARY_PATH}}

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
wget https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
(nvidia install 가이드 순서가 바뀌어 있음)
sudo apt-key add /var/cuda-repo-10-1-local-10.1.243-418.87.00/7fa2af80.pub
sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
sudo apt-get update
sudo apt-get -y install cuda

Errors were encountered while processing:
/tmp/apt-dpkg-install-hiPrxn/30-libcublas-dev_10.2.1.243-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

profile
10년 후...내 모습을 위한 첫걸음

0개의 댓글