'Deep Learning/setup_related'에 해당되는 글 57건

  1. 2017.01.10 Up and running with Theano (GPU) + PyCUDA on Windows
  2. 2017.01.06 Keras, Theano and TensorFlow on Windows and Linux | GetToCode
  3. 2016.12.30 Introduction to deep learning in python and Matlab
  4. 2016.12.23 Install Torch, with help from NVIDIA.
  5. 2016.12.07 cuda gpu compute capability viersion check
  6. 2016.11.30 텐서플로우 0.12.0 RC0 윈도우 버전에서 웹 리소스(HTML, JS) 파일이 없어 텐서보드가 빈화면으로 출력되는 문제 해결
  7. 2016.11.26 caffe installation ref sites
  8. 2016.10.31 GTX1070+6700K 설치경험 1
  9. 2016.10.22 Tensorflow v0.10 installed from scratch on Ubuntu 16.04, CUDA 8.0RC+Patch, cuDNN v5.1 with a 1080GTX
  10. 2016.10.22 Ubuntu 16.04에 Tensorflow 설치하기
  11. 2016.10.22 텐서플로우 0.10 + 우분투 16.04 + CUDA 8.0 + 파이썬 3.5 설치
  12. 2016.10.19 Cuda 7.5 download (cuda_7.5.18_linux.run)
  13. 2016.10.19 Where is usr/local?
  14. 2016.10.18 Ubuntu 16.04 LTS 기반 TensorFlow 개발 환경 셋업 (with GPU) 1
  15. 2016.10.18 How to Get Korean (Hangul) Working on Ubuntu 16.04
  16. 2016.10.12 [Ubuntu]How do I install .run files?
  17. 2016.10.12 Linux Ubuntu 16.04 LTS 설치하기
  18. 2016.10.12 우분투 데스크탑 16.04 LTS(지니얼 제루스) 설치하기
  19. 2016.10.06 윈도우에 텐서플로우 with CPU를 위한 도커 설치
  20. 2016.10.05 Install Ubuntu 14.04 from bootable USB: Could not find kernel image: /isolinux/isolinux.cfg
  21. 2016.10.05 (텐서플로우 설치 1)우분투 14.04 NVIDIA 그래픽 드라이버 설치 및 cuda, cudnn 설치
  22. 2016.10.05 Windows 10 64bit Theano & Keras 설치방법
  23. 2016.10.05 Windows가 설치된 상태에서 리눅스를 설치하자! (멀티부팅)
  24. 2016.10.05 우분투 Ubuntu 14.04.1 설치
  25. 2016.10.05 Ubuntu우분투 14.04 설치
  26. 2016.09.07 [matconvnet] Error in executing ResNet 50
  27. 2016.09.07 atomicAdd(double *, double) has already been defined
https://lepisma.github.io/articles/2015/07/30/up-with-theano-and-cuda/

 

 

 

Up and running with Theano (GPU) + PyCUDA on Windows


Getting CUDA to work with python on Windows is really frustrating. Its not exactly hard, but is sure irritating when you start doing it. If you have ever tried it, you might be knowing that many possible combinations of compilers, cuda toolkit, python etc. don’t work.

This post describes the steps that I followed for a working setup of theano working with GPU acceleration and PyCUDA for general access to GPU from python. Hopefully, it will help if you haven’t found the sweet spot yet.

Setting up

Starting with my machine, it is a Pavilion DV6 7012tx Laptop with Nvidia GeForce GT 630m card. Right now its running Windows 10 x64. If you are already having cygwin or mingw based gcc in place, you might want to remove that since our scientific python stack will provide that.

1. Install Visual Studio

This is needed to get Nvidia’s CUDA compiler (nvcc) working. For choosing the version, go to the latest CUDA on Windows doc and see which version of visual studio the current CUDA toolkit supports.

At the time of writing, CUDA 7 was the latest release and Visual Studio 2013 was the latest supported version. You also don’t need to install 2008 or 2010 version of compiler for python. This will be taken care of later, just go with everything latest.

After installation, you don’t actually need to add cl.exe (usually in a directory like C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin, depending on your Visual Studio version) to PATH for theano since we will define this explicitly in .theanorc, but it is better to do this as many other tools might be using it.

2. Install CUDA toolkit

This should be easy, get the latest CUDA and install it. Keep the samples while installing, they are nice for checking if things are working fine.

3. Setup Python

This is where most of the trouble is. Its easy to get lost while setting up vanilla python for theano specially since you also are setting up gcc and related tools. The theano installation tutorial will bog you down in this phase if you don’t actually read it carefully. Most likely you would end up downloading lots of legacy Visual Studio versions and other stuff. We won’t be going that way.

Install a scientific python distribution like Anaconda. I haven’t tried setting up theano using other distributions but this should be one of the easier ways because of conda package manager. This really relieves you from setting up a separate mingw environment and handling commonly used libraries which are as easy as conda install boost in Anaconda.

If you feel Anaconda is a bit too heavy, try miniconda and adding basic packages like numpy on top of it.

Once you install Anaconda, install additional dependencies.

conda install mingw libpython

4. Install theano

Install theano using pip install theano and create a .theanorc file in your HOME directory with following contents.

[global]
floatX = float32
device = gpu

[nvcc]
flags=-LC:\Anaconda\libs
compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin

Make sure to change the path C:\Anaconda\libs according to your Anaconda install directory and compiler_bindir to the path with cl.exe in it.

5. Install PyCUDA

Best way to install PyCUDA is to get the Unofficial Windows Binaries by Christoph Gohlke here.

For quick setup, you can use pipwin which basically automates the process of installing Gohlke’s packages.

pip install pipwin
pipwin install pycuda

6. Testing it out

Theano

A very basic test is to simply import theano.

import theano
Using gpu device 0: GeForce GT 630M (CNMeM is disabled)

This should tell you if the GPU is getting used.

One error says that CUDA is installed, but device gpu is not available. For me, this was solved after installing mingw and libpython via conda since Anaconda doesn’t setup gcc along with it as it used to do earlier.

For a more extensive test, try the following snippet taken from theano docs.

from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy
import time

vlen = 10 * 30 * 768  # 10 x #cores x # threads per core
iters = 1000

rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], T.exp(x))
print f.maker.fgraph.toposort()
t0 = time.time()
for i in xrange(iters):
    r = f()
t1 = time.time()
print 'Looping %d times took' % iters, t1 - t0, 'seconds'
print 'Result is', r
if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]):
    print 'Used the cpu'
else:
    print 'Used the gpu'

You should see something like this.

Using gpu device 0: GeForce GT 630M (CNMeM is disabled)
[GpuElemwise{exp,no_inplace}(<CudaNdarrayType(float32, vector)>), HostFromGpu(GpuElemwise{exp,no_inplace}.0)]
Looping 1000 times took 1.42199993134 seconds
Result is [ 1.23178029  1.61879349  1.52278066 ...,  2.20771813  2.29967761
  1.62323296]
Used the gpu
PyCUDA

Here is a quick test snippet from the PyCUDA web page here

import pycuda.autoinit
import pycuda.driver as drv
import numpy

from pycuda.compiler import SourceModule
mod = SourceModule("""
__global__ void multiply_them(float *dest, float *a, float *b)
{
  const int i = threadIdx.x;
  dest[i] = a[i] * b[i];
}
""")

multiply_them = mod.get_function("multiply_them")

a = numpy.random.randn(400).astype(numpy.float32)
b = numpy.random.randn(400).astype(numpy.float32)

dest = numpy.zeros_like(a)
multiply_them(
        drv.Out(dest), drv.In(a), drv.In(b),
        block=(400,1,1), grid=(1,1))

print dest-a*b

Seeing an array of zeros ? Its working fine then.

Hopefully, this should give you a working pythonish CUDA setup using the latest versions of VS, Windows, Python etc.

Have something to say ?


| email | twitter
contact
Posted by uniqueone
,

https://gettocode.com/2016/12/02/keras-on-theano-and-tensorflow-on-windows-and-linux/
Posted by uniqueone
,
https://www.slideshare.net/mobile/imryki/introduction-to-deep-learning-in-python-and-matlab
Posted by uniqueone
,
http://www.nvidia.com/object/torch-library.html?ncid=so-twi-th-220
Posted by uniqueone
,

"Please note that each additional compute capability significantly increases your build time and binary size."

--> check at https://developer.nvidia.com/cuda-gpus


Posted by uniqueone
,

Cheehun Won 받는 사람 TensorFlow KR

 

 

텐서플로우 0.12.0 RC0 윈도우 버전에서 웹 리소스(HTML, JS) 파일이 없어 텐서보드가 빈화면으로 출력되는 문제가 발생하여 (PIP 설치 시에, Python 3.5, Anaconda)

소스를 받아서 필요한 웹리소스를 묶어 봤습니다. 첫 페이지에 모두 로딩 되는 것은 확인 했는데, 이게 필요한 모든 리소스를 묶었는지는 검증을 못 했습니다. 필요하신분께 도움이 되면 좋겠네요.

압축 파일 주소는 https://www.dropbox.com/s/hxekoifmbyvrl33/tensorboard.zip…...
이고,

압축풀 경로는 아나콘다 기준으로
Anaconda3\Lib\site-packages\tensorflow\tensorboard
폴더입니다.

감사합니다.

Posted by uniqueone
,

For installation follow instruction on this link, I have personally installed caffe from these instructions. https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide

Try this - http://www.pittnuts.com/2016/07/geforce-gtx-1080-cuda-8-0-ubuntu-16-04-caffe/

Posted by uniqueone
,

facebook / TensorFlow KR에서..

 

 

저는 GTX1070+6700K였는데 이렇게 해결했습니다.

1. 별도 HDD를 준비해서 우분투만 설치(UFEI설치X, 멀티부팅 사용 X)


2. 1070GPU를 아예 메인보드에서 뽑아버리고 CPU내장그래픽으로 우분투 16.02LTS를 설치한 후, NVIDIA 드라이버 설치(무한로그인 방지)

3. 컴을 끄고 1070설치후 CUDA8.0+CUDNN5.1 설치진행

(CUDA가 패치되어 우분투 16.02에 기본 설치된 GCC5.2로 빌드가능, GCC4.8로 설치하면 에러발생)

아래 깃허브 링크를 위주로 나머지 사이트의 설치방법들 참조하세요,

https://github.com/.../gtx1080.../blob/master/README.md

http://m.blog.naver.com/kjpark79/220781100554

https://www.google.co.kr/.../install-gpu-tensorflow.../amp/

제 경험을 적어보면 아래와 같습니다
1. 링크에는 CROSSTOOL파일을 열어 빌드경로룰 수정하라고 되어있는데 저는 CROSSTOOL.tpl 파일이더군요

2. CUDNN은 아래와 같이 설치후에 파일을 카피+권한설정해보시길

$ sudo tar -xzvf cudnn-8.0-linux-x64-v5.1.tgz
$ sudo cp cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

3. ./configure 실행시 설치된 경로나 드라이버 버전을 시스템기본값(엔터)으로 넘기지 말고 일일히 적어보세요 , 특히 gpu compatibility 어쩌고 부분에서 1060은 1070/1080과 넣어줘야할 값이 다릅니다

기타 anaconda나 pyENV는 설치하면 경로에러가 나서 그냥 파이썬2.7로 깡통으로 설치했습니다

저도 하도 설치가 안되서 (빌드부분 에러) 텐서플로우 HW구성, 설치해주는 대행업체를 하나 차려볼까 고민해봤을 정도입니다. 건투를 빕니다

Posted by uniqueone
,

https://marcnu.github.io/2016-08-17/Tensorflow-v0.10-installed-from-scratch-Ubuntu-16.04-CUDA8.0RC-cuDNN5.1-1080GTX/

Tensorflow v0.pdf


This post is not fit to me, however, it shows some guide.


Tensorflow v0.10 installed from scratch on Ubuntu 16.04, CUDA 8.0RC+Patch, cuDNN v5.1 with a 1080GTX

While Tensorflow has a great documentation, you have quite a lot of details that are not obvious, especially the part about setting up Nvidia libraries and installing Bazel as you need to read external install guides. There is also a CROSSTOOL change to make to fix an include directory issue. So here is a guide, explaining everything from scratch in a single page.

1. Installing Nvidia drivers

The first step is to get the latest Nvidia driver. While you can use apt-get to install the driver and CUDA, this causes a lot of issues with automatic updates and you need to purge everything to reinstall a new version. It is simpler to do everything manually.

Go to Nvidia’s download website and download the latest version of the driver, here for Linux 64-bit. In my case, NVIDIA-Linux-x86_64-367.35.run.

