在Ubuntu中安装Torch时CMake错误

时间:2018-09-25 15:27:09

标签: linux cmake install torch

我正在尝试在PC(Ubuntu)中安装Torch。我遵循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 /home/leonardo/torch/extra/cutorch/lib/THC

所以我尝试分析CMake日志,并且出现以下错误:

/home/leonardo/torch/extra/cutorch/build/CMakeFiles/CMakeTmp/src.c:5:20: error: ‘luaL_setfuncs’ undeclared (first use in this function); did you mean ‘lua_setfenv’?
   long i = sizeof(&luaL_setfuncs);
                    ^~~~~~~~~~~~~
                    lua_setfenv
/home/leonardo/torch/extra/cutorch/build/CMakeFiles/CMakeTmp/src.c:5:20: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/cmTC_0eb19.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_0eb19.dir/src.c.o' failed

为什么会出现此错误?而我该如何解决呢?

对不起,我的英语有点生锈,如果有人听不懂,请告诉我以另一种方式解释所有这一切。 感谢所有帮助我的人。

PS:我先安装了NVidia CUDA Toolkit,也许是因为它造成了Torch的“奇怪”。

4 个答案:

答案 0 :(得分:2)

cublas_device库在CUDA 9.2中已弃用,而在CUDA 10中已删除。看起来您的Torch版本是针对cuDNN构建的,预期可在CUDA 9.2或更早版本上使用。

您可以:

  1. 使用可与CUDA 10 https://github.com/nagadomi/distro配合使用的Torch叉子
  2. 降级到CUDA 9.2或更旧版本

您需要了解的另一方面是确保NVidia GPU驱动程序,cuDNN和CUDA版本都可以一起使用。请参阅https://docs.nvidia.com/deploy/cuda-compatibility/index.html

CUDA toolkit and driver compatibility

答案 1 :(得分:1)

https://github.com/nagadomi/waifu2x/issues/253#issuecomment-445448928

git clone https://github.com/nagadomi/distro.git ~/torch --recursive
cd ~/torch
./install-deps
./clean.sh
./update.sh

答案 2 :(得分:0)

似乎手电筒不支持CUDA10。降级到CUDA 9.1

https://developer.nvidia.com/cuda-91-download-archive

答案 3 :(得分:0)

https://github.com/clab/dynet/issues/1457#issuecomment-424347220

将CMAKE升级到3.12对我有用。

安装指南:

https://askubuntu.com/questions/1125808/how-to-upgrade-cmake-in-arm-based-ubuntu

sudo apt remove cmake
wget https://cmake.org/files/v3.8/cmake-3.8.2.tar.gz
tar xf cmake-3.8.2.tar.gz
cd cmake-3.8.2
./configure
sudo make install
cmake --version