記事一覧表示

ubuntuにtorchを入れた話

諸事情により、Lua言語で書かれた学習プログラムを動かすことになったので、
torch(Lua言語で書かれた機械学習フレームワーク)の環境を整えた。
まずは環境確認。

# cat /etc/os-release 
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"

OSは、Ubuntu16.04

# cat /usr/include/cudnn.h
     ・
     ・
#define CUDNN_MAJOR 7
#define CUDNN_MINOR 6
#define CUDNN_PATCHLEVEL 2
     ・
     ・

cuDNNは、7.6.2

# nvcc -V
     ・
     ・
Cuda compilation tools, release 10.0, V10.0.130

CUDAは、10.0
だった。

ここを参考にtorchセットアップから入れようとした所、以下のようなエラーが…

# ./install.sh
              ・
              ・
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_cublas_device_LIBRARY (ADVANCED)
    linked by target "THC" in directory /root/torch/extra/cutorch/lib/THC
              ・
              ・

調べてみた所、セットアップ内のcmake3.6がcudaの設定に失敗しているらしい。
ページ通りに続けていると、

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

torchが無事に動いた!