flatironinstitute / flatironinstitute/sparse_dot
sdm.dot_product_mkl ends with segmentation fault for sparse-sparse multiplication
- Dominant language
- Python
- Stars
- 93
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
Hi, thanks for your packages for the mkl python interface. It's quite useful.
However we encounter some unexpected results when performing sparse-sparse matrix multiplication.
It sometimes leads to a segmentation fault.
A minimum code snippet to reproduce the bug:
Please first download the following two matrices (the bug only appears for certain matrices)
A.npz: https://drive.google.com/file/d/1NRT8SchOS3XefZokbFOpqJw6CIygTEQ-
B.npz: https://drive.google.com/file/d/1aFDa2BbNQRGmmlAceIjK4JoogVQfKJY_/
```
import scipy.sparse as sparse
import sparse_dot_mkl as sdm
sdm.mkl_set_num_threads_local(1)
A = sparse.load_npz("./A.npz") # shape: (1934, 2381304)
B = sparse.load_npz("./B.npz") # shape: (100, 1934)
print("A.shape:", A.shape, "B.shape:", B.shape)
C = sdm.dot_product_mkl(A.T, B.T) # segmentation fault
# C = sdm.dot_product_mkl(B, A).T # works normally
print(C.shape)
```
If the first line is called, it will cause a segmentation fault.
However, if the second line is called, the segmentation fault does not happen.
We also try to first transform A matrix into coo format, or print(A) prior to the matrix multiplication, and the segmentation fault won't happen either.
However it is quite uncomfortable because we didn't find the exact reason for that.
So we turn to your help for this. Thank you in advance.
(We tried this on multiple machines and for this example it always happens)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.