torch / torch7

http://torch.ch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CUDA 9.0 + cudnn 7.0 + torch build error

Spiral-Galaxy opened this issue · comments

I have CUDA 9.0 + cudnn 7.0 on my computer and my OS is Ubuntu 16.04.3.
When I run the code ./install.sh , which is the third line in this official installation guide: http://torch.ch/docs/getting-started.html#installing-torch

And then it threw an error and terminated the compilation.
Here is the error message:

Building on 4 cores
-- Found Torch7 in /home/leonardo/torch/install
-- Removing -DNDEBUG from compile flags
-- TH_LIBRARIES: TH
-- MAGMA not found. Compiling without MAGMA support
-- Autodetected CUDA architecture(s): 5.0
-- got cuda version 9.0
-- Found CUDA with FP16 support, compiling with torch.CudaHalfTensor
-- CUDA_NVCC_FLAGS: -gencode;arch=compute_50,code=sm_50;-DCUDA_HAS_FP16=1
-- THC_SO_VERSION: 0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/leonardo/torch/extra/cutorch/build
[  1%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMath.cu.o
[  2%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMathPairwise.cu.o
[  4%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir/generated/THC_generated_THCTensorMathPointwiseShort.cu.o
[  4%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir/generated/THC_generated_THCTensorMathCompareShort.cu.o
[  5%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir/generated/THC_generated_THCTensorMathReduceShort.cu.o
/home/leonardo/torch/extra/cutorch/lib/THC/generic/THCTensorMath.cu(393): error: more than one operator "==" matches these operands:
            function "operator==(const __half &, const __half &)"
            function "operator==(half, half)"
            operand types are: half == half

/home/leonardo/torch/extra/cutorch/lib/THC/generic/THCTensorMath.cu(414): error: more than one operator "==" matches these operands:
            function "operator==(const __half &, const __half &)"
            function "operator==(half, half)"
            operand types are: half == half

2 errors detected in the compilation of "/tmp/tmpxft_000064e3_00000000-4_THCTensorMath.cpp4.ii".
CMake Error at THC_generated_THCTensorMath.cu.o.cmake:267 (message):
  Error generating file
  /home/leonardo/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMath.cu.o


lib/THC/CMakeFiles/THC.dir/build.make:2735: 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

It seems that there is something wrong and the compilation is failed. I cannot use 'th' to start an interactive session.

And I found some answers through the Internet, which suggested to add an environment variable
export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__"

I have tried but there is no use.

What should I do to complete the installation?

commented

Did you run ./clean.sh?

./clean.sh
export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__"
./install.sh

@tastyminerals Thank you! It works.

commented

@Spiral-Galaxy @tastyminerals Hi! Sorry for bothering you. I was also building torch on CUDA9 + cudnn7, and successfully went through the installation process by calling the export command. However, I cannot require cudnn in torch, as 'libcudnn (R5) not found in library path., yet I have cudnn 7 installed and cannot find a libcudnn.so.5. May I know if you have any suggestions for this issue?

commented

Did you run luarocks install cudnn?

vim ./.bashrc
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBARARY_PATH

@Jun0413 libcudnn.so.5 is from cuDNN v5. What you want is libcudnn.so.7, which is from cuDNN v7

@Jun0413 you might need to check out the Revision 7 branch:

git clone https://github.com/soumith/cudnn.torch -b R7
cd cudnn.torch
luarocks make cudnn-scm-1.rockspec


Older versions
For version CuDNN R1, checkout the branch R1 For version CuDNN R2, checkout the branch R2 For version CuDNN R3, checkout the branch R3 For version CuDNN R4, checkout the branch R4

commented

@ProGamerGov I actually had tried pointing the library path to libcudnn.so.7, but it looked like the torch which I installed following the official documentation did not support cuDNN v7. Do you know any version that supports v7?
@Naruto-Sasuke The version does not match and I tried your approach which did not work...
@tastyminerals I tried before and it did not help.

commented

Hi all! I just tried https://github.com/soumith/cudnn.torch/issues/383, and it seems that I can normally call require 'cudnn'. Thank you very much!

commented

@kaisark That worked! Thank you very much!

soumith/cudnn.torch#383
is not exist anymore. Please share the solution again. Thanks @Jun0413 !

Hi all! I just tried https://github.com/soumith/cudnn.torch/issues/383, and it seems that I can normally call require 'cudnn'. Thank you very much!

Sorry to find that this issue has gone and I'm facing just the same problem, can you share what you did? Thank u in advance!

commented

@HopLee6 @weiyx16
https://github.com/soumith/cudnn.torch/issues/383
Hey the link works for me.

@HopLee6 @weiyx16
https://github.com/soumith/cudnn.torch/issues/383
Hey the link works for me.
yes, Thank you! I found that myself later, it seems that directly clicking the provided url in your previous answer would lead to a strange place.. Anyway, I have solved the problem, so nice of you!