pytorch_scatter: Building C++ API from source failed
I have CUDA 11.2 and CUDNN 8.2.1, PyTorch 1.10 and when I try to build pytorch_scatter from source I hit this error:
[ 9%] Building CXX object CMakeFiles/torchscatter.dir/csrc/cpu/scatter_cpu.cpp.o
[ 18%] Building CXX object CMakeFiles/torchscatter.dir/csrc/cpu/segment_coo_cpu.cpp.o
[ 27%] Building CXX object CMakeFiles/torchscatter.dir/csrc/cpu/segment_csr_cpu.cpp.o
[ 36%] Building CUDA object CMakeFiles/torchscatter.dir/csrc/cuda/scatter_cuda.cu.o
/home/junting_zhang/projects/pytorch_scatter/csrc/cuda/utils.cuh(12): error: more than one user-defined conversion from "const c10::Half" to "__half" applies:
function "__half::__half(float)"
function "__half::__half(__half &&)"
/home/junting_zhang/projects/pytorch_scatter/csrc/cuda/utils.cuh(18): error: more than one user-defined conversion from "const c10::Half" to "__half" applies:
function "__half::__half(float)"
function "__half::__half(__half &&)"
2 errors detected in the compilation of "/home/junting_zhang/projects/pytorch_scatter/csrc/cuda/scatter_cuda.cu".
CMakeFiles/torchscatter.dir/build.make:120: recipe for target 'CMakeFiles/torchscatter.dir/csrc/cuda/scatter_cuda.cu.o' failed
make[2]: *** [CMakeFiles/torchscatter.dir/csrc/cuda/scatter_cuda.cu.o] Error 1
CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/torchscatter.dir/all' failed
make[1]: *** [CMakeFiles/torchscatter.dir/all] Error 2
Makefile:148: recipe for target 'all' failed
make: *** [all] Error 2
Any idea on how to fix?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (7 by maintainers)
Hi
Checking the make commands that are issued, I think that the CMake version is missing the following definitions
add_definitions(-D__CUDA_NO_HALF_CONVERSIONS__) add_definitions(-D__CUDA_NO_BFLOAT16_CONVERSIONS__) add_definitions(-D__CUDA_NO_HALF2_OPERATORS__)
Adding them results in a correct build even with the original code
I’m still not sure what’s causing this TBH, and
halfprecision support should work fine when using our provided wheels. One option would be to add aUSE_HALFflag that users that want to install from source and encounter this error can use.