version.cpp 457 Bytes
Newer Older
quyuanhao123's avatar
quyuanhao123 committed
1
2
3
#include <Python.h>
#include <torch/script.h>

yangzhong's avatar
yangzhong committed
4
5
#ifdef WITH_CUDA
#include <cuda.h>
quyuanhao123's avatar
quyuanhao123 committed
6
7
8
#endif

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

int64_t cuda_version() {
yangzhong's avatar
yangzhong committed
17
18
#ifdef WITH_CUDA
  return CUDA_VERSION;
quyuanhao123's avatar
quyuanhao123 committed
19
20
21
22
23
24
25
#else
  return -1;
#endif
}

static auto registry =
    torch::RegisterOperators().op("torch_scatter::cuda_version", &cuda_version);