version.cpp 599 Bytes
Newer Older
1
#ifdef WITH_PYTHON
rusty1s's avatar
rusty1s committed
2
#include <Python.h>
3
#endif
Matthias Fey's avatar
Matthias Fey committed
4
#include <torch/script.h>
rusty1s's avatar
rusty1s committed
5
6
7
8
9

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

Matthias Fey's avatar
Matthias Fey committed
10
11
#include "macros.h"

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

Matthias Fey's avatar
Matthias Fey committed
22
23
namespace sparse {
SPARSE_API int64_t cuda_version() noexcept {
rusty1s's avatar
rusty1s committed
24
25
26
27
28
29
#ifdef WITH_CUDA
  return CUDA_VERSION;
#else
  return -1;
#endif
}
Matthias Fey's avatar
Matthias Fey committed
30
} // namespace sparse
rusty1s's avatar
rusty1s committed
31

Matthias Fey's avatar
Matthias Fey committed
32
33
static auto registry = torch::RegisterOperators().op(
    "torch_sparse::cuda_version", &sparse::cuda_version);