CMake error while installing Torch in Ubuntu

10,673

Solution 1

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.

You can either:

  1. Use this fork of Torch that works with CUDA 10 https://github.com/nagadomi/distro
  2. Downgrade to CUDA 9.2 or older

Another aspect that you need to be aware of is to ensure your NVidia GPU driver, cuDNN and CUDA versions all works together. Refer to https://docs.nvidia.com/deploy/cuda-compatibility/index.html.

CUDA toolkit and driver compatibility

Solution 2

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
Share:
10,673

Related videos on Youtube

Leonardo Martins
Author by

Leonardo Martins

Updated on June 04, 2022

Comments

  • Leonardo Martins
    Leonardo Martins almost 2 years

    I'm trying to install Torch in my PC (Ubuntu). I follow the steps described in the Torch website. 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:

    /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.

    • Tsyvarev
      Tsyvarev over 5 years
      The "CMake Error" you got means that a library, corresponded to CUDA_cublas_device_LIBRARY variable, hasn't been found. According to variable name, this is cublas_device library. I am not expert in CUDA, so cannot suggest where to search this library and even if it should exist. But the project requires it. As for the compilation error in CMakeLog.txt, it is most likely just a check, whether function/variable luaL_setfuncs exists. Depending on the check results, the project should configure itself accordingly. No worries in that.
  • Maged Saeed
    Maged Saeed almost 5 years
    Thanks for your answer!
  • Chris
    Chris almost 4 years
    And after ./update.sh, use . ~/torch/install/bin/torch-activate to activate torch
  • Jan Černý
    Jan Černý almost 4 years
    Please interpret tutorial in your answer