version.cpp 539 Bytes
Newer Older
1
#ifdef WITH_PYTHON
rusty1s's avatar
rusty1s committed
2
#include <Python.h>
3
#endif
rusty1s's avatar
rusty1s committed
4
#include <torch/script.h>
Daniel Falbel's avatar
Daniel Falbel committed
5
#include "sparse.h"
rusty1s's avatar
rusty1s committed
6
7
8
9
10
11

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

#ifdef _WIN32
12
#ifdef WITH_PYTHON
rusty1s's avatar
rusty1s committed
13
14
15
16
17
#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
18
#endif
19
#endif
rusty1s's avatar
rusty1s committed
20

Daniel Falbel's avatar
Daniel Falbel committed
21
SPARSE_API int64_t cuda_version() {
rusty1s's avatar
rusty1s committed
22
23
24
25
26
27
28
29
#ifdef WITH_CUDA
  return CUDA_VERSION;
#else
  return -1;
#endif
}

static auto registry =
rusty1s's avatar
rusty1s committed
30
    torch::RegisterOperators().op("torch_sparse::cuda_version", &cuda_version);