티스토리 뷰
Tensorflow for R GPU installation on Ubuntu16.04
<출처>
https://tensorflow.rstudio.com/installation_gpu.html
https://www.tensorflow.org/install/install_linux
http://docs.nvidia.com/cuda/cuda-installation-guide-linux/#axzz4VZnqTJ2A
https://developer.nvidia.com/cudnn
<함께보기>
Tensorflow-GPU 설치 on Ubuntu16.04
1 “CUDA® Toolkit 8.0” Installation
http://docs.nvidia.com/cuda/cuda-installation-guide-linux/#axzz4VZnqTJ2A
1.1 Pre-Installation actions.
1.1.1 Verify You Have a CUDA-Capable GPU
$ lspci | grep -i nvidia
22:00.0 VGA compatible controller: NVIDIA Corporation Device 1c82 (rev a1)
22:00.1 Audio device: NVIDIA Corporation Device 0fb9 (rev a1)
If your graphics card is from NVIDIA and it is listed in http://developer.nvidia.com/cuda-gpus, your GPU is CUDA-capable.
1.1.2 Verify You Have a Supported Version of Linux
$ uname -m && cat /etc/*release
x86_64
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
NAME="Ubuntu"
VERSION="16.04.3 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.3 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
1.1.3 Verify the System Has gcc Installed
$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1.1.4 Verify the System has the Correct Kernel Headers and Development Packages Installed
$ sudo apt-get install linux-headers-$(uname -r)
1.1.5 Choose an Installation Method
I do “Package Manager Installation”
1.2 Installation
1.2.1 Disabling Nouveau
- Create a file at “/etcmodprobe.d/blacklist-nouveau.conf” with the following contents:
blacklist nouveau
options nouveau modeset=0
- Regenerate the kernel initramfs:
$ sudo update-initramfs -u
1.2.2 Download File
https://developer.nvidia.com/cuda-80-ga2-download-archive
Download local base installer
1.2.3 Installation Instructions:
$ sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-8.0.61-1/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get install cuda-8-0
1.3 Post-installation Actions
1.3.1 Environment Setup
$ cd ~
$ gedit .bashrc
Add the followings:
export CUDA_HOME=/usr/local/cuda-8.0
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64
2 “cuDNN v6.0” Installation
https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v6/prod/Doc/cudnn_install-txt
2.1 Downloads
https://developer.nvidia.com/rdp/cudnn-download
Download followings :
Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0
- cuDNN v6.0 Runtime Library for Ubuntu16.04 (Deb)
- cuDNN v6.0 Developer Library for Ubuntu16.04 (Deb)
- cuDNN v6.0 Code Samples and User Guide for Ubuntu16.04 (Deb)
2.2 Installation
$ sudo dpkg -i libcudnn6_6.0.21-1+cuda8.0_amd64.deb
$ sudo dpkg -i libcudnn6-dev_6.0.21-1+cuda8.0_amd64.deb
$ sudo dpkg -i libcudnn6-doc_6.0.21-1+cuda8.0_amd64.deb
3 “libcupti-dev” Library Installation
$ sudo apt-get install libcupti-dev
4 Installing with native pip
4.1 Installing pip and python
$ sudo apt-get install python-pip python-dev
4.2 Upgrading pip
$ sudo pip install --upgrade pip
5 Installing R
5.1 Editing “/etc/apt/sources.list” file
$ sudo gedit /etc/apt/sources.list
Add an Entry like:
deb https://cloud.r-project.org/bin/linux/ubuntu xenial/
5.2 Installing R
$ sudo apt-get update
$ sudo apt-get install r-base r-base-dev
6 Installing Tensorflow for R
https://tensorflow.rstudio.com/installation_gpu.html
$ R
R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R은 자유 소프트웨어이며, 어떠한 형태의 보증없이 배포됩니다.
또한, 일정한 조건하에서 이것을 재배포 할 수 있습니다.
배포와 관련된 상세한 내용은 'license()' 또는 'licence()'을 통하여 확인할 수 있습니다.
R은 많은 기여자들이 참여하는 공동프로젝트입니다.
'contributors()'라고 입력하시면 이에 대한 더 많은 정보를 확인하실 수 있습니다.
그리고, R 또는 R 패키지들을 출판물에 인용하는 방법에 대해서는 'citation()'을 통해 확인하시길 부탁드립니다.
'demo()'를 입력하신다면 몇가지 데모를 보실 수 있으며, 'help()'를 입력하시면 온라인 도움말을 이용하실 수 있습니다.
또한, 'help.start()'의 입력을 통하여 HTML 브라우저에 의한 도움말을 사용하실수 있습니다
R의 종료를 원하시면 'q()'을 입력해주세요.
>
> install.packages("tensorflow")
> library(tensorflow)
> install_tensorflow(version = "gpu")
7 Run a short TensorFlow for R program
library(tensorflow)
hello <- tf$constant('Hello, TensorFlow!')
sess <- tf$Session()
print(sess$run(hello))
## [1] "Hello, TensorFlow!"
'Tensorflow > Tensorflow for R' 카테고리의 다른 글
Recurrent Neural Network (ver.R) (0) | 2017.11.28 |
---|---|
Autoencoder (ver.R) (0) | 2017.10.01 |
Multilayer Perceptron (ver.R) (0) | 2017.09.30 |
Convolutional Neural Network (ver.R) (0) | 2017.08.14 |
단일신경망 Single Layer Neural Network (ver. R) (0) | 2017.06.24 |