warmspringwinds / pytorch-cpp

Pytorch C++ Library
369 stars 68 forks source link

compile error about function declare #10

Open hyer opened 6 years ago

hyer commented 6 years ago

When I compiled the project, I got errors:

pytorch.cpp:356:63: error: ‘THNN_Threshold_updateOutput’ was not declared in this scope THNN_Threshold_updateOutput(input, input, 0, 0, true) ; ...

I have installed ATen. Any help?

warmspringwinds commented 6 years ago

Hi @hyer , Did you install our fork of ATen ?

And please provide more info about your system: ubuntu?, cuda 8? and so on 😃

hyer commented 6 years ago

@warmspringwinds Sorry. My machine: Ubuntu14.04, CUDA8.0.

Here are my cmake results:

-- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- 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 -- Detecting C compile features -- Detecting C compile features - 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 -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda-8.0 (found suitable version "8.0", minimum required is "5.5")

I have clone the ATen with: git clone --recursive https://github.com/warmspringwinds/pytorch-cpp The ATen and HDF were builded successlly. When Make pytorch-cpp, got errors:

[ 8%] Linking CXX executable opencv_realtime_webcam_imagenet_classification ../ATen/build/src/ATen/libATen.so.1: undefined reference to THNN_FloatSpatialDepthWiseConvolution_updateOutput' ../ATen/build/src/ATen/libATen.so.1: undefined reference toTHNN_DoubleSpatialDepthWiseConvolution_updateGradInput' ../ATen/build/src/ATen/libATen.so.1: undefined reference to THNN_CudaDoubleSpatialDepthWiseConvolution_accGradParameters' ../ATen/build/src/ATen/libATen.so.1: undefined reference toTHNN_FloatSpatialDepthWiseConvolution_updateGradInput' ../ATen/build/src/ATen/libATen.so.1: undefined reference to THNN_CudaSpatialDepthWiseConvolution_accGradParameters' ../ATen/build/src/ATen/libATen.so.1: undefined reference toTHNN_FloatSpatialDepthWiseConvolution_accGradParameters' ../ATen/build/src/ATen/libATen.so.1: undefined reference to THNN_CudaDoubleSpatialDepthWiseConvolution_updateOutput' ../ATen/build/src/ATen/libATen.so.1: undefined reference toTHNN_DoubleSpatialDepthWiseConvolution_updateOutput' ../ATen/build/src/ATen/libATen.so.1: undefined reference to THNN_DoubleSpatialDepthWiseConvolution_accGradParameters' ../ATen/build/src/ATen/libATen.so.1: undefined reference toTHNN_CudaSpatialDepthWiseConvolution_updateOutput' ../ATen/build/src/ATen/libATen.so.1: undefined reference to THNN_CudaDoubleSpatialDepthWiseConvolution_updateGradInput' ../ATen/build/src/ATen/libATen.so.1: undefined reference toTHNN_CudaSpatialDepthWiseConvolution_updateGradInput' collect2: error: ld returned 1 exit status make[2]: [opencv_realtime_webcam_imagenet_classification] Error 1 make[1]: [CMakeFiles/opencv_realtime_webcam_imagenet_classification.dir/all] Error 2 make: *** [all] Error 2

warmspringwinds commented 6 years ago

@hyer Thank you.

Could you try running this in bash pip install pyyaml ?

warmspringwinds commented 6 years ago

@hyer and install and build from scratch

hyer commented 6 years ago

@warmspringwinds I have installed pyyaml. It didn't make any difference. I think there may be sth wrong with the CMakeLists.txt or the build process.