torch / cutorch

A CUDA backend for Torch7
Other
337 stars 208 forks source link

Install cutorch error: identifier "__half_as_ushort" is undefined #757

Closed TonyChouZJU closed 7 years ago

TonyChouZJU commented 7 years ago

Hello, I'm trying to install cutorh using 'luarocks install cutorch'. But I got the following error while compling.

Building on 8 cores
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found Torch7 in /home/zyb/torch/install
-- Found CUDA: /usr/local/cuda (found suitable version "7.5", minimum required is "6.5") 
-- Removing -DNDEBUG from compile flags
-- TH_LIBRARIES: TH
-- MAGMA not found. Compiling without MAGMA support
-- Automatic GPU detection failed. Building for common architectures.
-- Autodetected CUDA architecture(s): 3.0;3.5;5.0;5.2;5.2+PTX
-- got cuda version 7.5
-- Found CUDA with FP16 support, compiling with torch.CudaHalfTensor
-- CUDA_NVCC_FLAGS: -gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_52,code=compute_52;-DCUDA_HAS_FP16=1
-- THC_SO_VERSION: 0
-- Performing Test HAS_LUAL_SETFUNCS
-- Performing Test HAS_LUAL_SETFUNCS - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/luarocks_cutorch-scm-1-6039/cutorch/build

[ 2%] [ 2%] [ 3%] [ 4%] [ 6%] [ 6%] [ 7%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCStorageCopy.cu.o [ 9%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCReduceApplyUtils.cu.o Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCBlas.cu.o Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCStorage.cu.o Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCSleep.cu.o Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCHalf.cu.o Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensor.cu.o Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorCopy.cu.o [ 10%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMath.cu.o [ 11%] [ 12%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMath2.cu.o Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMathBlas.cu.o [ 13%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMathMagma.cu.o [ 14%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMathPairwise.cu.o [ 15%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMathReduce.cu.o [ 17%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMathScan.cu.o [ 18%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorIndex.cu.o [ 19%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorConv.cu.o [ 20%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorRandom.cu.o [ 21%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorScatterGather.cu.o [ 22%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorTopK.cu.o /tmp/luarocks_cutorch-scm-1-6039/cutorch/lib/THC/THCTensorTopK.cuh(120): error: identifier "__half_as_ushort" is undefined

/tmp/luarocks_cutorch-scm-1-6039/cutorch/lib/THC/THCTensorTopK.cuh(127): error: identifier "__ushort_as_half" is undefined

2 errors detected in the compilation of "/tmp/tmpxft_00005b7a_00000000-16_THCTensorTopK.compute_52.cpp1.ii". CMake Error at THC_generated_THCTensorTopK.cu.o.cmake:267 (message): Error generating file /tmp/luarocks_cutorch-scm-1-6039/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorTopK.cu.o

make[2]: [lib/THC/CMakeFiles/THC.dir/./THC_generated_THCTensorTopK.cu.o] Error 1 make[2]: Waiting for unfinished jobs.... make[1]: [lib/THC/CMakeFiles/THC.dir/all] Error 2 make: [all] Error 2

Error: Build error: Failed building.

I have install cuda-7.5 and cudnn 4.0

Check version of nvcc

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

driver version
Thu Apr 27 15:40:21 2017       
+------------------------------------------------------+                       
| NVIDIA-SMI 352.39     Driver Version: 352.39         |                       
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 750 Ti  Off  | 0000:01:00.0      On |                  N/A |
| 39%   40C    P8     0W /  46W |    753MiB /  2047MiB |      0%      Default |

Could anyone give me some suggestions? Thanks in advance!

killeent commented 7 years ago

I need to guard the TopK half specific code. I will fix this.

soumith commented 7 years ago

fixed in master

TonyChouZJU commented 7 years ago

The above error has gone. But arise a new error

[ 85%] [ 85%] [ 85%] [ 86%] [ 87%] [ 89%] [ 89%] Building CXX object lib/THC/CMakeFiles/THC.dir/THCCachingHostAllocator.cpp.o
Building CXX object lib/THC/CMakeFiles/THC.dir/THCCachingAllocator.cpp.o
[ 90%] Building C object lib/THC/CMakeFiles/THC.dir/THCGeneral.c.o
Building C object lib/THC/CMakeFiles/THC.dir/THCTensorCopy.c.o
Building C object lib/THC/CMakeFiles/THC.dir/THCStorageCopy.c.o
Building CXX object lib/THC/CMakeFiles/THC.dir/THCStream.cpp.o
Building C object lib/THC/CMakeFiles/THC.dir/THCTensor.c.o
Building CXX object lib/THC/CMakeFiles/THC.dir/THCTensorRandom.cpp.o
In file included from generic/THCTensor.c:1:0,
                 from /tmp/luarocks_cutorch-scm-1-4258/cutorch/lib/THC/THCGenerateAllTypes.h:17,
                 from /tmp/luarocks_cutorch-scm-1-4258/cutorch/lib/THC/THCTensor.c:7:
/tmp/luarocks_cutorch-scm-1-4258/cutorch/lib/THC/generic/THCTensor.c: In function ‘THCudaByteTensor_newExpand’:
/tmp/luarocks_cutorch-scm-1-4258/cutorch/lib/THC/generic/THCTensor.c:304:3: error: implicit declaration of function ‘THLongStorage_calculateExpandGeometry’ [-Werror=implicit-function-declaration]
   THLongStorage_calculateExpandGeometry(tensor->size,
   ^
cc1: some warnings being treated as errors
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THCTensor.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [lib/THC/CMakeFiles/THC.dir/all] Error 2
make: *** [all] Error 2

Thanks again!

natanielruiz commented 7 years ago

I have the same problem as OP and noticed that the commit for fixing this only added some comments. I am using CUDA 8.0.61 and driver version 375.66, also have cudnn v5.

Thanks !

mescarra commented 7 years ago

@natanielruiz, I'm in the exact same situation. Could you solve it?

natanielruiz commented 7 years ago

Basically there's two IF statement and in those statement it uses the undefined variables. I just bypassed the IF statements and forced it into the ELSE statement. It worked..

mescarra commented 7 years ago

Thanks @natanielruiz, that did the job for me too.