LoginSignup
4
4

More than 5 years have passed since last update.

Ubuntu14.04にtorchも入れてみる

Last updated at Posted at 2016-12-01

はじめに

これまで、ChainerやTensorFlow、CaffeやTheanoなどをインストールした。ここにきてTorchも入れる必要が出たので、インストールする。

Torchホームページの手順に従って進める。
http://torch.ch/docs/getting-started.html#_

環境

GPU:GTX1070
OS:Ubuntu14.04
CUDA:8.0 RC
cuDNN:5.1
python2.7.6など

インストール済みパッケージ

Chainer
TensorFlow
Theano
Caffeなど

dependenciesをインストールする

まずホーム直下にgit cloneして、必要なdependenciesを入れる。

git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch
bash install-deps

Trochをインストールする

次にインストールする。

./install.sh
.....
.....
Do you want to automatically prepend the Torch install location
to PATH and LD_LIBRARY_PATH in your /home/ohmasa/.bashrc? (yes/no)
[yes] >>> 
yes

最後にbashrcにPATHを書いたろか?と聞いてきたので、yesとした。PATHを有効にする。

source ~/.bashrc

動作確認する

ちゃんとインストール出来てるか、動作確認する。

まずthと打って試してみる。

th

  ______             __   |  Torch7 
 /_  __/__  ________/ /   |  Scientific computing for Lua. 
  / / / _ \/ __/ __/ _ \  |  Type ? for help 
 /_/  \___/_/  \__/_//_/  |  https://github.com/torch 
                          |  http://torch.ch 

th> torch.Tensor(1,2,3)
(1,.,.) = 
  0  0  0
  0  0  0
[torch.DoubleTensor of size 1x2x3]

                                                                      [0.0005s] 
th> 
                                                                      [0.0000s] 
th> exit
Do you really want to exit ([y]/n)? y

何をやったかイマイチわからんが、うまく動作してるみたい。

次にtest.shを実行する。

./test.sh
.....
.....
160/169 VolumetricDilatedMaxPooling_backward_batch ...................... [WAIT]THCudaCheck FAIL file=/home/ohmasa/torch/extra/cutorch/lib/THC/generic/THCStorage.cu line=65 error=2 : out of memory
160/169 VolumetricDilatedMaxPooling_backward_batch ...................... [ERROR]
161/169 SpatialReplicationPadding_forward ............................... [ERROR]
162/169 PReLU_forward ................................................... [PASS]
163/169 SpatialConvolutionMM_backward_batch ............................. [PASS]
164/169 RReLU_forward ................................................... [PASS]
165/169 ClassNLLCriterionMultipleTargetWeights .......................... [PASS]
166/169 Sigmoid_forward ................................................. [PASS]
167/169 Sqrt_forward .................................................... [PASS]
168/169 Sqrt_zero ....................................................... [PASS]
169/169 TemporalConvolution_backward .................................... [PASS]
Completed 1903 asserts in 169 tests with 0 failures and 2 errors
--------------------------------------------------------------------------------
VolumetricDilatedMaxPooling_backward_batch
 Function call failed
.....
.....
 An error was found while running tests!

最後の方でエラーが出た。max poolingbackward計算あたりで問題が発生したみたい。out of memoryと出てるのでGPUのmemory不足だろうか?

ネットで検索してみたが、ここ
https://github.com/karpathy/neuraltalk2/issues/52
など読むと、データのサイズを下げることで対応できるので、今回のインストールは成功したものとみなす。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4