version.cpp 552 Bytes
Newer Older
quyuanhao123's avatar
quyuanhao123 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifdef WITH_PYTHON
#include <Python.h>
#endif
#include <torch/script.h>
#include "sparse.h"

#ifdef WITH_HIP
#include <hip/hip_runtime.h>
#endif

#ifdef _WIN32
#ifdef WITH_PYTHON
#ifdef WITH_HIP
PyMODINIT_FUNC PyInit__version_cuda(void) { return NULL; }
#else
PyMODINIT_FUNC PyInit__version_cpu(void) { return NULL; }
#endif
#endif
#endif

SPARSE_API int64_t cuda_version() {
#ifdef WITH_HIP
  return TORCH_HIP_VERSION;
#else
  return -1;
#endif
}

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