在Ubuntu安装Torch时出现CMake错误。

12

我正在尝试在我的电脑上(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工具包,可能是因为它的缘故,Torch出了点问题。


1
你得到的“CMake错误”意味着一个库,对应于CUDA_cublas_device_LIBRARY变量,没有被找到。根据变量名,这是cublas_device库。我不是CUDA方面的专家,所以无法建议在哪里搜索此库,甚至是否应该存在。但是项目需要它。至于CMakeLog.txt中的编译错误,很可能只是检查函数/变量luaL_setfuncs是否存在。根据检查结果,项目应相应地进行配置。不用担心。 - Tsyvarev
4个回答

12

cublas_device 库已在 CUDA 9.2 中弃用并在 CUDA 10 中删除。看起来您的 Torch 版本正在构建针对期望与 CUDA 9.2 或更早版本兼容的 cuDNN。

您可以选择:

  1. 使用此 Torch 的分支,该分支可与 CUDA 10 一起使用 https://github.com/nagadomi/distro
  2. 降级到 CUDA 9.2 或更早版本

您还需要注意确保您的 NVidia GPU 驱动程序、cuDNN 和 CUDA 版本都能够协同工作。请参阅https://docs.nvidia.com/deploy/cuda-compatibility/index.html

CUDA toolkit and driver compatibility


谢谢你的回答! - Maged Saeed

4

在执行./update.sh之后,使用. ~/torch/install/bin/torch-activate来激活torch。 - Chris

1

请在您的答案中解释教程。 - Jan Černý

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接