简体   繁体   English

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

[英]CMake error while installing Torch in Ubuntu

I'm trying to install Torch in my PC (Ubuntu).我正在尝试在我的 PC (Ubuntu) 中安装 Torch。 I follow the steps described in the Torch website.我按照 Torch 网站中描述的步骤进行操作。 However, when I run然而,当我跑

$./install.sh

I got the error:我得到了错误:

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

So I tried to analyze the CMake log and there is this following error:所以我尝试分析 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

Why I have got this error?为什么我有这个错误? And how can I resolve it?我该如何解决?

Sorry for my english, it's a little rusty, if anyone can't understand it, tell me to explain all of this in another way.抱歉我的英语有点生疏,如果有人看不懂,请告诉我以另一种方式解释所有这些。 Thanks for everyone who helps me with it.感谢所有帮助我的人。

PS: I installed NVidia CUDA Toolkit before all of it, maybe the Torch is "strange", because of it. PS:我在这之前安装了 NVidia CUDA Toolkit,也许 Torch 是“奇怪的”,因为它。

The cublas_device library was deprecated in CUDA 9.2 and removed in CUDA 10. Looks like your version of Torch is building against cuDNN that is expected to work with CUDA 9.2 or older. cublas_device库在 CUDA 9.2 中已弃用,并在 CUDA 10 中删除。看起来您的 Torch 版本是针对 cuDNN 构建的,预计可与 CUDA 9.2 或更早版本一起使用。

You can either:您可以:

  1. Use this fork of Torch that works with CUDA 10 https://github.com/nagadomi/distro使用适用于 CUDA 10 https://github.com/nagadomi/distro的 Torch 分支
  2. Downgrade to CUDA 9.2 or older降级到 CUDA 9.2 或更高版本

Another aspect that you need to be aware of is to ensure your NVidia GPU driver, cuDNN and CUDA versions all works together.您需要注意的另一个方面是确保您的 NVidia GPU 驱动程序、cuDNN 和 CUDA 版本都可以协同工作。 Refer to https://docs.nvidia.com/deploy/cuda-compatibility/index.html .请参阅https://docs.nvidia.com/deploy/cuda-compatibility/index.html

CUDA 工具包和驱动程序兼容性

https://github.com/nagadomi/waifu2x/issues/253#issuecomment-445448928 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

It appears that torch does not support CUDA 10. Downgrade to CUDA 9.1 Torch 似乎不支持 CUDA 10。降级到 CUDA 9.1

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

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

Upgrade CMAKE to 3.12 worked for me.将 CMAKE 升级到 3.12 对我有用。

Installation guide:安装指南:

https://askubuntu.com/questions/1125808/how-to-upgrade-cmake-in-arm-based-ubuntu 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM