Installing pytorch cmake error

So I have to compile from source as the GPU I’m using (gtx770) is not officially supported. I tried to compile the source but kept getting an error on something along the lines of cmake:

<---------------------------------------------------------------------------------->
running install
running build_deps
CMake Deprecation Warning at CMakeLists.txt:5 (CMAKE_POLICY):
The OLD behavior for policy CMP0026 will be removed from a future version
of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.

– Found OpenMP_C: -fopenmp
– Found OpenMP_CXX: -fopenmp
– Compiling with OpenMP support
– Could not find hardware support for NEON on this machine.
– No OMAP3 processor on this machine.
– No OMAP4 processor on this machine.
– SSE2 Found
– SSE3 Found
– AVX Found
– AVX2 Found
– TH_SO_VERSION: 1
– Atomics: using C11 intrinsics
– Checking for [mkl_gf_lp64 - mkl_gnu_thread - mkl_core - gomp - pthread - m - dl]
– Library mkl_gf_lp64: /home/huangxinan97/anaconda3/lib/libmkl_gf_lp64.so
– Library mkl_gnu_thread: /home/huangxinan97/anaconda3/lib/libmkl_gnu_thread.so
– Library mkl_core: /home/huangxinan97/anaconda3/lib/libmkl_core.so
– Found OpenMP_C: -fopenmp
– Found OpenMP_CXX: -fopenmp
– Library gomp: -fopenmp
– Library pthread: /usr/lib/x86_64-linux-gnu/libpthread.so
– Library m: /usr/lib/x86_64-linux-gnu/libm.so
– Library dl: /usr/lib/x86_64-linux-gnu/libdl.so
– MKL library found
– Found a library with BLAS API (mkl).
– Found a library with LAPACK API. (mkl)
– Configuring done
– Generating done
– Build files have been written to: /home/huangxinan97/pytorch/torch/lib/build/TH
[100%] Built target TH
Install the project…
– Install configuration: β€œRelease”
– Installing: /home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTH.so.1
– Set runtime path of β€œ/home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTH.so.1” to β€œβ€
– Installing: /home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTH.so
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/TH.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THAllocator.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THMath.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THBlas.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THDiskFile.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THFile.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THFilePrivate.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGeneral.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateAllTypes.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateDoubleType.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateFloatType.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateHalfType.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateLongType.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateIntType.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateShortType.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateCharType.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateByteType.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateFloatTypes.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THGenerateIntTypes.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THLapack.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THLogAdd.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THMemoryFile.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THRandom.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THSize.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THStorage.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THTensor.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THTensorApply.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THTensorDimApply.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THTensorMacros.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THVector.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THAtomic.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/THHalf.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/vector/AVX.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/vector/AVX2.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THBlas.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THBlas.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THLapack.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THLapack.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THStorage.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THStorage.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THStorageCopy.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THStorageCopy.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensor.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensor.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensorConv.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensorConv.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensorCopy.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensorCopy.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensorLapack.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensorLapack.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensorMath.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensorMath.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensorRandom.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THTensorRandom.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THVectorDispatch.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH/generic/THVector.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/share/cmake/TH/THConfig.cmake
– TH_LIBRARIES: /home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTH.so.1
– THS_SO_VERSION: 1
– Configuring done
– Generating done
– Build files have been written to: /home/huangxinan97/pytorch/torch/lib/build/THS
[100%] Built target THS
Install the project…
– Install configuration: β€œRelease”
– Installing: /home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTHS.so.1
– Set runtime path of β€œ/home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTHS.so.1” to β€œβ€
– Installing: /home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTHS.so
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THS/THS.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THS/THSGenerateAllTypes.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THS/THSGenerateFloatTypes.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THS/THSGenerateIntTypes.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THS/THSTensor.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THS/generic/THSTensor.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THS/generic/THSTensor.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THS/generic/THSTensorMath.c
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THS/generic/THSTensorMath.h
– TH_LIBRARIES: /home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTH.so.1
– Compiling with OpenMP support
CMake Warning (dev) at CMakeLists.txt:69 (LINK_DIRECTORIES):
This command specifies the relative path

as a link directory.

Policy CMP0015 is not set: link_directories() treats paths relative to the
source dir. Run β€œcmake --help-policy CMP0015” for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.