As drivers for graphic devices are running at a low level, you must exit the GUI with sudo service lightdm stop and set the RunLevel to 3 with the program init.

Then, move to the directory where you downloaded the .run file and run it. You will be asked to confirm several things, the pre-install of something failure, no 32-bit libraries and more. Just continue to the end. Once it is done, reboot.

sudo service lightdm stop
sudo init 3
sudo sh NVIDIA-Linux-x86_64-367.35.run
sudo reboot
Login loop issue after updates

Due to the manual installation, it seems that when you do Ubuntu updates, they may install the apt-get version of the driver. This causes a failure when you start the computer and login, you will get a black screen and go back to the login screen.

The solution is to enter the terminal with CTRL+ALT+F1 and reinstall the driver just like before. Note that you can get back to the GUI with Alt+F7 when you are in the terminal.

2. Installing CUDA

Install the Toolkit

It’s now time for CUDA. Go to the Nvidia CUDA website and create an account if you don’t already have one and log in (I think this is only required for RC versions of CUDA, which is the case currently for CUDA 8.0RC, an account is also required to download cuDNN).

Choose Linux > x86_64 > Ubuntu > 16.04 > runfile (local) and download the base installer and the patch. Ubuntu 16.04 uses GCC 5.4.0 as default C compiler, which caused an issue with CUDA 8.0RC, this is fixed with the patch.

The installer has 3 parts, a Nvidia driver, CUDA Toolkit and CUDA code samples. The Nvidia driver is usually outdated, that’s why we installed it before, say no when asked if you want to install the driver (in Nvidia’s install guide, they tell us to enter RunLevel 3, but this isn’t necessary if we don’t install the driver). Then, let everything as default, install the code samples to check your CUDA installation. To avoid an error about GCC 5.4.0, add --override. Then, once the installation is over, run the patch.

sudo sh cuda_8.0.27_linux.run --override
sudo sh cuda_8.0.27.1_linux.run

Update paths in .bashrc

The next part is to update CUDA_HOME, PATH and LD_LIBRARY_PATH. Move to your home folder and update .bashrc then reload .bashrc with the command source. For those who are not Linux experts, .bashrc is a file with user parameters that is launched when you login, you must reload it or restart the session for the changes to be active.

cd /home/username/
gedit .bashrc

At the bottom of the file, add the following lines and save:

export CUDA_HOME=/usr/local/cuda-8.0
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

You can then reload .bashrc and check that the paths have been properly modified.

source ~/.bashrc
echo $CUDA_HOME
echo $PATH
echo $LD_LIBRARY_PATH

(Optional) Check that CUDA is working

Then, you can check is CUDA is working by checking the version of nvcc the CUDA compiler and also by moving to the sample directory and compiling bandwidthTest.

nvcc --version
cd NVIDIA_CUDA-8.0_Samples/1_Utilities/bandwidthTest/
make
./bandwidthTest

You should get an output that looks like this:

[CUDA Bandwidth Test] - Starting… Running on…

Device 0: GeForce GTX 1080 Quick Mode

Host to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s)
33554432 12038.9

Device to Host Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s)
33554432 12832.1

Device to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s)
33554432 231046.9

Result = PASS

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

You can now move to cuDNN!

3. Installing cuDNN

Go to the Nvidia cuDNN website, login and download Download cuDNN v5.1 (August 10, 2016), for CUDA 8.0 RC > cuDNN v5.1 Library for Linux. Unzip the .tgz file and copy the files to the cuda-8.0 folder. Note that some of the .so files are links to the “real” .so file, by copying it, we duplicate the file, that way, when building Tensorflow from source, any cuDNN version will give libcudnn.so.5.1.5.

