Unverified Commit ae1fce51 authored by Matthias Fey's avatar Matthias Fey Committed by GitHub
Browse files

cmake fixes (#278)

parent e60840dd
...@@ -2,7 +2,23 @@ ...@@ -2,7 +2,23 @@
#include <torch/extension.h> #include <torch/extension.h>
int64_t cuda_version(); #if (defined __cpp_inline_variables) || __cplusplus >= 201703L
#define SCATTER_INLINE_VARIABLE inline
#else
#ifdef _MSC_VER
#define SCATTER_INLINE_VARIABLE __declspec(selectany)
#else
#define SCATTER_INLINE_VARIABLE __attribute__((weak))
#endif
#endif
namespace scatter {
int64_t cuda_version() noexcept;
namespace detail {
SCATTER_INLINE_VARIABLE int64_t _cuda_version = cuda_version();
} // namespace detail
} // namespace scatter
torch::Tensor scatter_sum(torch::Tensor src, torch::Tensor index, int64_t dim, torch::Tensor scatter_sum(torch::Tensor src, torch::Tensor index, int64_t dim,
torch::optional<torch::Tensor> optional_out, torch::optional<torch::Tensor> optional_out,
......
...@@ -13,13 +13,15 @@ PyMODINIT_FUNC PyInit__version_cpu(void) { return NULL; } ...@@ -13,13 +13,15 @@ PyMODINIT_FUNC PyInit__version_cpu(void) { return NULL; }
#endif #endif
#endif #endif
int64_t cuda_version() { namespace scatter {
int64_t cuda_version() noexcept {
#ifdef WITH_CUDA #ifdef WITH_CUDA
return CUDA_VERSION; return CUDA_VERSION;
#else #else
return -1; return -1;
#endif #endif
} }
} // namespace scatter
static auto registry = static auto registry = torch::RegisterOperators().op(
torch::RegisterOperators().op("torch_scatter::cuda_version", &cuda_version); "torch_scatter::cuda_version", &scatter::cuda_version);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment