rusty1s / pytorch_sparse

PyTorch Extension Library of Optimized Autograd Sparse Matrix Operations
MIT License
1.01k stars 147 forks source link

M3 Compile issues #380

Open bybeye opened 2 months ago

bybeye commented 2 months ago

I attempted to compile pytorch_sparse version 0.6.18 using C++ with the commands provided on the homepage, but I encountered an error.

4 warnings generated. [ 54%] Building CXX object CMakeFiles/torchsparse.dir/csrc/diag.cpp.o [ 58%] Building CXX object CMakeFiles/torchsparse.dir/csrc/ego_sample.cpp.o [ 62%] Building CXX object CMakeFiles/torchsparse.dir/csrc/hgt_sample.cpp.o [ 66%] Building CXX object CMakeFiles/torchsparse.dir/csrc/metis.cpp.o [ 70%] Building CXX object CMakeFiles/torchsparse.dir/csrc/neighbor_sample.cpp.o [ 75%] Building CXX object CMakeFiles/torchsparse.dir/csrc/relabel.cpp.o [ 79%] Building CXX object CMakeFiles/torchsparse.dir/csrc/rw.cpp.o [ 83%] Building CXX object CMakeFiles/torchsparse.dir/csrc/saint.cpp.o [ 87%] Building CXX object CMakeFiles/torchsparse.dir/csrc/sample.cpp.o [ 91%] Building CXX object CMakeFiles/torchsparse.dir/csrc/spmm.cpp.o [ 95%] Building CXX object CMakeFiles/torchsparse.dir/csrc/version.cpp.o [100%] Linking CXX shared library libtorchsparse.dylib Undefined symbols for architecture arm64: "___kmpc_fork_call", referenced from: void at::internal::invoke_parallel<void at::parallel_for<ind2ptr_cpu(at::Tensor, long long)::$_0>(long long, long long, long long, ind2ptr_cpu(at::Tensor, long long)::$_0 const&)::'lambda'(long long, long long)>(long long, long long, long long, ind2ptr_cpu(at::Tensor, long long)::$_0 const&) in convert_cpu.cpp.o void at::internal::invoke_parallel<void at::parallel_for<ptr2ind_cpu(at::Tensor, long long)::$_1>(long long, long long, long long, ptr2ind_cpu(at::Tensor, long long)::$_1 const&)::'lambda'(long long, long long)>(long long, long long, long long, ptr2ind_cpu(at::Tensor, long long)::$_1 const&) in convert_cpu.cpp.o void at::internal::invoke_parallel<void at::parallel_for<ego_k_hop_sample_adj_cpu(at::Tensor, at::Tensor, at::Tensor, long long, long long, bool)::$_0>(long long, long long, long long, ego_k_hop_sample_adj_cpu(at::Tensor, at::Tensor, at::Tensor, long long, long long, bool)::$_0 const&)::'lambda'(long long, long long)>(long long, long long, long long, ego_k_hop_sample_adj_cpu(at::Tensor, at::Tensor, at::Tensor, long long, long long, bool)::$_0 const&) in ego_sample_cpu.cpp.o

After facing this issue, I switched to the master branch and encountered a different error related to the compile version.

/Users/xxx/Applications/libtorch/include/ATen/ATen.h:4:2:error: C++17 or later compatible compiler is required to use ATen.

error C++17 or later compatible compiler is required to use ATen.

^ In file included from /Users/xxx/Applications/pytorch_sparse-master/csrc/convert.cpp:4: In file included from /Users/xxx/Applications/libtorch/include/torch/script.h:3: In file included from /Users/xxx/Applications/libtorch/include/torch/csrc/api/include/torch/types.h:3: In file included from /Users/xxx/Applications/libtorch/include/ATen/ATen.h:7: In file included from /Users/xxx/Applications/libtorch/include/ATen/Context.h:3: In file included from /Users/xxx/Applications/libtorch/include/ATen/BlasBackend.h:3: /Users/xxx/Applications/libtorch/include/c10/util/Exception.h:122:34: error: no template named 'variant' in namespace 'std' using warning_variant_t = std::variant<UserWarning, DeprecationWarning>;

Thanks for your help.