$ pip install tensorflow-gpu==1.8.0
$ pip list
```terminal
$ sudo apt-get update```
CUDA 버전 | Driver |
---|---|
CUDA 9.2 | 396.XX |
CUDA 9.1 | 387.XX |
CUDA 9.0 | 384.XX |
CUDA 8.0 (GA2) | 375.XX |
CUDA 8.0 | 367.4X |
CUDA 7.5 | 352.XX |
CUDA 7.0 | 346.XX |
$ sudo apt-get install nvidia-384 nvidia-modprobe
그 뒤 리부트 하면서 BIOS로 진입한 뒤, Secure Boot을 disable해준다.nvidia-smi
를 입력하면 아래와 같이 나오는 것을 확인 할 수 있다. Wed Apr 11 23:34:18 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.111 Driver Version: 384.111 |
|-------------------------------+----------------------+----------------------+
| 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 GTX 1060 Off | 00000000:01:00.0 Off | N/A |
| N/A 60C P5 8W / N/A | 242MiB / 6072MiB | 3% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1003 G /usr/lib/xorg/Xorg 177MiB |
| 0 1646 G compiz 60MiB |
| 0 2230 G /usr/lib/firefox/firefox 1MiB |
+-----------------------------------------------------------------------------+
$ wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run
$ chmod +x cuda_9.0.176_384.81_linux-run
$ ./cuda_9.0.176_384.81_linux-run --extract=$HOME
$ sudo ./cuda-linux.9.0.176-22781540.run
$ sudo ./cuda-samples.9.0.176-22781540-linux.run
$ sudo bash -c "echo /usr/local/cuda/lib64/ > /etc/ld.so.conf.d/cuda.conf"
$ sudo ldconfig
/etc/environment
에 /usr/local/cuda/bin
를 추가해주는 것으로 환경 변수 설정을 할 수 있다. 이를 위해 재부팅한 뒤 $ sudo nano /etc/environment
를 통해 들어간 뒤, PATH="/어쩌고:/어쩌고/어쩌고" 되어있는것의 "" 안에 :를 포함해서 :/usr/local/cuda/bin
을 추가해준다.$ cd /usr/local/cuda-9.0/samples
$ sudo make
$ cd /usr/local/cuda/samples/bin/x86_64/linux/release
$ ./deviceQuery
그러면 아래와 같은 결과가 나오고 자신의 그래픽카드의 이름을 확인한 뒤 마지막 result에 Pass가 있을을 확인한다../deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 1060"
CUDA Driver Version / Runtime Version 9.0 / 9.0
CUDA Capability Major/Minor version number: 6.1
Total amount of global memory: 6073 MBytes (6367739904 bytes)
(10) Multiprocessors, (128) CUDA Cores/MP: 1280 CUDA Cores
GPU Max Clock rate: 1671 MHz (1.67 GHz)
Memory Clock rate: 4004 Mhz
Memory Bus Width: 192-bit
L2 Cache Size: 1572864 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 2048
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 2 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Supports Cooperative Kernel Launch: Yes
Supports MultiDevice Co-op Kernel Launch: Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.0, CUDA Runtime Version = 9.0, NumDevs = 1
Result = PASS
$ sudo dpkg -i libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
$ sudo dpkg -i libcudnn7-dev_7.00.5.15-1+cuda9.0_amd64.deb
$ sudo dpkg -i libcudnn7-doc_7.0.5.15-1+cuda9.0_amd64.deb
$ cp -r /usr/src/cudnn_samples_v7/ ~
$ cd ~/cudnn_samples_v7/mnistCUDNN
$ make clean && make
$ ./mnistCUDNN
Test passed!
를 확인할 수 있다. export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64"