Libtorch, cuda 8 and libc10_cuda.so

I am running into a problem trying to use libtorch on my CUDA 8 based system.

It seems to stem from the fact that in the latest nightlies, there is no libc10_cuda.so in the cuda 8 libtorch preview. Only libc10.so Is this intended behavior going forward or is adding libc10_cuda support for CUDA 8 on “the roadmap” for pytorch?

I am trying to build a (really) simple C++ app that uses CUDA on the GPU.

I am using the CUDA 8 preview build of libtorch (because there is no cuda 8 stable release of libtorch yet and I am using CUDA 8)

Here is the error / cmake spew that I am seeing with CUDA 8 and the cuda 8 libtorch (it happens for both release and debug builds):

cmake -DCMAKE_PREFIX_PATH=/home/nathan/libtorch/ -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 -DCMAKE_BUILD_TYPE=Debug …
– The C compiler identification is GNU 5.4.0
– The CXX compiler identification is GNU 5.4.0
– 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 exact version “8.0”)
– Found OpenCV: /usr/local (found suitable version “3.2.0”, minimum required is “3.2.0”)
– Found CUDA: /usr/local/cuda-8.0 (found suitable version “8.0”, minimum required is “7.0”)
– Caffe2: CUDA detected: 8.0
– Caffe2: CUDA nvcc is: /usr/local/cuda-8.0/bin/nvcc
– Caffe2: CUDA toolkit directory: /usr/local/cuda-8.0
– Caffe2: Header version is: 8.0
– Found CUDNN: /usr/include
– Found cuDNN: v6.0.21 (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
– Autodetected CUDA architecture(s): 6.1;6.1
– Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61
CMake Error at /home/nathan/libtorch/share/cmake/Caffe2/Caffe2Targets.cmake:103 (message):
The imported target “c10_cuda” references the file

 "/home/nathan/libtorch/lib/libc10_cuda.so"

but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.

  • An install or uninstall procedure did not complete successfully.

  • The installation package was faulty and contained

    “/home/nathan/libtorch/share/cmake/Caffe2/Caffe2Targets.cmake”

but not all the files it references.

Call Stack (most recent call first):
/home/nathan/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:116 (include)
/home/nathan/libtorch/share/cmake/Torch/TorchConfig.cmake:39 (find_package)
CMakeLists.txt:10 (find_package)

  • Unsurprisingly, I get a segfault if I try to link to the CUDA 9 based libtorch on my cuda 8 system (but hey, it was a worth a try)