安装Torch

**

安装Torch7,按照官网操作,运行./install.sh时报错:

**
参考:http://www.pianshen.com/article/5473287386/

2 errors detected in the compilation of "/tmp/tmpxft_00001b24_00000000-6_THCTensorMath.cpp1.ii".
CMake Error at THC_generated_THCTensorMath.cu.o.cmake:267 (message):
  Error generating file
  /home/itl/Torch7/distro/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMath.cu.o


lib/THC/CMakeFiles/THC.dir/build.make:112: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMath.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMath.cu.o] Error 1
CMakeFiles/Makefile2:172: recipe for target 'lib/THC/CMakeFiles/THC.dir/all' failed
make[1]: *** [lib/THC/CMakeFiles/THC.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

解决方案

当前版本cuda与torch不兼容,设置一下环境变量

export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__"

然后执行

./clean.sh   #删除之前的安装文件

再重新安装

./install.sh
source ~/.bashrc  #使环境变量生效

在这里插入图片描述
在这里插入图片描述

检查

th

在这里插入图片描述


版权声明:本文为weixin_43846196原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。