tar xvzf cudnn-8.0-linux-x64-v5.1.tgz
cd cuda
sudo cp include/cudnn.h /usr/local/cuda-8.0/include/
sudo cp lib64/* /usr/local/cuda-8.0/lib64/

That’s it. As you see, it is quite easy to add or remove cuDNN and replace it by another version of the library.

4. Installing Tensorflow

It’s now time to install Tensorflow from source as the official binaries are only for CUDA 7.5. We will install it for Python2.7.

Install dependencies

First, install some general dependancies.

sudo apt-get install python-pip python-numpy swig python-dev python-wheel

Install Bazel

Then install Bazel, a build tool from Google.

First, you need to download and install JDK 8.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

It’s now time to get Bazel.

echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install bazel
sudo apt-get upgrade bazel

Install Tensorflow itself

First, you must get the code from Github. You can either take the most recent master branch (lots of new commits) or the latest release branch (should be more stable, but still updated every few days). Here, we get branch r0.10.

git clone -b r0.10 https://github.com/tensorflow/tensorflow
cd tensorflow
Important: fix CROSSTOOL file

Edit the text file tensorflow/third_party/gpus/crosstool/CROSSTOOL and add cxx_builtin_include_directory: "/usr/local/cuda-8.0/include" as below.

  cxx_builtin_include_directory: "/usr/lib/gcc/"
  cxx_builtin_include_directory: "/usr/local/include"
  cxx_builtin_include_directory: "/usr/include"
  cxx_builtin_include_directory: "/usr/local/cuda-8.0/include"
  tool_path { name: "gcov" path: "/usr/bin/gcov" }

If you don’t do this, you will get an error that looks like this:

ERROR: /home/marcnu/Documents/tensorflow/tensorflow/contrib/rnn/BUILD:46:1: undeclared inclusion(s) in rule ‘//tensorflow/contrib/rnn:python/ops/_lstm_ops_gpu’:
this rule is missing dependency declarations for the following files included by ‘tensorflow/contrib/rnn/kernels/lstm_ops_gpu.cu.cc’:
‘/usr/local/cuda-8.0/include/cuda_runtime.h’
‘/usr/local/cuda-8.0/include/host_config.h’

‘/usr/local/cuda-8.0/include/curand_discrete2.h’.
nvcc warning : option ‘–relaxed-constexpr’ has been deprecated and replaced by option ‘–expt-relaxed-constexpr’.
nvcc warning : option ‘–relaxed-constexpr’ has been deprecated and replaced by option ‘–expt-relaxed-constexpr’.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use –verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 203.657s, Critical Path: 162.10s

You can now run the configure script. If you have only cuda 8.0, then leaving everything as default should be fine. I just provided the compute capability of my GPU, in my case 6.1.

./configure

Please specify the location of python. [Default is /usr/bin/python]:
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] N
No Google Cloud Platform support will be enabled for TensorFlow
Found possible Python library paths:
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
Please input the desired Python library path to use. Default is [/usr/local/lib/python2.7/dist-packages]

/usr/local/lib/python2.7/dist-packages
Do you wish to build TensorFlow with GPU support? [y/N] y
GPU support will be enabled for TensorFlow
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]:
Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]:
Please specify the location where CUDA toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
Please specify the Cudnn version you want to use. [Leave empty to use system default]:
Please specify the location where cuDNN library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
libcudnn.so resolves to libcudnn.5
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size.
[Default is: “3.5,5.2”]: 6.1
Setting up Cuda include
Setting up Cuda lib64
Setting up Cuda bin
Setting up Cuda nvvm
Setting up CUPTI include
Setting up CUPTI lib64
Configuration finished

You can then run Bazel. The build will take quite a lot of time, 900s on my PC. Then, create the pip package and install it with pip. The name of the pip package may be different depending of Tensorflow’s version.

bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip install /tmp/tensorflow_pkg/tensorflow-0.10.0-py2-none-any.whl

That’s it, Tensorflow is installed!

(Optional) Check that Tensorflow is working

You can create a test.py file with the following code and run it to check that everything is working and that the GPU is recognised.

import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
# Hello, TensorFlow!
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a + b))
# 42
python test.py

I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so.8.0 locally
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_init.cc:118] Found device 0 with properties:
name: GeForce GTX 1080
major: 6 minor: 1 memoryClockRate (GHz) 1.797
pciBusID 0000:01:00.0
Total memory: 7.92GiB
Free memory: 7.52GiB
I tensorflow/core/common_runtime/gpu/gpu_init.cc:138] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_init.cc:148] 0: Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:870] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1080, pci bus id: 0000:01:00.0)
Hello, TensorFlow!
42

You can now start having fun.

Written on August 17, 2016


Posted by uniqueone
,

http://blog.naver.com/kjpark79/220781100554


When I follow the http://pythonkim.tistory.com/71 & https://marcnu.github.io/2016-08-17/Tensorflow-v0.10-installed-from-scratch-Ubuntu-16.04-CUDA8.0RC-cuDNN5.1-1080GTX/, I got the below after < bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package>

"The specified --crosstool_top '@local_config_cuda//crosstool:crosstool' is not a valid cc_toolchain_suite rule. ..."


However, I follow the instruction of http://blog.naver.com/kjpark79/220781100554, I succeed.



ubuntu 14.04 에서는 tensorflow가 잘 됐는데 ubuntu 16.04에서는 MNIST 예제에서 에러가 나더군요. (misaligned address error) CIFAR10, Imagenet 등 다른 예제는 잘됩니다.

검색을 해보니 cuda toolkit 8.0과 cudnn 5를 설치하고 tensorflow를 source로 설치해서 성공했다는 사람이 있어서 해봤습니다. 삽질을 좀 하긴 했지만 설치하고 나니까 MNIST 예제 잘 돌아갑니다. ㅎㅎ

참고로 제 장비는 레노버 Y700 (NVIDIA GTX 960M 탑재) 입니다.


GCC 4.8 설치

ubuntu 16.04에는  gcc 5가 설치되어 있는데 cuda toolkit은 gcc 5를 지원하지 않습니다. 따라서 gcc 4.8을 이용해야 합니다. gcc 4.8을 이용하려면 아래와 같이 하면 됩니다.


sudo apt-get install gcc-4.8

sudo apt-get install g++-4.8

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50 --slave /usr/bin/g++ g++ /usr/bin/g++-5

sudo update-alternatives --config gcc


위와 같이 실행하면 gcc 선택 화면이 나오는데 gcc 4.8에 해당하는 숫자를 선택하면 됩니다. 저의 경우에는 1번이었습니다.

선택후 gcc -v를 실행해보고 버전이 4.8인지 확인하세요.


CUDA Toolkit, cuDNN 설치

NVIDIA 홈페이지에서 cuda toolkit 8.0과 cudnn 5을 다운받으세요.

cuda_8.0.27_linux.run

cudnn-8.0-linux-x64-v5.0-ga.tgz


cudnn의 압축을 풉니다. 압축을 풀면 cuda 디렉토리가 생성됩니다.

tar -zxf cudnn-8.0-linux-x64-v5.0-ga.tgz

 

cuda toolkit을 설치합니다.

sudo ./cuda_8.0.27_linux.run


cuda toolkit이 설치된 디렉토리에 cudnn 파일들을 복사합니다.

sudo cp cuda/include/cudnn.h /usr/local/cuda/include/

sudo cp -a cuda/lib64/* /usr/local/cuda/lib64/

 

라이브러리 path를 추가하기 위해 .bashrc에 아래 내용을 추가합니다.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

export CUDA_HOME=/usr/local/cuda


.bashrc에 추가한 내용을 적용합니다.

source ~/.bashrc


Tensorflow 설치

tensorflow를 소스로 설치하는 방법은 홈페이지에 자세히 나와 있기 때문에 여기서는 간략하게 정리했습니다.


tensorflow 소스를 git을 이용해 가져옵니다.

git clone https://github.com/tensorflow/tensorflow


bazel을 설치합니다. bazel은 tensorflow을 빌드하기 위한 툴입니다.

http://bazel.io/docs/install.html


tensorflow 디렉토리로 이동한후 configure를 실행해 환경 설정을 합니다. 아래와 같이 cuda toolkit과 cudnn 버전을 지정해 줍니다.

./configure

...

Do you wish to build TensorFlow with GPU support? [y/N] y

Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 8.0

Please specify the Cudnn version you want to use. [Leave empty to use system default]: 5

...

 

환경 설정이 끝났으면 bazel을 이용해 빌드합니다.

bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer

 

아래와 같은 에러가 발생하면

ERROR: /home/thomas/Downloads/tensorflow/tensorflow/core/kernels/BUILD:1518:1: undeclared inclusion(s) in rule '//tensorflow/core/kernels:depth_space_ops_gpu':

this rule is missing dependency declarations for the following files included by 'tensorflow/core/kernels/spacetodepth_op_gpu.cu.cc':

설정 파일에 include 디렉토리를 추가해 줍니다. vi로 파일을 열고

vi third_party/gpus/crosstool/CROSSTOOL

cxx_builtin_include_directory: "/usr/include" 아래에 아래 내용을 추가하세요.

cxx_builtin_include_directory: "/usr/local/cuda-8.0/include"

 

빌드가 끝났으면 정상적으로 빌드되었는지 확인합니다. 에러없이 잘 실행되면 성공입니다.

bazel-bin/tensorflow/cc/tutorials_example_trainer --use_gpu


혹시 libcuda.so.1이 없다는 에러가 나오면 그래픽 카드 드라이버가 367인지 확인하세요. 361로 바꾸면 libcuda.so.1이 다시 생깁니다. (바꾸고 재부팅 한번 해주세요)

 

Python 패키지 제작

python에서 사용하려면 패키지를 만들고 pip로 설치해줘야 합니다.

bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

sudo pip install /tmp/tensorflow_pkg/tensorflow-0.10.0rc0-py2-none-any.whl

 

이제 tensorflow 안에 있는 MNIST 예제를 실행해 봅니다.

cd tensorflow/models/image/mnist

python convolutional.py


GPU 잘 잡고 에러 안뜨면 성공입니다. 짝짝짝


만약 init를 못한다는 에러가 나면 아래와 같이 실행한 후 다시 해보세요.

sudo ldconfig /usr/local/cuda/lib64

sudo python convolutional.py


이렇게 한번 하고 나면 다음부터 잘됩니다.


Posted by uniqueone
,

http://pythonkim.tistory.com/71

문제점.pdf


I follow this post, however, I got an error after < bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package>

"The specified --crosstool_top '@local_config_cuda//crosstool:crosstool' is not a valid cc_toolchain_suite rule. ..."

However, this provide some guidance.


Then I follow the http://blog.naver.com/kjpark79/220781100554, and I succeed.




이번 글의 수명이 길지는 않을 것으로 보인다. 텐서플로우는 RC 버전이고, 그래픽 카드 또한 최신이고, 우분투 16.04도 방금 나온 최신 버전이고, 파이썬도 최신 버전이고. 검증하지 않은 것들이 모일 수 있기 때문에 설치 과정에서 수많은 시행착오를 거칠 수밖에 없었다. 최신이어서 참고할 사이트도 많이 없다.


컴퓨터 사양


문제점

1. 지포스 10 시리즈는 PASCAL 방식으로 제작되었다고 한다. 그래서인지 CUDA 7.5와 연동하면 정확도가 떨어지는 문제점이 있었다. 90%의 정확도가 아니라 10%의 정확도로 나와서 경악을 금치 못했다. 속도는 무지 빨랐다.

2. 텐서플로우 0.10과 CUDA 7.5 연동이 잘 되지 않았다. 처음에는 괜찮았던 기억이 있는데, 어느 순간부터는 충돌이 발생하면서 설치할 수 없었다. CUDA 8.0 설치를 포기해야겠다고 생각하면서 하위 버전 설치에 꽤나 주력했었다.

3. CUDA 8.0을 사용하려면 텐서플로우를 바이너리 버전이 아니라 소스코드 버전으로 설치해야 한다. 현재 시점에서는 텐서플로우 0.10에 대한 링크가 없어서 바이너리 버전 설치는 불가능했다. 당연히 0.9 버전을 설치하기 위해서도 많이 애를 썼었다. 소스코드 버전 설치는 컴파일부터 진행하기 때문에 해야 할 게 무척 많아진다.


공통 사항

1. 터미널(콘솔)

단축키 : ctrl + alt + t 또는 ctrl + alt + f1
처음에 터미널 창을 열면 항상 ~ 폴더에서 시작한다. ~ 폴더는 사용자의 홈 폴더를 말하고, 어디에 있건 "cd ~" 명령을 통해 항상 홈 폴더로 이동할 수 있다.

모든 설치는 터미널에서 진행되기 때문에 그래픽 화면이 전혀 사용되지 않는다. 화면 캡쳐할 것이 없다는 뜻이다. 입력하기가 번거롭기 때문에 본문에 있는 명령을 붙여 넣는 것이 쉬울 것이다. 터미널에서는 [ctrl+c, ctrl+v] 단축키가 동작하지 않으므로, 마우스 오른쪽 버튼 메뉴를 사용해야 한다.

[ctrl + alt + f1]은 그래픽 모드로부터 완전히 벗어난 형태의 터미널을 생성한다. 모니터 전체를 터미널이 덮는 모드를 말한다. 이와 같은 전체 터미널 모드는 엔비디아 드라이버를 설치할 때, 딱 한 번만 사용하고, 나머지는 모두 [ctrl + alt + t]를 사용한다.


2. 명령줄 자동완성

파일 이름을 입력할 때, TAB키를 누르면 일치하는 파일 이름을 자동으로 입력해 준다. 파일 이름을 여러 번 입력하기 때문에 기억하면 매우 편리하다. 간혹 동작하지 않을 때도 있는데, 잘못된 것이 아니라 리눅스의 환경 문제이므로, 그런 경우에는 차분하게 파일 이름을 모두 입력해야 한다.


3. 무한 로그인 에러 해결 방법

[ctrl + alt + f1] 단축키를 사용해서 터미널로 이동해서 다시 엔비디아 드라이버를 설치하면 된다. 무한 로그인 에러는 엔비디아 드라이버와의 충돌 과정에서 발생하기 때문에 다시 설치하면 사라진다.

이 에러는 상상을 초월할 정도의 유명한 에러인데, 별의별 방법으로 해결을 하려고 노력했지만 끝내 하지 못했었다. 이 방법을 알고 있었다면, 우분투 설치 횟수를 25회 정도로 막을 수도 있었다. 생각할수록 화가 난다.

그래픽 화면으로 넘어갈 때는 [alt + f7] 단축키. 다만 그 전에 아래 명령을 사용해서 그래픽 모드를 활성화시켜야 한다.
$ sudo service lightdm start


4. 텍스트 파일 편집

경로 등을 저장하기 위해 텍스트 파일을 편집하게 되는데, 이 때 gedit 프로그램을 사용한다. 파일을 열거나 저장할 때 아래와 같은 경고가 뜨는데, 설치와는 전혀 상관없다. 터미널에서 그래픽에 접근하는 과정에서 표시되는 경고일 뿐이다.

(gedit:27848): IBUS-WARNING **: The owner of /home/python-kim/.config/ibus/bus is not root!
(gedit:27848): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

** (gedit:27848): WARNING **: Set document metadata failed: metadata::gedit-spell-enabled 속성 설정은 지원하지 않습니다
** (gedit:27848): WARNING **: Set document metadata failed: metadata::gedit-encoding 속성 설정은 지원하지 않습니다
** (gedit:27848): WARNING **: Set document metadata failed: metadata::gedit-position 속성 설정은 지원하지 않습니다


참고 사이트

1. 성공 사이트

https://marcnu.github.io
https://marcnu.github.io/2016-08-17/Tensorflow-v0.10-installed-from-scratch-Ubuntu-16.04-CUDA8.0RC-cuDNN5.1-1080GTX

순서대로 정리가 너무 잘 되어 있는 외국 사이트. 텐서플로우KR에 누가 올려놓은 자료인데.. 일단 내 컴퓨터와는 궁합이 너무 잘 맞았다.


2. 실패 사이트

http://textminingonline.com/dive-into-tensorflow-part-iii-gtx-1080-ubuntu16-04-cuda8-0-cudnn5-0-tensorflow

이 사이트의 내용에 대해서는 매번 실패를 했지만, CROSSTOOL.tlp 파일을 수정하는 부분만 있으면 성공할 거라고 생각한다. 이 방식은 그래픽 모드에서 전혀 벗어나지 않기 때문에 설치된다고 하면 이 방식이 훨씬 낫다. 설치 명령과 함께 에러 메시지도 표시하기 때문에 안심하고 진행할 수 있는 장점도 있다.


엔비디아 다운로드

헷갈리지 않게 미리 다운로드 받아서 설치 가능한 상태로 만들어 놓고 시작한다. 순서가 너무 많아서 헷갈린다. 윈도우와 똑같이 다운로드한 파일은 다운로드 폴더에 저장된다. 다운로드한 파일을 모두 홈 폴더로 복사하자. 나 같은 리눅스 초보는 홈 폴더에서 작업하는 것이 좋다. 리눅스 공부는 설치가 끝난 다음에 하도록 하자. 파일 복사는 윈도우와 동일한 탐색기를 사용하면 된다.


1. 드라이버 다운로드 (버전 367.44)

자신의 그래픽 카드에 맞는 드라이버를 다운로드 받아야 한다. 현재 버전은 367.44이고, Linux 64-bit 버전이어야 한다. 64비트 버전이 보이지 않으면, Operatiing System 항목에서 [Show all Operating Systems] 메뉴를 선택한다. 쉽게 실행할 수 있도록 실행 모드를 추가한다. 이제 실행 파일처럼 더블클릭으로 실행할 수 있는 상태가 된다.

$ chmod +x NVIDIA-Linux-x86_64-367.44.run


2. CUDA 다운로드 (버전 8.0RC) 회원 가입 필수

그림에 나와 있는 것처럼 정확하게 우분투16.04, 64비트 버전을 선택한다. 파일을 다운로드 받아서 설치하는 runfile(local)까지 선택한다. 이 파일의 확장자는 run이다. 현재 시점에서는 우분투에 기본 설치되는 gcc 5.4에 대한 패치 파일이 별도로 존재한다. 이 파일까지 함께 받는다. 파일 2개에 대해 한 번에 실행 권한을 준다.

$ chmod +x cuda_8.0.27_linux.run  cuda_8.0.27.1_linux.run


3. cuDNN 다운로드 (버전 5.1 Library for Linux) 회원 가입 필수

다운로드한 파일의 압축을 풀고, 외부 모듈이 실행할 수 있도록 이동하고 접근 권한을 바꾼다. 압축을 풀면 현재 폴더에 cuda 폴더를 생성하고 그 안에 파일을 넣어 둔다. 여기서는 CUDA 8.0을 사용하기 때문에 목표 폴더 이름에 cuda-8.0이 들어간다.


엔비디아 설치

1. 드라이버 설치

윈도우와 같은 그래픽 환경에서 이 글을 볼 것이다. 그렇다면 [ctrl + alt + f1]을 눌러서 터미널로 이동한다. 그래픽 화면을 종료하고 그래픽 카드를 구동하는 드라이버를 설치한다. 드라이버가 설치되면, 게임도 할 수 있고, 동영상도 볼 수 있고, 그래픽 카드를 사용하는 대부분의 것들을 할 수 있게 된다. 내 경우는 모니터 2대를 연결해서 사용할 수 있게 되었다. 드라이버 설치가 끝나면, 컴퓨터를 껐다가 켠다. (리부팅)

지금 보는 화면은 그래픽 화면이기 때문에 터미널 모드로 들어가면, 지금 보는 설명을 볼 수 없다. 외워도 좋고, 안 되면 종이에 써놓고 터미널로 입장하자.

드라이버 설치할 때 여러 번 엔터 키를 눌러야 한다. accept나 yes와 같은 긍정적인 것들만 선택하도록 한다. 6~7번 정도 필요하다.

$ sudo service lightdm stop
$ sudo init 3
$ sudo ./NVIDIA-Linux-x86_64-367.44.run
$ sudo reboot


드라이버 파일에 실행 권한을 주지 않았다면, 아래 명령을 통해서 run 파일을 구동할 수 있다. 다만 파일 이름을 자동으로 완성할 수 없기 때문에 직접 입력해야 한다.

$ sudo sh NVIDIA-Linux-x86_64-367.44.run


2. CUDA 메인 설치

컴퓨터가 새로 켜졌다. 터미널 모드로 입장해야 하니까, [ctrl + alt + t] 단축키를 누른다. 패치 파일을 포함한 2개 파일을 순서대로 모두 설치한다. 메인 파일에만 --override 옵션이 붙는다. gcc 5.3까지만 인정하기 때문에 이걸 무시하기 위해 추가하는 것이 override 옵션이다. 이걸 수정하기 위한 파일이 패치 파일이다.

$ sudo ./cuda_8.0.27_linux.run --override

드라이버 설치와 마찬가지로 실행 권한을 주지 않았다면, 아래 명령을 사용한다.

$ sudo sh cuda_8.0.27_linux.run --override

아래에 빨간 글자처럼 입력한다. '엔터'라고 되어 있는 항목은 default 값을 사용한다는 뜻이다. 가장 중요한 항목은 두 번째에 있는 361.77 드라이버 설치 문항이다. yes라고 입력하면, 앞에서 설치한 최신 버전을 덮어 쓴다. sample은 설치하지 않아도 되지만, CUDA가 설치되었는지 sample을 통해 확인할 수 있기 때문에 설치하는 것이 좋다.


# ----------------------------- 설치 내용 --------------------------------- #

Do you accept the previously read EULA? accept/decline/quit: accept
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 361.77? (y)es/(n)o/(q)uit: n
Install the CUDA 8.0 Toolkit? (y)es/(n)o/(q)uit: y
Enter Toolkit Location [ default is /usr/local/cuda-8.0 ]: 엔터
Do you want to install a symbolic link at /usr/local/cuda? (y)es/(n)o/(q)uit: y
Install the CUDA 8.0 Samples? (y)es/(n)o/(q)uit: y
Enter CUDA Samples Location [ default is /home/python-kim ]: 엔터

Installing the CUDA Toolkit in /usr/local/cuda-8.0 ...
Missing recommended library: libGLU.so.
Missing recommended library: libX11.so
Missing recommended library: libXi.so
Missing recommended library: libXmu.so

Installing the CUDA Samples in /home/python-kim ...
Copying samples to /home/python-kim/NVIDIA_CUDA-8.0_Samples now...

Finished copying samples.

============ Summary ============

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-8.0
Samples:  Installed in /home/python-kim, but missing recommended libraries

Summary에서 Driver는 설치되지 않은 것을 볼 수 있다. Toolkit은 설치되었지만, Samples는 설치되지 않은 항목이 있다. 361.77 드라이버를 설치할 때, OpenGL 라이브러리 설치를 물어보는데, 우리는 설치하지 않았기 때문에 OpenGL 샘플도 설치하지 않았다는 뜻이다. OpenGL은 우분투에서 그래픽 카드와 충돌나기로 유명하다. 우리는 자연스럽게 설치를 피했다.


3. CUDA 패치 설치

우분투에 기본으로 설치된 gcc 5.4 버전을 위한 패치 파일을 실행시킨다. override 옵션은 필요 없다. 설치가 너무 간단해서 신경써서 입력할 항목이 없다.

$ sudo ./cuda_8.0.27.1_linux.run


드라이버 설치와 마찬가지로 실행 권한을 주지 않았다면, 아래 명령을 사용한다.

$ sudo sh cuda_8.0.27.1_linux.run


# ----------------------------- 설치 내용 --------------------------------- #

Do you accept the previously read EULA?
accept/decline/quit: accept

Enter CUDA Toolkit installation directory
[ default is /usr/local/cuda-8.0 ]: 엔터

Installation complete!
Installation directory: /usr/local/cuda-8.0


4. 환경 구성

라이브러리와 CUDA를 사용할 수 있도록 경로를 추가한다. 먼저 환경 파일을 연다.

$ sudo gedit ~/.bashrc


아래 내용은 .bashrc 파일의 마지막에 추가한다.

export CUDA_HOME=/usr/local/cuda-8.0
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}


추가한 내용을 즉각 반영한다.

$ source ~/.bashrc


5. 드라이버 및 CUDA 설치 확인

$ nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Wed_May__4_21:01:56_CDT_2016
Cuda compilation tools, release 8.0, V8.0.26


$ nvidia-smi

터미널에서는 깔끔하게 출력이 되는데, html 파일에서는 깨진다. 감안하고 보자.

Tue Aug 30 19:59:47 2016
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 367.44         Driver Version: 367.44        |
|-------------------------------+----------------------+----------------------+
| 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 106...  Off  | 0000:01:00.0      On |        N/A |
| 33%   33C    P8    10W / 130W |    257MiB /  6064MiB |   0%   Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes:             GPU Memory |
|  GPU  PID  Type  Process name     Usage |
|=============================================================================|
|   0   2733   G   /usr/lib/xorg/Xorg       227MiB |
|   0   3461   G   compiz      28MiB |
+-----------------------------------------------------------------------------+


6. CUDA 샘플 구동

현재 폴더(사용자 홈)에 샘플 폴더가 설치되고, 이름은 NVIDIA_CUDA-8.0_Samples. 이 폴더 안에 들어가면 여러 개의 폴더가 보이는데, 모두 CUDA로 확인할 수 있는 샘플들이다. 샘플을 구동하는 규칙은 모두 같다. 해당 폴더로 이동해서 make 명령을 입력하고, 생성된 실행 파일을 실행시킨다.

$ cd NVIDIA_CUDA-8.0_Samples/1_Utilities/bandwidthTest/
$ make

"/usr/local/cuda-8.0"/bin/nvcc -ccbin g++ -I../../common/inc  -m64    -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o bandwidthTest.o -c bandwidthTest.cu
"/usr/local/cuda-8.0"/bin/nvcc -ccbin g++   -m64      -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o bandwidthTest bandwidthTest.o
mkdir -p ../../bin/x86_64/linux/release
cp bandwidthTest ../../bin/x86_64/linux/release

$ ./bandwidthTest 

[CUDA Bandwidth Test] - Starting...
Running on...

 Device 0: GeForce GTX 1060 6GB
 Quick Mode

 Host to Device Bandwidth, 1 Device(s)
 PINNED Memory Transfers
   Transfer Size (Bytes)    Bandwidth(MB/s)
   33554432            12542.1

 Device to Host Bandwidth, 1 Device(s)
 PINNED Memory Transfers
   Transfer Size (Bytes)    Bandwidth(MB/s)
   33554432            12322.1

 Device to Device Bandwidth, 1 Device(s)
 PINNED Memory Transfers
   Transfer Size (Bytes)    Bandwidth(MB/s)
   33554432            141467.7

Result = PASS

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.


7. cuDNN 설치

이건 설치할 게 없다. 다운로드한 파일을 압축을 풀어서 복사해서 붙여넣기만 하면 된다. 앞에서 CUDA 샘플을 구동하기 위해 샘플 폴더로 이동했기 때문에 홈 폴더로 이동하는 것까지 포함한다.

$ cd ~
$ tar xvzf cudnn-8.0-linux-x64-v5.1.tgz
$ sudo cp cuda/include/cudnn.h /usr/local/cuda-8.0/include/
$ sudo cp cuda/lib64/* /usr/local/cuda-8.0/lib64/


텐서플로우 설치

1. 파이썬 환경 구축

우분투 16.04에는 파이썬 2.7과 3.5가 모두 설치되어 있다. 최신 버전을 무조건 좋아하기 때문에 여기서는 3.5 버전을 중심으로 얘기한다. 일단 텐서플로우 설치에 사용할 파이썬 도구를 설치한다. 혹시라도 이번 명령이 동작하지 않으면, 바로 아래 있는 [자바 JDK 설치]를 먼저 진행하기 바란다.컴퓨터를 껐다 켜게 되면, 설치 중인 정보가 날아가서 이번 명령이 실패할 수도 있다. 이때, [자바 JDK 설치]가 정보를 복구해줄 수도 있다.


파이썬 3.5
$ sudo apt-get install python3-pip python3-numpy swig python3-dev python3-wheel

파이썬 2.7
$ sudo apt-get install python-pip python-numpy swig python-dev python-wheel


2. 자바 JDK 설치

텐서플로우를 빌드하기 위해 JDK를 먼저 설치해야 한다. Bazel에서 필요로 한다. 이 부분은 파이썬 버전과 상관이 없다.

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer


3. Bazel 설치

Bazel은 구글 내에서 사용하는 프로젝트를 빌드하기 위한 범용 도구이다. 여기서는 텐서플로우를 빌드하기 위해 사용한다. 이번 명령이 좀 길기는 하지만, 복사해서 붙여넣기할 거니까 빠지지 않도록 조심한다. 리눅스 명령에 익숙하면 분리할 수도 있는데, 좀 해봤는데.. 잘 안됐다. 나중에 고민하도록 하자.

$ echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
$ curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -
$ sudo apt-get update && sudo apt-get install bazel
$ sudo apt-get upgrade bazel


4. 텐서플로우 소스코드 다운로드

git을 설치한다. 혹시 설치되어 있다면, 당연히 건너뛰어도 된다.

$ sudo apt install git


텐서플로우 소스코드 저장소 구축

$ git clone -b r0.10 https://github.com/tensorflow/tensorflow


5. CROSSTOOL 파일 수정

이 부분이 가장 중요하게 생각된다. 실제로 이전에 시도한 수없이 많은 방법 중에서 이 부분을 제외하면 그다지 다를 것이 없었다. 그런데, 동작하지 않았다. 수정할 파일은 홈 폴더의 "tensorflow/third_party/gpus/crosstool" 폴더에 있는 CROSSTOOL.tpl 파일이다.


파일 열기
$ sudo gedit ~/tensorflow/third_party/gpus/crosstool/CROSSTOOL.tpl


추가할 내용
cxx_builtin_include_directory: "/usr/local/cuda-8.0/include"


추가할 위치(내 경우엔 67행)
cxx_builtin_include_directory: "/usr/lib/gcc/"
cxx_builtin_include_directory: "/usr/local/include"
cxx_builtin_include_directory: "/usr/include"
cxx_builtin_include_directory: "/usr/local/cuda-8.0/include"    <----- 여기 추가
tool_path { name: "gcov" path: "/usr/bin/gcov" }


6. Bazel 환경 구축

먼저 tensorflow 폴더로 이동한 다음에 configure 파일을 실행시킨다. 역시 빨간색으로 처리된 부분을 정확하게 입력하도록 한다. 파이썬 3.5를 사용하기 때문에 첫 번째 항목에서 python3이라고 했다. 2.7을 사용한다면 아무 것도 입력하지 않으면 된다. 구글 플랫폼의 두 번째 항목은 필요없기 때문에 No라고 입력했다.

마지막의 그래픽 카드 버전이 가장 여려운데, 기본은 3.5와 5.2의 두 가지다. 1060의 경우 6.1로 입력해야 하는데, 다음 주소를 통해 그래픽 카드의 버전 숫자를 찾을 수 있다. (그래픽 카드 버전 숫자 찾기로 이동)


$cd ~/tensorflow
$ ./configure
Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python3
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] N
No Google Cloud Platform support will be enabled for TensorFlow
Do you wish to build TensorFlow with GPU support? [y/N] y
GPU support will be enabled for TensorFlow
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: 엔터
Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 엔터
Please specify the location where CUDA  toolkit is installed. Refer to README.md for more details.
[Default is /usr/local/cuda]: usr/local/cuda-8.0
Please specify the Cudnn version you want to use. [Leave empty to use system default]: 엔터
Please specify the location where cuDNN  library is installed. Refer to README.md for more details.
[Default is /usr/local/cuda-8.0]: 엔터
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size.
[Default is: "3.5,5.2"]: 6.1

...

INFO: All external dependencies fetched successfully.
Configuration finished


7. 텐서플로우 설치

bazel을 사용해서 텐서플로우를 빌드한다. 빌드한 결과물은 /tmp/tensor_pkg 폴더에 들어간다.

$ bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg


앞에서 사용한 결과물을 pip 명령을 통해 설치한다. 버전2와 버전3에서 파일 이름이 다른데, 중요하지 않다. 중요한 것은 /tmp/tensorflow_pkg 폴더에 있는 파일을 사용해야 한다는 점이다. 이름을 외울 필요는 없다. tensor까지 입력하고 tab 키를 누르면 자동 완성된다. 파일이 1개밖에 없다.


파이썬 3.5
$ pip3 install /tmp/tensorflow_pkg/tensorflow-0.10.0rc0-py3-none-any.whl

파이썬 2.7
$ pip install /tmp/tensorflow_pkg/tensorflow-0.10.0rc0-py2-none-any.whl


8. 텐서플로우 사용

아쉽지만, 우분투를 재시동해야 한다. 내 경우는 그랬다. 조금만 참자.
컴퓨터가 새로 켜졌다면 터미널에 아래와 같이 입력해 보자.


파이썬 3.5
$ python3 -c 'import tensorflow'

파이썬 2.7
$ python -c 'import tensorflow'


출력 결과는 아래와 같이 나와야 한다. 만약 아무 것도 출력되지 않았다면, 실패한 것이다. 이 시점에서 정말 많은 눈물을 흘려야 했다. 나타나지 않았다면, 우분투를 다시 설치하는 것부터 시작하면 된다. 윈도우는 그대로 둬도 된다.

I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally


잘 됐다면 진짜 코드로 확인을 해야 한다. mnist 예제를 돌려 보자.


파이썬 3.5
$ python3 tensorflow/tensorflow/models/image/mnist/convolutional.py

파이썬 2.7
$ python tensorflow/tensorflow/models/image/mnist/convolutional.py


놀랍게도 1시간 걸리던 예제가 불과 1분만에 해결됐다. 에러는 0.8*, 정확도 99.2%의 훌륭한 결과를 보여줬다.

I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting data/train-images-idx3-ubyte.gz
Extracting data/train-labels-idx1-ubyte.gz
Extracting data/t10k-images-idx3-ubyte.gz
Extracting data/t10k-labels-idx1-ubyte.gz
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_init.cc:102] Found device 0 with properties:
name: GeForce GTX 1060 6GB
major: 6 minor: 1 memoryClockRate (GHz) 1.759
pciBusID 0000:01:00.0
Total memory: 5.92GiB
Free memory: 5.55GiB
I tensorflow/core/common_runtime/gpu/gpu_init.cc:126] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_init.cc:136] 0: Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:838] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0)
Initialized!
Step 0 (epoch 0.00), 19.7 ms
Minibatch loss: 12.054, learning rate: 0.010000
Minibatch error: 90.6%
Validation error: 84.6%
...
...
Step 8400 (epoch 9.77), 7.2 ms
Minibatch loss: 1.596, learning rate: 0.006302
Minibatch error: 0.0%
Validation error: 0.8%
Step 8500 (epoch 9.89), 7.2 ms
Minibatch loss: 1.603, learning rate: 0.006302
Minibatch error: 0.0%
Validation error: 0.8%
Test error: 0.8%


Posted by uniqueone
,

http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run




from this site

https://devtalk.nvidia.com/default/topic/932554/-ubuntu-16-04-install-cuda-7-5/

Posted by uniqueone
,

http://askubuntu.com/questions/303290/where-is-usr-local



I ran the following code in a terminal:

python -c "                 
import sys
sys.path = sys.path[1:]
import django
print(django.__path__)"

This returns the following path:

['/usr/local/lib/python2.7/dist-packages/django']

but I simply cannot find usr/local (from the GUI). Where should it be?

I'm not sure what other information would help, please let me know!

shareimprove this question


2  
/usr/local is a location. – psusi Jun 2 '13 at 21:56
    
@psusi I'm pretty sure OP knows it's a location, but apparently he's not familiar with nautilus, which starts you in your home folder, and you need to go up form it to the root directory – Serg Apr 16 '15 at 20:21
up vote 0 down vote accepted

type

sudo cd /usr/local/lib/python2.7/dist-packages

in to terminal. That should take you to the folder

The usr folder is part of the file system, it is accessed from the root of your file system

shareimprove this answer

    
Sorry, I meant is there a way to access it from the GUI? – Colton Jun 2 '13 at 20:37
1  
Type sudo nautilus in to teminal, this gives you access to root folders – SimplySimon Jun 2 '13 at 20:48
    
Alright I got it, thanks. – Colton Jun 2 '13 at 20:52
    
My pleasure. Glad to be of assistance. :D – SimplySimon Jun 2 '13 at 21:04
    
You do not need to sudo to cd to /usr/local though you would not be able to edit the files. You do need root privileges for editing but the files are visible as a reugular user. – haziz Feb 1 '14 at 14:55
cd /usr/local

will get you there

You do need root privileges to edit files there, in which case you can invoke sudo, be very cautious about meddling with files however in the /usr directory and in the root directory / in general.

BTW don't be afraid of the command line! A useful introduction to the CLI is available here.

shareimprove this answer

Where should it be? By default when you open the file manager you run around your home directory(/home/username), same as in windows C:\Users\Username . Notice how /usr/local starts with backslash ? There's root directory from which you can access other directories; the image to keep in mind is the root directory is where root starts, and everything else is branching form it

How to access the folder you need:

Method #1 : press CtrlL in the file manager ( which is called nautilus, by the way) and type /usr/local into the address bar or / .

Method#2: Pressing repeatedly AltArrow Up buttown in file manager will get you to root directory (which is like C:\ folder in windows), and navigate graphically to whatever folder you need from there.

Method #3: Press AltF2 to open "Run command" dialogue and type nautilus /usr/local

Posted by uniqueone
,

http://luke77.tistory.com/44


기반 시스템 정보:


System memory: 8G

Processor: Intel core i5-2500K 3.3GHz x 4

Graphics: Geforce GTX 970/PCIe/SSE2

OS type: Ubuntu 64-bit (영문)



본 내용은 예람님의 블로그 내용(Refer)을 참고하여 작성되었음.


기타 참고 사이트


http://bit.ly/2aIcOXw

http://bit.ly/2aTDiVc

http://bit.ly/2a93SNg

http://bit.ly/2ar2ilL

http://bit.ly/2adltyT

http://bit.ly/2aTCJeg

http://bit.ly/2a930rD

http://bit.ly/2alSU8q






0. 그래픽 카드 드라이버 설정 (작업 편의성을 위함, 이미 설치되어 있다면 Skip 해도 됨)


1) 터미널을 실행시키고, Ubutu 에  GPU Drivers PPA를 추가하고 소프트웨어 소스를 업데이트 함


sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update


2) System settings 을 실행시키고, System 카테고리의 Software & Updates 를 실행함. Additional Drivers 탭에서 최신 바이너리 드라이버 항목을 선택하고 "Apply Changes" 선택. 해당 드라이버가 자동으로 다운로드되고 설치됨. 시스템을 리부팅하면 설치 완료.








1. Anaconda 설치


1) https://www.continuum.io/downloads 에서 Anaconda for Linux Python 2.7 Linux 64-bit 버전 다운로드 함.



2) 터미널에서 다운로드 받은 폴더로 이동하고, 다음을 입력하여 Anaconda를 설치함


bash Anaconda2-4.1.1-Linux-x86_64.sh 


(버전명은 다를 수 있으므로 다운로드 받은 파일에서 확인할 것)


중간 중간에 나오는 질문에는 모두 "yes" 한다.


home으로 나와서 (cd ~ 입력) gedit .bashrc 입력. 맨 하단에 Anaconda path 가 다음의 형태로 잘 적용되어 있는지 확인함.


# added by Anaconda2 4.1.1 installer
export PATH="/home/사용자명/anaconda2/bin:$PATH"



Terminal 을 종료하고 재실행 후 python 을 입력. 다음과 같은 형태의 문구가 보이고, import matplotlib 를 입력했을 때 에러가 없다면 성공.











2. CUDA Toolkit 설치


공식 TensorFlow 설치 페이지를 보면, 현재까지는 Cuda Toolkit 7.5와 cuDNN v4 를 반드시 설치하여야 함.



1) https://developer.nvidia.com/cuda-downloads 에 접속하여 Linux 용 runfile(local) 파일 다운로드.





2) cuda 7.5와 호환되는 gcc 컴파일러 설치


sudo apt-get install gcc-4.9 g++-4.9


3) 추가 패키지 설치


sudo apt-get install nvidia-modprobe freeglut3-dev libx11-dev libxmu-dev libxi-dev libglu1-mesa-dev


4) 다운로드 받은 폴더로 이동하여, 런파일을 이용한 CUDA 설치


-EULA 동의 : accept

-You are attempting to install on an unsupported configuration. Do you with to continue? : yes

-Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 352.39 ? no (이미 설치했음)

-Install the CUDA 7.5 Toolkit? yes

-Enter Toolkit Location : Enter (default)

-Do you want to install a symbolic link at /usr/local/cuda ? yes

-Install the CUDA 7.5 Samples? no

-Enter CUDA Samples Location : Enter (default)


sudo sh cuda_7.5.18_linux.run --override


5) cd ~ 입력 후 홈으로 이동. gedit .bashrc 입력/실행. 맨 마지막 줄에 다음을 입력 후 저장


export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
export CUDA_HOME=/usr/local/cuda









3. CUDNN 설치


1) https://developer.nvidia.com/cudnn 접속. Download 버튼을 통해 설치 (NVIDIA 가입 필요)

2) 다운로드 받은 파일을 우클릭하여 압축을 품. CUDA 폴더가 생성됨.

3) 다음을 입력하여 관리자 권한으로 탐색기 실행. usr/local/cuda 로 진입

sudo nautilus

4) CUDA/include 폴더 내에 들어있는 파일을 usr/local/cuda/include 에 복사

5) CUDA/lib64 폴더 내에 들어 있는 파일을 usr/local/cuda/lib64 에 복사

6) 다음 명령어 수행 (CUDNN을 전체 사용자가 사용)


sudo chmod a+r /usr/local/cuda/lib64/libcudnn*









4. TesnsorFlow 설치


1) Bazel 컴파일러 설치 (from Google)


- 자바 설치

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

- 압축 프로그램 for Bazel 설치

sudo apt-get install pkg-config zip g++ zlib1g-dev unzip


- Bazel 다운로드 (현재 버전 0.3.1) : https://github.com/bazelbuild/bazel/releases



- 다운로드 받은 폴더에서 하기의 내용을 입력하고 Bazel 설치

chmod +x bazel-0.3.1-installer-linux-x86_64.sh
./bazel-0.3.1-installer-linux-x86_64.sh --user

- cd ~ 으로 홈으로 이동. gedit .bashrc 를 입력/실행하고 맨 하단에 다음을 입력 및 저장

export PATH="$PATH:$HOME/bin"



2) numpy 설치

sudo apt-get install python-numpy swig python-dev


3) TensorFlow 다운로드 및 설치



- Git 설치

sudo apt-get install git

- TensorFlow 소스 다운로드

git clone --recurse-submodules https://github.com/tensorflow/tensorflow

- TensorFlow 설정. tensorflow 폴더 진입 및 configure 설정

cd ~/tensorflow
./configure

Please specify the location of python. - Enter (default)

Do you with to build TensorFlow with Google Cloud Platform support? N

(난 Hadoop도 설치할거냐고 해서 y를 누름)

Do you wish to build TensorFlow with GPU support? y

Please specify which gcc should be used by nvcc as the host complier. : /usr/bin/gcc-4.8 (4.8이 아니고 4.9임)

Please specify the Cuda SDK version you want to use: 7.5 (난 8.0)

Please specify the location where CUDA 7.5 toolkit is installed. Refer to README.md for more details. : Enter (default)

Please specify the Cudnn version you want to use. : 4 (난 5)

Please specify the location where cuDNN 4.0 library is installed. Refer to README.md for more details. : Enter (default)

Please note that each additional compute capability significantly increases your build time and binary size. : 3.5






- TensorFlow 소스 컴파일 (상기 tensorflow 폴더에서)


bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

- 컴파일 중 에러 발생 시 확인 사항


  컴파일러 호환 문제라면 gcc 4.8 설치 (예. #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!)

sudo apt-get install gcc-4.8 g++-4.8


  기타 여러 에러 발생시, 홈폴더 이동하여, tensorflow/third_party/gpus/crosstool/ 내 CROSSTOOL 파일에서,


  * cxx_builtin_include_directory: "/usr/local/cuda-7.5/include" (cxx_builtin_ 등이 있는 부분에 모두 삽입)

 

 * cxx_flag: "-std=c++11" 하단에  (두 군데 존재) 삽입

 

     cxx_flag: "-D_FORCE_INLINES"
     cxx_flag: "-D_MWAITXINTRIN_H_INCLUDED"




- TensorFlow 설치 패키지 생성

bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg


- 패키지 확인: tmp/tensorflow_pkg 내 tensorflow-0.9.0-py2-none-any.whl 파일이 있는지 확인 (버전명은 상이할 수 있음)



- Anaconda에 TensorFlow 설치 (버전명은 상이할 수 있음)


pip install /tmp/tensorflow_pkg/tensorflow-0.9.0-py2-none-any.whl



- Tensorflow 설치 확인: 하기의 소스코드를 실행하여 결과 확인 (터미널 실행 후 python 입력)


python

import matplotlib
import tensorflow as tf
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))


- 다음과 같이 출력되면 성공. CUDA 관련 library들이 제대로 로딩되고, GPU가 제대로 인식되면 됨




- 만일 modprobe: ERROR: could not insert 'nvidia_xxx_uvm': Invalid argument 와 같은 에러와 함께 GPU 인식이 되지 않는다면 그래픽 드라이버 호환의 문제일 가능성이 높음.




이 경우 필자의 경우엔, nvidia cuda toolkit 을 설치하고 해당되는 에러의 그래픽 드라이버 버전으로 재설치 하였음.



Toolkit 설치

sudo apt install nvidia-cuda-toolkit

드라이버 재설치

sudo apt-get purge nvidia*
sudo killall nvidia-persistenced (없다고 나오면 그냥 skip)
sudo apt-get update
sudo apt-get install nvidia-358 nvidia-prime
sudo reboot










5. IDE 설치 (여기서는 PyCharm 설치)


1) PyCharm 다운로드 (https://www.jetbrains.com/pycharm/download/#section=linux)


- Community 의 경우 무료

- Professional 의 경우, 학생이라면 1년간 무료 이용 가능


2) 다운로드 받은 폴더로 가서 압축을 품. Pycharm 디렉토리를 적당한 위치에 복사 (여기서는 Home에 복사)


3) cd pycharm-2016.2/bin 이동 (폴더명은 상이할 수 있음)


4) gedit pycharm64.vmoptions 으로 해당 파일을 메모장에 열고, Xmx750m 을 부분을 수정한다. 최대 메모리를 설정하는 것으로 여기서는 4096m 으로 수정 (4GB)





5) bash pycharm.sh 를 입력하여 설치 및 실행





6) PyCharm 아이콘을 우클릭하여, lock from launcher를 클릭하여 런처에 고정함.



7) 터미널을 열고 다음을 입력함 (경로는 상이할 수 있으니 확인할 것)


sudo ldconfig /usr/local/cuda/lib64


8) Pycharm 종료 후 다시 실행시키고 프로젝트 생성 후 다음의 코드를 통해 실행 여부 확인


- 처음 실행시, Updating indicies, Updating python interpreter 작업으로 첫 코딩 가능 시간까지 시간이 걸림.


- GPU Test (다음의 코드 입력 후 실행시키면 반드시 하기 스크린 샷과 같은 결과가 도출되어야 함) : Google TensorFlow 관련 내용 참고(링크)


import tensorflow as tf

# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print sess.run(c)

- 결과





- 최종적으로 Linear regression 예제가 GPU 연산으로 제대로 돌아가는 지 확인한다. (관련 소스 링크)




Posted by uniqueone
,

http://wayneoutthere.com/how-to-korean-keyboard-ubuntu/



This tutorial might also work on Ubuntu 14.04, I haven’t tried yet.

I love Ubuntu and I love Hangul but I’m not going to deny it – it’s not hyper-easy to get it running on Ubuntu, not because it’s super hard but because there aren’t any helpful blog posts out there to walk someone through it.

By golly, miss molly, that ends today!  Let’s begin…

Hit the super key and type ‘languages’ and then click/open the “language support” icon as per this:

01_language_support_in_dash

Click ‘install/remove languages’ as per this:

02_install_remove_languages

English should be selected already (if your mother-tongue install was English).  Choose “korean” from the list, then apply, and wait (a really long time sometimes) while it downloads King Sejong and the kitchen sink…

03_select_korean_from_list

Here is where the non-intuitive stuff starts.  You’d think doing the above would be all you need but you need to do a bit more.  Go to the top right of the screen where you see English (En) and click that and you’ll see ‘text entry settings’

04_text_entry_settings

Now you will English sitting there all alone.  Press the + sign and then type ‘korean’ and select it.  Then you’ll see a screen like this.  Choose Korean (Hangul) (Ibus).

05_adding_hangul_ibus

I had some issues leaving the ‘master keyboard’ (that’s a name I gave it) switching with the default (something with the super key) and so I changed mine to Control + space bar.  You can do whatever you want by just clicking in the space where the default is and hitting your favourite combo in on your keyboard.  When finished just close the window and your changes will be saved.

Remember, this is *not* the hangul-english keyboard language switching combo.  This is the keyboard combo that switches your keyboard from the “English only” (En) one to the “Korean with English capabilities” one.

06_changing_accelerator

Now, we’re getting close to being able to angle your Hangul, but just one more critical step that will save you the pulling out of multiple strands of hair.  You must now either reboot, or log out and log back in again in order to be able to eat your green eggs with Hangul.

You will know that you have successfully reached Hangul-Land when the top right area that used to say “En” is now a colourful Korean swirl like so:

07_korean_swirl

Although you now have full Korean capabilities, you now must use the keyboard combos found within this Korean keyboard in order to switch between English and Korean.  The default combo is shift + space bar, and you can try it out now for a fun test.  You may, like me, wish to change this keyboard combo to something else. If you do,  go on to the next section.

How to Customize Your Shiny New Korean Keyboard with a Custom Language Toggle Keyboard Combo

Click the colourful swirl and select ‘setup’ as per this:

08_hangul_customize

Next, you will see the Hangul toggle key space with the defaults. If you want to change the keys used to toggle between Korean and English, just click ‘add’ and then, even though it says ‘key’ singular in the pop up, you can hit the key combo with your computer and it will work.

*Warning!* It shows this popup when you hit ‘add’ under the Hangul toggle area, which is *incorrect*. It should say ‘hangul’ not hanja here. Both hanja and hangul display the same pop up box so it just needs a bug report to fix this but I’m too tired at the point of writing this blog…

10_incorrect_hanja_in_popup

In this case, I used control +right alt key because I remember using something like that back in the day and it felt comfortable.  You can do whatever floats your boat.

09_new_toggle_added

아이구! 신기 신기! 오렛동안 한국말 이컴퓨터에서 못했어….  드디어.

Hope this helps you grow in Ubuntu and Korean!

Posted by uniqueone
,

http://askubuntu.com/questions/18747/how-do-i-install-run-files



Occasionally, some applications and games (eg. some from the Humble Indie Bundle) have .run installers. Before installing using these, check to see if:

  1. it is available from the Software Centre
  2. it is available as a .deb file, which will open in the Software Center

You can install .run files from the graphical interface, but using a terminal is more likely to give you useful feedback. To install a .run file you need to:

  1. make it executable.
  2. execute it

This is because .run files are just executable programs that do some unknown magic to install the program. This is similar to what .exe installers do on Windows and is different to the normal methods (at best, using the Software Centre, at worst using .deb files) in which applications are installed in a standard way and can be easily removed.

Graphical Method

  1. Right click on the file in the file manager and click 'Properties'. Click the 'Permissions' tab and tick the box that says 'Allow executing file as program'.
  2. Double click the file to execute it.

If this method doesn't work, try using the terminal method.

Terminal Method

Assume the file is called some-app.run and is in the folder /home/user/Downloads. You will need to modify these instructions to fit your situation.

  1. Open a terminal (Applications->Accessories->Terminal).

  2. enter cd /home/user/Downloads

  3. enter chmod +x some-app.run
  4. enter ./some-app.run

  5. if step 4 fails with a message including 'permission denied', try entering sudo ./some-app.run (you will need to enter your password for this).

Notes

  • Sometimes you will come across .bin files. These are basically the same as .run files.
  • The method to install .run files can be used to execute any file (as long as it has some sort of executable code in it.
  • Be careful using sudo and only use it when absolutely required. Translated into English, it means 'Run this command but allow it to do anything it wants to my computer'. This is why you are prompted for your password.


Posted by uniqueone
,
http://jeongchul.tistory.com/492

 

Posted by uniqueone
,

http://goproprada.tistory.com/272

 

 

Posted by uniqueone
,

http://otter275.postach.io/post/windoue-tenseopeulrou-with-cpureul-wihan-dokeo-seolci

 

 

window_tensorflow.zip-pdf

윈도우에 텐서플로우 with CPU를 위한 도커 설치


  1. 기본 도커는 windows 10 pro이상만 지원 하므로 windows home 및 그 이하는 기본 도커 대신에 docker tool box를 설치 해야 한다. (기본도커는 cpu가상화를 이용하고 도커툴박스는 virtualbox를 이용한다)

  1. 도커 설치를 위한 가상화 체크. 링크 참조 =>https://docs.docker.com/toolbox/toolbox_install_windows/

가상화 부분이 Enabled 되어 있지 않으면 cmos에 들어가 가상화를 활성화.

  1. 도커툴 박스 다운로드. 링크 참조 => https://www.docker.com/products/docker-toolbox

  1. 다운로드 후 기본값으로 설치

  1. 설치 후 에 바탕화면에 다음의 3가지 아이콘들을 볼 수 있다. (실행하지 않는다.)


  1. reboot 실시

  1. 재부팅 후 Docker Quickstart Terminal 실행

  1. 실행 후 두 번에 걸쳐 User Account Control 권한을 물어보는데 전부 yes 합니다.

  1. 그 후 다음과 같이 mingw64 터미널과 $ 사인을 볼 수 있다. (앞으로 도커머신에 접속 할 때는 계속해서 Docker Quickstart Terminal를 실행 하면 된다.)


  1. tensorflow를 위한 otterdocker라는 이름의 도커머신 설치 => 다음의 명령어 입력

$ docker-machine create otterdocker -d virtualbox


  1. 도커머신 리스트 확인 => 다음의 명령어 입력

$ docker-machine ls


위의 내용과 같이 otterdocker 도커 머신은 잘 설치 되어 있다. 하지만 ACTIVE가 현재 default로 설정 되어 있으므로 이것을 otterdocker로 바꾸어 주어야 한다.

  1. ACTIVE 변경 => 다음의 명령어 입력

$ eval $(docker-machine env otterdocker)


그 후 다시 조회해 보면 otterdocker로 ACTIVE가 넘어 와 있다.

  1. 도커에 tensorflow with CPU image 올리기 => 다음의 명령어 입력

$ docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow


이미지를 로컬에서 찾다가 없기 때문에 자동으로 다운로드 및 설치를 위의 화면과 같이 수행 하게 됩니다. 그리고 tensorflow를 위한 jupyter notebook 접속 정보를 http://도커주소:8888 로 보여 줍니다.

  1. Jupyter Notebook 접속

11,12번 항목으로 otterdocker의 주소는 192.168.99.101임을 알 수 있는데 여기에 Jupyter Notebook의 포트 번호 8888을 붙여서 접속 합니다. => http://192.168.99.101:8888


다음과 같은 Jupyter Notebook 의 초기 화면을 볼 수 있으며 여기서 오른쪽 상단의 New를 누른 뒤 Python 2를 선택하면 tensorflow 라이브러리가 로드된 Python 2 인터랙티브 화면이 실행 됩니다.

  1. Hello World 테스트 => 다음 캡쳐 화면의 내용 처럼 화면에 입력해 봅니다. 각 In의 실행 단축키는 Shift + Enter 입니다.


두 vector들의 덧셈 예제


 

Posted by uniqueone
,

http://askubuntu.com/questions/709951/install-ubuntu-14-04-from-bootable-usb-could-not-find-kernel-image-isolinux-i

 

I wanted to install Ubuntu 14.04 from USB. At first I got the error

No default or UI configuration directive found

after reading through the forums a bit I renamed the isolinux folder as well as the .bin and .cfg files to syslinux. However, after I did that now the error

Could not find kernel image: /isolinux/isolinux.cfg

shows up.

Any ideas on how to fix this problem? Thanks in advance!

--------------------------------------------------------------------

Have you tried to create your bootable usb key under windows with LinuxLive USB Creatorhttp://www.linuxliveusb.com/fr/home ?

If you are only on linux, try to Download you linux iso and follow this procedure

Type

fdisk -l

Find your usb key path (for exemple /dev/sdd here)

Flash your key with the iso. (It will erase everything without confirmation, please double check every parameters).

sudo dd if=path/to/your/iso/linux.iso of=/dev/sdd bs=4096

Please wait carefully the end of the process. Now you got a bootable usb key with your iso.

Best regards

 

Posted by uniqueone
,
http://flyingdcat4.tistory.com/76

 

 

우분투에 그래픽 드라이버잡는거 그거 뭐라고 만 하루를 꼬박 설치하는데만
보내냐 ㅠㅠ
그때그때 발생하는 에러를 잡기 위해서 구글에 있는 관련 문서는 한글 영어
가리지 않고 거의 다 본것 같다. 본 포스팅은 다시 개발환경을 밀고 설치를 할
때 똑같은 실수를 반복하지 않고, 나와 같은 처지였던 사람들에게 해결방법을
알리기 위함이다. 정말 많은 포스팅이 있는데 볼수록 헷갈리기만 하니까 이포
스팅에서 아주 자세히 설명을 할테니 빠짐없이 그대로 따라하길 바란다.
(1) 사전준비 작업
그동안 정들었던 theano기반 Keras 개발 환경을 과감하게 밀어버리고 tensorflo
w로 넘어가기 위해 우분투 설치 usb를 만들고 일단 그래픽카드를 본체에서 제
거하고 설치를 하자(이유는 질문하면 알려주겠다). 설치 후 네트워크를 연결
하고 NVIDIA 홈페이지에서 그래픽카드 최신버전(내 경우는 64bits 버전 NVI
DIALinuxx86_
64367.44.
run)을 Home 폴더에 다운로드 받자. 내친김에 cuda
와 cudnn도 받아놓자(cuda_7.5.18_linux.run, cudnn7.5linuxx64v5.0ga.
tgz).
그리고 터미널을 켜고 다음 두 명령어를 입력한다.
sudo aptget
update
sudo aptget
install buildessential
(2) nouveau 비활성화
NVIDIA계열 드라이버 설치 시 첫 번째 만나는 난관은 nouveau다. 우분투 설치
시 기본적으로 설치되는 드라이버인데 이녀석이 NVIDIA 드라이버와 충돌을
일으킨다. 자세한 설명은 여기로 (http://blog.neonkid.xyz/66) 요약하자면 nouve
au를 끄고 드라이버를 설치해야한다.
터미널을 실행시키고 다음과 같이 명령어를 입력하면 된다.
sudo vi /etc/modprobe.d/blacklistnouveau.
conf
blacklist nouveau
blacklist lbmnouveau
options nouveau modeset=0
alias nouveau off
alias lbmnouveau
off
:wq를 누르고 저장 후 다시 터미널로 나와서 다음 명령어를 입력한 후 일단 컴퓨터를 끄자.
sudo update-initramfs -u
sudo shutdown -h now
(3) 드라이버 설치
컴퓨터를 끈 후 그래픽 카드를 장착하고 디스플레이를 그래픽 카드로 연결한
다. 그리고 부팅하면 "The system is running in lowgraphics
mode" 라는 처음 맞
이하는 메시지가 나타났다. 처음엔 뭐지 하다가 가만 생각해보니 그래픽카드
드라이버를 설치한 적이 없으니 당연히 low graphics mode로 동작하는거다. 참
고로 내 그래픽카드는 NVIDIA gtx titanX다(갑자기 왠 자랑질??). 침착하게 CT
RL+ALT+F1을 눌러 콘솔로 진입한 다음 로그인을 하자. 다른 포스팅을 보면 li
ghtdm을 stop하라고 되어있는데 아마 지금 상태면 lightdm이 이미 stop되어있

는 상태일 것이다. 그래서 할 필요가 없다. (1)단계에서 받아놓은 드라이버를
바로 설치하면 된다.
sudo sh NVIDIALinuxx86_
64367.44.
run
no하는것 없이 디폴트로 다 설치하자. 설치가 다 되면 다음 명령어를 입력하자
sudo nvidia-xconfig
위에 명령어 입력안하면 x window 실행할 때 xorg관련 problem이 뜰것이다. 그
러니까 까먹지 말자.
여기까지 문제없이 실행했다면 디스플레이 매니저를 실행하자.
sudo service lightdm start
로그인 화면이 뜨고 문제없이 로그인이 될 것이다. 그런데 문제가 하나 있다.
CTRL+ALT+F1을 누르면 콘솔로 넘어가야하는데 아마 까만화면만 뜨고 아무
것도 안나올것이다. 당황하지말고 재부팅 한 후 다음 grub 파일을 수정하면 된
다.
sudo vi /etc/default/grub
파일을 열고 GRUB_CMDLINE_LINUX_DEFAULT="quiet_spolash" 라는 부
분을 아래와 같이 고쳐준다.
GRUB_CMDLINE_LINUX_DEFAULT="quiet_spolash nomodeset"
저장 후 나와서 grub파일을 업데이트 한 후 재부팅 한다.
sudo update-grub
sudo reboot
여기까지 실행하면 드라이버는 깔끔하게 설치된 것이다.
(4) cuda 설치
CTRL+ALT+F1으로 콘솔화면으로 나온 후 로그인한다음에 디스플레이 매니
저를 끄자.
sudo service lightdm stop
(1)에서 다운로드 받았던 cuda 파일을 실행하면 된다.
sudo sh cuda_7.5.18_linux.run
여기서 그래픽 드라이버는 설치했기 때문에 그래픽 드라이버 설치하시겠습니
까(영어로 나온다 잘해석하면 됨)라고 물어보는 질문에는 no, 나머지는 디폴
드로 다 설치하자. 설치 후 bashrc 파일에 cuda 경로를 설정해줘야 한다.
sudo vi ~/.bashrc
위 명령어로 파일을 열어서 마지막에 아래 경로를 추가하면 된다.
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
export CUDA_HOME=/usr/local/cuda
혹시 cuda 설치 시 다음과 같은 에러가 발생한다면 "the driver installation is un
able to locate the kernel source..." 커널을 설치해주면 된다.

 

혹은 다음과 같은 에러가 발생한다면 "You appear to be running an X server..." 프로
세스 관련 폴더를 지우면 된다.
cd /tmp
rm -rf .X0-lock
(참조 http://m.blog.daum.net/goodgodgd/20 의 5.troubleshooting 부분)
(5) cudnn 설치
cudnn 설치는 간단하다. (1)에서 다운로드 받았던 파일의 압축을 풀고 파일을
복사해주면 끝이다.
tar xvzf cudnn-7.5-linux-x64-v5.0-rc.tgz
를 입력하면 압축이 풀리고 Home에 cuda 폴더가 생긴다.
cd cuda/include
sudo cp cudnn.h /usr/local/cuda/include
cd ..
cd lib64
sudo cp libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
이제 cudnn까지 설치가 끝났다.
(6) 그 외 설정
cuda를 설치할 때 Home폴더에 nividia sample 폴더가 생성되었을 것이다. 컴파
일 해주자.
cd NVIDIA_CUDA-7.5_Samples/1_Utilities/deviceQuery
make
만약에 make시 에러가 난다면 buildessential이
제대로 설치가 안된 것이므로
(1)의 buildessential을
다시 설치하자. 위 과정까지 끝났으면 제대로 컴파일 되
었는지 테스트를 해본다.
./deviceQuery
실행결과가 PASS이면 제대로 설치된 것이다. 지금까지 수고했다. 마지막 대
망의 확인작업만이 남았다.
nvcc V
nvidiasmi
위 명령어를 실행해서 문제없이 버전과 gpu 스펙을 확인할 수 있다면 마지막
확인 작업이 끝난것이다. 이제 tensorflow 설치준비가 끝났다!

Posted by uniqueone
,
http://flyingdcat4.tistory.com/75

 

 

Window10 64bits Theano&Keras 설치 방법
http://skyer9.tistory.com/7
이 방법대로 설치하면 깔끔함 ㅋ
theano import할 때 아마 cl.exe 찾을 수 없다고 나오는데 이것은 환경변수에 시
스템 path에 설치한 visual studio 2013 path를 추가해주면 해결됨.
내 경우에는 아래 경로로~ (아마 대부분이 비슷한 경로일 거임)
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin

 

Posted by uniqueone
,
http://dsa28s.tistory.com/entry/Windows%EA%B0%80-%EC%84%A4%EC%B9%98%EB%90%9C-%EC%83%81%ED%83%9C%EC%97%90%EC%84%9C-%EB%A6%AC%EB%88%85%EC%8A%A4%EB%A5%BC-%EC%84%A4%EC%B9%98%ED%95%98%EC%9E%90-%EB%A9%80%ED%8B%B0%EB%B6%80%ED%8C%85

 

 

 

 

저번에 리눅스 민트 기반인 하모니카 설치법을 포스팅 했었는데요,

저번 포스팅은 하드디스크에 리눅스만 설치하는 방법이었습니다;;


이번엔 Windows 가 설치된 상태에서 리눅스를 설치하여 Windows와 리눅스를 멀티부팅 하도록 하겠습니다.


설치 전 리눅스 설치 디스크가 필요합니다. 만드는 방법 http://dsa28s.tistory.com/4



필수) Windows 8.1 이상에서는 다음 설정을 해주어야 합니다!


필수 - 1. 제어판 > 전원 옵션에 들어가줍니다.

왼쪽 상단 절전 모드 해제 시 암호 사용을 클릭해주세요.



필수 - 2. 아래 빠른 시작 켜기 체크를 해제해 주세요.

(만약 체크칸이 비활성화 되어있다면 맨 위 현재 사용할 수 없는 설정 변경을 눌러 주신 후 해주세요.)

변경 내용 저장!



1. 리눅스 드라이브를 만들자!


1. 제어판 > 관리도구 > 컴퓨터 관리에 들어가 줍니다.

왼쪽에 디스크 관리를 클릭합니다.


리눅스를 설치할 드라이브를 누르신 후


오른쪽 마우스 클릭!



볼륨 축소를 눌러줍니다.


조금만 기다리면...



디스크를 축소할 수 있는 창이 나옵니다.



축소할 공간 입력 부분에 리눅스에서 사용할 용량을 GB가 아닌 MB단위로 입력해주세요. (저는 200GB로 했으므로 204800MB!)


할당이 완료되었습니다!



2. 리눅스를 설치하자!


리눅스 설치 디스크로 부팅해줍니다.





설치 형식에서 기타를 누른 후 계속을 눌러줍니다.



아까 할당한 드라이브를 눌러줍니다. (남은 공간이라고 표시됩니다.)

만약 잘못하실 경우 엉뚱한 드라이브가 날라가는 신기한 현상이...ㅎ



더블클릭 후 파티션을 아래 사진과 같이 하신 후 확인을 눌러줍니다.

(스왑 영역은 Windows의 가상 메모리와 비슷한 개념이라고 보시면 됩니다.)





스왑 영역이 할당되었습니다.


다시 남은 공간(아까 할당한 드라이브)을 더블클릭



아래 사진 처럼 해주신 후 확인을 눌러주세요.

(이 ext4 저널링 파일 시스템으로 맞춘 드라이브에 리눅스가 설치됩니다.)




부트로더를 설치할 장치에는 딱히 손은 안대셔도 됩니다.


이제 설치해주시면 됩니다!


부트로더를 설치할 장치는 리눅스에서는 GRUB라는 부트로더가 있는데 이 친구가 있어야 윈도우와 리눅스를 멀티부팅 할 수 있습니다.


저 같은 경우 SSD와 HDD가 있는데, SSD에는 Windows를 설치했고, HDD에는 저의 소중한 데이터(??)들과 리눅스가 설치되어 있습니다.

부트로더를 HDD에 설치했기 때문에 BIOS 설정에서 부팅 순위를 HDD로 1순위로 해주어야 멀티 부팅 메뉴가 나옵니다.


이상 포스팅을 마칩니다!

 

Posted by uniqueone
,
http://kcsdbma.tistory.com/10

 

 

 

Posted by uniqueone
,
http://doubuntu.tistory.com/2

 

 

제 1 장 우분투 설치[14.04LTS]-DoUbuntu Install

** 보다 많은 스크린샷을 보여줌으로 따라하기쉽게 끔 노력하겠습니다.

** 내용이 좋다고 생각되시면 펌보다는 링크(홍보)를 걸어주세요^^

** 댓글에는 인사대신 적용 안되는 부분과 상황을 기재 바랍니다.(오류내용 올려주시면 수정하겠습니다.)

** 참고로 다음카페/네이버카페/네이버블로그에 '우분투하자' '우분투백서' 등을 통폐합하여 여기로 이전합니다.


자 시작합니다. Do~Ubuntu


1. 우분투 설치  준비(Are U Ready?)
 

- 준비물 :  컴퓨터 (우분투라고 해서 무조건 안쓰거나 낮은 사양의 컴퓨터는 사절이다)

                           (필자의 컴퓨터4대는 사양이 CPU-APU/I3/I5  RAM-4G/8G/16G  SSD-128/256/256 입니다.)

      USB 메모리 2G 이상 (공CD 로는 구울수없는 용량이며 공DVD 가능)

      기본지식 : 이 글만 잘따라하면 될듯 합니다.(필요하다면 다른사이트도 참조하세요)      

      마음가짐 : 포기하지 않고 우분투를 써 보겠다 하자하자! 

// 우분투 부팅 이미지파일 다운로드 위치 : http://www.ubuntu.com/download/desktop

// 웹사이트 주소에 들어가면 아래처럼 영어로 된페이지가 뜬다 당황하지말고 가볍게 [ 다운로드 ] 클릭한다

// 다운로드를 클릭하면 다운로드 전에 기부하라는 화면이 뜬다 마우스로 드래그하면 "0"이 된다 모두 "0"을 만들고

// 하단에 다운로드하면 된다! (필자의 경우 말 기부하고 싶었다)

** [ 다운로드 ] 하고 저장 누르면 저장위치가 뜨고 확인하면 받아진다.

** 시간이 조금 걸린다. 커피한잔합시다.


2. 우분투 부팅파일 만들기-USB (Do it!)

설치파일을 다 받았으면 이제 부팅USB 를 만들어야 한다.(모든운영체가 비슷하다 태생이 다른애들은 제외.)

설치 파일이 981MB 이기 때문에 CD로 굽지는 못하지만, DVD로 굽거나, USB 메모리를 이용하면된다.

- DVD : ISO 이미지 굽는법은 따로 설명하지 않겠습니다. (검색창에 ISO 굽기 검색하면 쭉 나옴)

- USB :  우분투 USB를 만들기 위해서는 'Universal-USB-Installer' 라는 프로그램이 필요합니다

          ** 파일은 아래 첨부 (1.9.5.5)    ** 자료실에도 올리겠습니다.

          ** USB메모리는 2기가 이상으로 준비해주세요 

 

- 부팅 USB만들기 : 여기보면 알수 있습니다.

http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows

위 사이트는 영어로 돼있으니 간략하게 정리하면 이렇다

1. 다운로드 받은 파일(Universal-USB-Installer-1.9.5.5.exe)을 클릭 실행한다.

Universal-USB-Installer-1.9.5.5.exe


2. 
아래와 같이 소스에서 우분투(ubuntu)를 선택한다. 

 ** 이 파일은 우분투 이외에도 윈도우나 다른 리눅스도 사용할 수 있다


3. 다운은 이전에 받은 우분투 이미지파일 을 선택한다.

4. 다음은 USB 선택 - 선택 란 옆에 포맷(Format) 체크 필수

5. 만들기( Create )클릭 후 기다리면 끝

** 아직 스크린샷이 준비가 부족해서 조금 어려울 수도 있다

** 잘 모르시는 분은 http://deviantcj.tistory.com/465 - 여기에서 자세한 설명도 참조하세요.


3. 우분투 설치하기(Right Now)

1. 컴퓨터 부팅설정을 변경하는 C-MOS 셋팅(설치에 필요한 필수사항)

** 모든 스크린샷은 가상화면에서 이쁘게 찍었으나 사진자료를 전부 분실(ㅜㅜ)해서 휴대폰이미지로 대체합니다.

** http://www.ubuntu.com/download/desktop/install-ubuntu-desktop 영문설명사이트

** 컴퓨터 마다 다르겠지만 보통 F1 키 / F2 키 / F10 키 / Del(ete) 키 이넷중 하나인데

** 브랜드별로 보면 삼성(F1/Del) Asus(F2/Del) HP(F10) LG(F2/Del)정도로 볼수 있다.

** 물론 보이는 방식도 위의 화면과 같지않다. 어디에나 잘 보다보면 부팅(Boot)가 있다 찾아보자


2. 부트(Boot) 메뉴에서 하드셋팅 관련메뉴로 갑니다.

//

** 위 화면도 제조사별로 다르다 최근 ASUS나 기가바이트같은 회사는 그래픽(GUI)이 많아졌다.


// 아래와 같이 USB부팅을 선택합니다.

// 순서변경 방법은 화면 오른쪽에 있습니다.(보통 '+' '-' 이거나 방향키 상하인경우도 있습니다.)


// 설정이 USB로 되있는지 확인합니다.(설치후에는 다시 원래대로 하드로 선택합니다.)


//셋팅이 끝났으면 저장하고 재부팅 합니다.


3. 정상적으로 USB부트(Boot) 셋팅되었다면 아래와 같이 설치 시작화면이 뜹니다.


4. 설치 시작화면

** 설치 시작 처음화면입니다.(기본이 영어네요 한글로 바꿉시다)

** 아래와 같이 환영메세지와 언어선택화면이 나옵니다.스크롤을 이용해서 내려보면 아래와같이 한글이 나온다.

// 한글을 선택하고 [Ubuntu 설치]를 눌러서 설치 시작합니다.



5. 기본정보 확인과 기본셋팅입니다.

// 위 그림과 같이 [설치 중 업데이트 다운로드] 는 체크하지 않습니다.(시간도 많이 걸리고 나중에 하는게 편함)

// [서드파티 소프트웨어 설치] 는 해도 되고 안해도 됩니다.

// 체크 됬으면 [계속] 을 눌러 다음으로 진행합니다.


6. 파티션 설정에 관련하여 새로 설치하거나 덮어쓰거나 사용자 정의할수 있습니다.

// 위와 같이 [기타] 를 선택하고 [계속] 을 클릭합니다.

** 필자의 경우 윈도우들과 듀얼부팅을 사용하기에 필수로 기타를 선택했습니다.

** 모두 지우고 다시 설치 시  하드가 파티션없이 설치 될수 있으니 기타를 선택해주시면 좋겠습니다.


7. 파티션 설정 화면입니다.*(윈도우가 설치되어있다면 윈도우 파티션은 건드리지 마세요)

** 남은공간이 보입니다. 여기에 분활하든 통으로 잡으시던 합니다.

// 남은공간 선택하시고 아래에 [+] 를 눌러주세요

** 위와 같이 파티션 만들기 화면이 나옵니다.

// [ 크기 ] : 파티션 크기를 설정합니다.

** 파티션크기는 필자의 경우 전부를 잡았습니다. 30~50기가 정도로 잡으면 전체적을 쓰는데 지장이 없기 때문입니다.

** 필요에 따라 크기를 적습니다. 참고로 1000MB 가 1GB 정도로 보시면 됩니다.(물런 1024K 가 1M 입니다)

** 메모리가 적어서 SWAP공간(하드디스크의 가상메모리)이 필요하면 적당량 빼줍니다.(메모리 많으면 통)

// [ 새 파티션의 종류] : 주 파티션을 선택합니다.

// [ 용도 ] : 스크린샷은 없으나 포맷방식이 나오는데 EXT4 최신을 선택합니다.

// [ 마운트위치 ] : 음~설치 위치정도인데 루트로 보시면 됩니다. ' / ' <<선택합니다.


// 셋팅 완료 후에 [ 지금 설치 ] 를 클릭하면 다음 화면이 나옵니다.

// 필자의 경우 메모리가 8기가 이상이라서 SWAP을 무시 해서 저런메세지가 나왔습니다. 무시합니다. [ 계속 ]클릭


8. 국가(지역) 선택화면(시간과 날짜 설정을 위함입니다. 나중에 설정변경 가능)

// 서울 선택하고 [ 계속] 클릭


8. 키보드 선택 및 배치화면

// 위 화면 처럼 하단에 [ 한국어 ] [ 한국어 ] 선택하고 [ 계속 ] 클릭합니다.


8. 설치 파일 복사 화면 시작.(끝날 때 까지 가만히 둡니다.시간이 조금 걸림)

** 오른쪽에 SKIP 누르면 안됩니다!!

** 드디여 설치의 끝이 보이네요


8. 파일 복사완료 화면

// 완료완료 창이 뜨면 [ 지금 다시 시작] 클릭합니다.

** 자 이제 부터 맘에 준비 재부팅후 바로 C-MOS 셋팅으로 들어가야 합니다.(위에서 했던거 기억나시죠?;;)


9. 재부팅후 바로 씨모스 셋팅화면으로 들어옵니다.

// 다시 정상적으로 하드부팅으로 바꾸기 위해서 위와같이 다시 하드를 상단으로 옴겨서 셋합니다.

** 다시 돌려놓지 않으면 평생 USB로 부팅해서 설치만 합니다.ㅎㅎ


10. 재부팅후 멀티 부팅이라면 아래와 같이 부트메뉴가 나옵니다.(우분트만 있다면 뜨지 않습니다.)

 

11. 처음 부팅후 첫 화면입니다.

** 자 이제 설치는 끝이 났습니다.

** 다음 포스팅에서는 실사용을 위한 셋팅(준비작업)을 해보겠습니다.

** 사용자 설정/메뉴/방법 등등


** 운영체제 포스팅 하려니 너무 시간이 오래 걸렸네요. 긴글 읽느라 수고하셧구요 다음시간에 뵙겠습니다.

** 아래 넘들을 제가 포스팅중에 아는동생과 함께 처리 했습니다.

** 첫포스팅이 끝났읍니다. 다음포스팅에 뵙겠습니다.

** 참고로 아래는 메뉴 이름 입니다. 익혀두세요.


 

Posted by uniqueone
,

https://github.com/vlfeat/matconvnet/issues/509

 

딥러닝서버에서 ResNet을 실행시키니

Attempt to execute SCRIPT vl_nnconv as a function: ...

Error in dagnn.Conv/forward ...

이런 식으로 나오길래

 

아래 novelmartis의 말대로 Matlab's default path를 중복되지 않게 path를 설정했더니 된다.

 

 

 

novelmartis commented on Apr 20

Posted by uniqueone
,

https://github.com/vlfeat/matconvnet/issues/575

 

나도 아래의 Ben의 방법대로 고쳤더니 pooling_gpu.cu (line 163), bilinearsampler_gpu.cu (line 25)를 수정했더니 고쳐짐

 

 

jlee614 commented on Jun 11 edited

Hi,

I downloaded the last version of MatConvNet (ver1.0-beta20) and tried compiling with GPU support.

I have a GTX1080 card which requires CUDA 8.0 (otherwise there's an error: "nvcc fatal : Unsupported gpu architecture 'compute_61' ")

Anyways, when I try to compile with CUDA 8.0, it seems to work for the most part but then I get the following:

vl_compilenn: CUDA: MEX config file: 'C:\Program Files\MATLAB\R2016a\toolbox\distcomp\gpu\extern\src\mex\win64\mex_CUDA_win64.xml'
data.cu
datamex.cu
nnconv.cu
nnfullyconnected.cu
nnsubsample.cu
nnpooling.cu
nnnormalize.cu
nnbnorm.cu
nnbias.cu
nnbilinearsampler.cu
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.
im2row_gpu.cu
subsample_gpu.cu
copy_gpu.cu
> C:/Users/Justin/Documents/MATLAB/matconvnet-1.0-beta20/matlab/src/bits/impl/pooling_gpu.cu(163): error: function "atomicAdd(double *, double)" has already been defined

1 error detected in the compilation of "C:/Users/Justin/AppData/Local/Temp/tmpxft_00001afc_00000000-8_pooling_gpu.cpp1.ii".
pooling_gpu.cu
Error using vl_compilenn>nvcc_compile (line 521)
Command "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc" -c
"C:\Users\Justin\Documents\MATLAB\matconvnet-1.0-beta20\matlab\src\bits\impl\pooling_gpu.cu" -DNDEBUG -DENABLE_GPU -DENABLE_DOUBLE -D__SSSE3__
-gencode=arch=compute_61,code=\"sm_61,compute_61\" -I"C:\Program Files\MATLAB\R2016a\extern\include" -I"C:\Program
Files\MATLAB\R2016a\toolbox\distcomp\gpu\extern\include" -gencode=arch=compute_61,code=\"sm_61,compute_61\" -Xcompiler /MD -o
"C:\Users\Justin\Documents\MATLAB\matconvnet-1.0-beta20\matlab\mex.build\bits\impl\pooling_gpu.obj" failed.

Error in vl_compilenn (line 466)
nvcc_compile(opts, srcs{i}, objfile, flags.nvcc) ;

I googled for the error bolded and came across this link which I think may have something to with what's going on:
[http://stackoverflow.com/questions/37566987/cuda-atomicadd-for-doubles-definition-error]

I don't know if it's a proper fix or not, but I ended up doing the following:

pooling_gpu.cu, line 163
(commented out atomicadd)

bilinearsampler_gpu.cu, line 25
(commented out atomicadd)

This made the compiling work and I ran vl_testnn without any problems after compiling. Posting this here in case anyone else has the same problem and also if anyone has any further insights as to what caused the problem and what issues may arise from me commenting out the lines above.

Thanks!
-Justin

 

------------------------------------------------------------------------------------

missilzolair commented on Jun 12

Hi,

I just encounter the same issue, except that I am using a gtx970, with compute capability 5.2. Apparently, it's related to the fact that with Pascal (compute capability 6.0) a native double version of atomicAdd has been added.

In my case, if I simply comment the overloaded definition of atomicAdd, I will still get an error. The right solution (http://stackoverflow.com/questions/37566987/cuda-atomicadd-for-doubles-definition-error/37569519) is to use the following macro:

#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600
#else
<... place here your own pre-pascal atomicAdd definition ...>
#endif

I added the aforementioned macro at the two locations that Justin mentioned and the code compiles just fine with CUDA 8.0 on gpu architecture < 6.0.

Cheers,
Ben

 

------------------------------------------------------------------------------------

 

jlee614 commented on Jun 13

Ben,

Thanks for your help! I came across that same link (sorry, I had my syntax wrong and it didn't post properly the first time), and your suggestion is the correct one.

Thanks again!
Justin

 

------------------------------------------------------------------------------------

 

lenck commented on Jun 14

Thanks @jlee614 for the report and @missilzolair for suggesting the bugfix!
It's now pushed to the master...

 

 

Posted by uniqueone
,