-
Notifications
You must be signed in to change notification settings - Fork 24.4k
CUDA extension with TORCH_CUDABLAS_CHECK
throws undefined symbol error at import
#67073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
TORCH_CUDABLAS_CHECK
throws undefined symbol errorTORCH_CUDABLAS_CHECK
throws undefined symbol error at import
Could this be failing because |
EDIT: I saw different behaviors of |
…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: #67073 cc xwang233 ptrblck Pull Request resolved: #67161 Reviewed By: jbschlosser Differential Revision: D31984694 Pulled By: ngimel fbshipit-source-id: 0035ecd1398078cf7d3abc23aaefda57aaa31106
Does this affect version 1.10? |
…ytorch#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: pytorch#67073 cc xwang233 ptrblck Pull Request resolved: pytorch#67161 Reviewed By: jbschlosser Differential Revision: D31984694 Pulled By: ngimel fbshipit-source-id: 0035ecd1398078cf7d3abc23aaefda57aaa31106
@byronyi it seems like the macro has not been available since the beginning (of course, including 1.10) in custom extensions. |
Summary: Skip building extensions if windows following #67161 (comment) Related issue: #67073 cc ngimel xwang233 ptrblck Pull Request resolved: #67735 Reviewed By: bdhirsh Differential Revision: D32141250 Pulled By: ngimel fbshipit-source-id: 9bfdb7cf694c99f6fc8cbe9033a12429b6e4b6fe
Retried The code used are as follows: #include <iostream>
#include <torch/extension.h>
#include <ATen/cuda/CUDAContext.h>
#include <cusparse.h>
void a_custom_function() {
printf("hello world\n");
cusparseHandle_t sparse_handle;
TORCH_CUDASPARSE_CHECK(cusparseCreate(&sparse_handle));
TORCH_CUDASPARSE_CHECK(cusparseDestroy(sparse_handle));
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def("a_custom_function", &a_custom_function, "a custom function");
} # setup.py
from setuptools import setup, Extension
from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension
cublas_module = CUDAExtension(
name='cuda_ext',
sources=['cuda_ext.cpp']
)
setup(
name='cuda_ext_root',
version='0.1',
ext_modules=[cublas_module],
cmdclass={
'build_ext': BuildExtension.with_options(use_ninja=False)
}
) my environment is:
|
Closed as fixed. Thanks @crcrpar ! 😄 |
Uh oh!
There was an error while loading. Please reload this page.
🐛 Bug
CUDA extension with
TORCH_CUDABLAS_CHECK
throws undefined symbol errorTo Reproduce
Prepare two files to build a CUDA extension
build cuda extension with
run test with
got error message
Expected behavior
No error for
TORCH_CUDABLAS_CHECK
in cuda extensions.Environment
pytorch is source build using gcc 10.3 from latest master commit
Additional context
N/A
cc @malfet @zou3519 @crcrpar @ptrblck @ngimel
The text was updated successfully, but these errors were encountered: