本文记录以下几个部分:
- Torch在Ubuntu 16.0上的安装
- error: more than one operator “==” matches these operands
- 模块的install与make
- error: ‘libcudnn (R5) not found in library path.’
Torch在Ubuntu 16.0上的安装
首先需要配置好显卡驱动,CUDA, cuDNN, 相关说明随处可见,附加一个多版本CUDA转换的链接。
Torch 7.0 安装步骤(默认安装路径在home/usr/下:
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch
bash install-deps
bash install.sh
第四行代码在执行的时候通常会出现问题。一个常见的报错是“error: more than one operator “==” matches these operands”。 那么原因是啥?又该如何解决?
more than one operator “==” matches these operands
原因在于cuda和torch的头文件都提供了相同的重载运算符,这样编译器在使用的时候就会出现混乱。
解决方法:禁止使用cuda的头文件编译torch
export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__"
模块的install与make
如果模块是以zip从github下下来的或者是直接clone下来的,可能install名令并没有用,这个时候,需要使用以下命令:
luarocks make *.rockspec
## 而不是下面的
luarocks install *.rockspec
error: ‘libcudnn (R5) not found in library path
这个报错常见的可能原因是torch7里原本的默认是cudnn5的版本而现在机子上可能装的是更高的版本比如cudnn7,那么针对cudnn7(小博主现装的是cuda 9, cudnn7),需要下载一个模块,并且编译
git clone https://github.com/soumith/cudnn.torch -b R7
cd cudnn.torch
luarocks make cudnn-scm-1.rockspec