– THNN_SO_VERSION: 1
– Configuring done
– Generating done
– Build files have been written to: /home/huangxinan97/pytorch/torch/lib/build/THNN
[100%] Built target THNN
Install the project…
– Install configuration: β€œRelease”
– Installing: /home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTHNN.so.1
– Set runtime path of β€œ/home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTHNN.so.1” to β€œβ€
– Installing: /home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTHNN.so
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THNN/THNN.h
– Up-to-date: /home/huangxinan97/pytorch/torch/lib/tmp_install/include/THNN/generic/THNN.h
– Removing -DNDEBUG from compile flags
– TH_LIBRARIES: /home/huangxinan97/pytorch/torch/lib/tmp_install/lib/libTH.so.1
– Compiling with MAGMA support
– MAGMA INCLUDE DIRECTORIES: /home/huangxinan97/anaconda3/include
– MAGMA LIBRARIES: /home/huangxinan97/anaconda3/lib/libmagma.a
– MAGMA V2 check: 1
– Autodetected CUDA architecture(s): 3.0
– got cuda version 10.0
– Found CUDA with FP16 support, compiling with torch.CudaHalfTensor
– CUDA_NVCC_FLAGS: -DTH_INDEX_BASE=0 -I/home/huangxinan97/pytorch/torch/lib/tmp_install/include -I/home/huangxinan97/pytorch/torch/lib/tmp_install/include/TH -I/home/huangxinan97/pytorch/torch/lib/tmp_install/include/THC -I/home/huangxinan97/pytorch/torch/lib/tmp_install/include/THS -I/home/huangxinan97/pytorch/torch/lib/tmp_install/include/THCS -I/home/huangxinan97/pytorch/torch/lib/tmp_install/include/THNN -I/home/huangxinan97/pytorch/torch/lib/tmp_install/include/THCUNN -DOMPI_SKIP_MPICXX=1;-D__CUDA_NO_HALF_OPERATORS__;-gencode;arch=compute_30,code=sm_30;-DCUDA_HAS_FP16=1
– THC_SO_VERSION: 1
– Configuring done
– Generating done
– Build files have been written to: /home/huangxinan97/pytorch/torch/lib/build/THC
[ 2%] Building NVCC (Device) object CMakeFiles/THC.dir/THC_generated_THCTensorScatterGather.cu.o
[ 2%] Building NVCC (Device) object CMakeFiles/THC.dir/THC_generated_THCTensorIndex.cu.o
[ 4%] Building NVCC (Device) object CMakeFiles/THC.dir/generated/THC_generated_THCTensorMaskedChar.cu.o
[ 4%] Building NVCC (Device) object CMakeFiles/THC.dir/generated/THC_generated_THCTensorSortShort.cu.o
[ 6%] Building NVCC (Device) object CMakeFiles/THC.dir/generated/THC_generated_THCTensorMathCompareTShort.cu.o
[ 8%] Building NVCC (Device) object CMakeFiles/THC.dir/generated/THC_generated_THCTensorMathCompareShort.cu.o
[ 8%] Building NVCC (Device) object CMakeFiles/THC.dir/generated/THC_generated_THCTensorMathPointwiseShort.cu.o
[ 9%] Building NVCC (Device) object CMakeFiles/THC.dir/generated/THC_generated_THCTensorMathReduceShort.cu.o
/home/huangxinan97/pytorch/torch/lib/THC/THCAtomics.cuh(98): error: cannot overload functions distinguished by return type alone

1 error detected in the compilation of β€œ/tmp/tmpxft_00005920_00000000-4_THCTensorScatterGather.cpp4.ii”.
CMake Error at THC_generated_THCTensorScatterGather.cu.o.cmake:267 (message):
** Error generating file**
** /home/huangxinan97/pytorch/torch/lib/build/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorScatterGather.cu.o**

CMakeFiles/THC.dir/build.make:9077: recipe for target β€˜CMakeFiles/THC.dir/THC_generated_THCTensorScatterGather.cu.o’ failed
make[2]: *** [CMakeFiles/THC.dir/THC_generated_THCTensorScatterGather.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs…
/home/huangxinan97/pytorch/torch/lib/THC/THCAtomics.cuh(98): error: cannot overload functions distinguished by return type alone

1 error detected in the compilation of β€œ/tmp/tmpxft_0000594e_00000000-4_THCTensorIndex.cpp4.ii”.
CMake Error at THC_generated_THCTensorIndex.cu.o.cmake:267 (message):
** Error generating file**
** /home/huangxinan97/pytorch/torch/lib/build/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorIndex.cu.o**

CMakeFiles/THC.dir/build.make:7572: recipe for target β€˜CMakeFiles/THC.dir/THC_generated_THCTensorIndex.cu.o’ failed
make[2]: *** [CMakeFiles/THC.dir/THC_generated_THCTensorIndex.cu.o] Error 1
CMakeFiles/Makefile2:72: recipe for target β€˜CMakeFiles/THC.dir/all’ failed
make[1]: *** [CMakeFiles/THC.dir/all] Error 2
Makefile:129: recipe for target β€˜all’ failed
make: *** [all] Error 2
<----------------------------------------------------------------------------------->

If anyone can help me figure this out that would be awesome, thanks!

Hi,

I’m afraid you cuda version is too old or the compute capability is too low.
@ngimel should be able to confirm that?

1 Like