pytorch/test/cpp_extensions/cusolver_extension.cpp
Masaki Kozuki d4493b27ee make TORCH_(CUDABLAS|CUSOLVER)_CHECK usable in custom extensions (#67161)
Summary:
Make `TORCH_CUDABLAS_CHECK` and `TORCH_CUSOLVER_CHECK` available in custom extensions by exporting the internal functions called by the both macros.

Rel: https://github.com/pytorch/pytorch/issues/67073

cc xwang233 ptrblck

Pull Request resolved: https://github.com/pytorch/pytorch/pull/67161

Reviewed By: jbschlosser

Differential Revision: D31984694

Pulled By: ngimel

fbshipit-source-id: 0035ecd1398078cf7d3abc23aaefda57aaa31106
2021-10-29 17:27:07 -07:00

18 lines
424 B
C++

#include <torch/extension.h>
#include <ATen/cuda/CUDAContext.h>
#include <cusolverDn.h>
torch::Tensor noop_cusolver_function(torch::Tensor x) {
cusolverDnHandle_t handle;
TORCH_CUSOLVER_CHECK(cusolverDnCreate(&handle));
TORCH_CUSOLVER_CHECK(cusolverDnDestroy(handle));
return x;
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def("noop_cusolver_function", &noop_cusolver_function, "a cusolver function");
}