rusty1s / pytorch_scatter

PyTorch Extension Library of Optimized Scatter Operations
https://pytorch-scatter.readthedocs.io
MIT License
1.5k stars 178 forks source link

Question about install C++ API #433

Open yhd-ai opened 3 months ago

yhd-ai commented 3 months ago

I install torch_scatter via pip. And in which path should I conduct your code `mkdir build cd build

Add -DWITH_CUDA=on support for CUDA support

cmake -DCMAKE_PREFIX_PATH="..." .. make make install`

should I download your source code? I am sorry I am not familiar with C++

rusty1s commented 3 months ago

This is only relevant for the C++ API. Since you are using Python, pip install is sufficient.

yhd-ai commented 3 months ago

Hi, but I need to install C++ API cuz I script my own model via torch.jit.script. When I using it in c++ I got the error like #147

yhd-ai commented 3 months ago

I followed your tutorial and when I ran "make" command, I got error as follows: make:*** No targets specified and no makefile found. Stop. My platform is win10

Then I am trying to ran cmake -G “Unix Makefiles” … to generate makefiles, But I got error as follows: CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 6.3.0 -- The CXX compiler identification is GNU 6.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/MinGW/bin/gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/MinGW/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Python3: D:/Anaconda3/envs/NewGDNv2/libs/python310.lib (found version "3.10.14") found components: Development Development.Module Development.Embed -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- 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 - not found -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - no -- Found Threads: TRUE -- Found CUDA: C:/v11.3 (found version "11.3") -- The CUDA compiler identification is NVIDIA 11.3.58 -- Detecting CUDA compiler ABI info -- Detecting CUDA compiler ABI info - failed -- Check for working CUDA compiler: C:/v11.3/bin/nvcc.exe -- Check for working CUDA compiler: C:/v11.3/bin/nvcc.exe - broken CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeTestCUDACompiler.cmake:59 (message): The CUDA compiler

"C:/v11.3/bin/nvcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: 'G:/pytorch_scatter-2.0.9/build/CMakeFiles/CMakeScratch/TryCompile-ns435e'

Run Build Command(s): "C:/Program Files/CMake/bin/cmake.exe" -E env VERBOSE=1 C:/PROGRA~2/GnuWin32/bin/make.exe -f Makefile cmTC_1ec6f/fast
C:/PROGRA~2/GnuWin32/bin/make.exe  -f CMakeFiles/cmTC_1ec6f.dir/build.make CMakeFiles/cmTC_1ec6f.dir/build
make.exe[1]: Entering directory `G:/pytorch_scatter-2.0.9/build/CMakeFiles/CMakeScratch/TryCompile-ns435e'
Building CUDA object CMakeFiles/cmTC_1ec6f.dir/main.cu.obj
C:/v11.3/bin/nvcc.exe -forward-unknown-to-host-compiler   -D_WINDOWS -Xcompiler="/W3 /GR /EHsc"  -Xcompiler="-MDd  -Zi -Ob0 -Od /RTC1" -MD -MT CMakeFiles/cmTC_1ec6f.dir/main.cu.obj -MF CMakeFiles/cmTC_1ec6f.dir/main.cu.obj.d -x cu -c G:/pytorch_scatter-2.0.9/build/CMakeFiles/CMakeScratch/TryCompile-ns435e/main.cu -o CMakeFiles/cmTC_1ec6f.dir/main.cu.obj -Xcompiler=-FdCMakeFiles/cmTC_1ec6f.dir/,-FS
Program
c1xx: fatal error C1083: cannot open source file: “C:/Program”: No such file or directory
W3
c1xx: fatal error C1083: cannot open source file: “Files/Git/W3”: No such file or directory
main.cu
main.cu
make.exe[1]: *** [CMakeFiles/cmTC_1ec6f.dir/main.cu.obj] error 2
make.exe[1]: Leaving directory `G:/pytorch_scatter-2.0.9/build/CMakeFiles/CMakeScratch/TryCompile-ns435e'
make.exe: *** [cmTC_1ec6f/fast] error 2

CMake will not be able to correctly generate this project. Call Stack (most recent call first): G:/libtorch/share/cmake/Caffe2/public/cuda.cmake:41 (enable_language) G:/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include) G:/libtorch/share/cmake/Torch/TorchConfig.cmake:68 (find_package) CMakeLists.txt:16 (find_package)

-- Configuring incomplete, errors occurred!