version.cpp 519 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
4
5
6
7
8
#include <Python.h>
#include <torch/script.h>

#ifdef WITH_CUDA
#include <cuda.h>
#endif

#ifdef _WIN32
rusty1s's avatar
update  
rusty1s committed
9
10
11
12
13
#ifdef WITH_CUDA
PyMODINIT_FUNC PyInit__version_cuda(void) { return NULL; }
#else
PyMODINIT_FUNC PyInit__version_cpu(void) { return NULL; }
#endif
rusty1s's avatar
rusty1s committed
14
15
#endif

Matthias Fey's avatar
Matthias Fey committed
16
17
namespace scatter {
int64_t cuda_version() noexcept {
rusty1s's avatar
rusty1s committed
18
19
20
21
22
23
#ifdef WITH_CUDA
  return CUDA_VERSION;
#else
  return -1;
#endif
}
Matthias Fey's avatar
Matthias Fey committed
24
} // namespace scatter
rusty1s's avatar
rusty1s committed
25

Matthias Fey's avatar
Matthias Fey committed
26
27
static auto registry = torch::RegisterOperators().op(
    "torch_scatter::cuda_version", &scatter::cuda_version);