You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: GCXS slicing can take inordinate amount of time / crash kernel #853
bugIndicates an unexpected problem or unintended behaviorneed more infoIndicates that an issue, pull request, or discussion needs more informationupstream
I checked that this issue has not been reported before list of issues.
I have confirmed this bug exists on the latest version of sparse.
I have confirmed this bug exists on the main branch of sparse.
Describe the bug
I have noticed that under some circumstances, slicing a GCXS array will take an unexpecteda amount of time, or crash the kernel after a runtime of >45 seconds.
A slice returned within a short amount of time, provided the sparsity of the matrix.
b[:, 1, :, :, :], b[:, :, 1, :, :] and b[:, :, :, 1, :] return after a fraction of a second. b[: :, :, :, 1] for some reason takes ~4 seconds on my machine.
Actual results
Kernel crash after >45 seconds of runtime.
Please describe your system.
OS and version: Ubuntu 22.04, latest update
sparse version: '0.16.0b4'
NumPy version: '2.1.3'
Numba version: '0.61.0'
Relevant log output
The Kernel crashed while executing code in the current cell or a previous cell.
Please review the code in the cell(s) to identify a possible cause of the failure.
Click here for more info.
View Jupyter log for further details.
19:39:49.903 [info] Restarted f3b136f3-350b-49cc-90d0-e337e991f066
19:46:21.391 [error] Disposing session as kernel process died ExitCode: undefined, Reason:
(this is the full, unabridged log output from the crashed session)
Okay, updated my sparse version to current HEAD (sparse-0.16.1.dev3+ge669565), created a fresh conda env, and just did pip install -e . in the sparse source tree... Result is the same. Then I did a new conda env, this time with python 3.12, the same result.
bugIndicates an unexpected problem or unintended behaviorneed more infoIndicates that an issue, pull request, or discussion needs more informationupstream
Activity
0xDA41 commentedon Mar 23, 2025
Here's a transcript of running the same in a python repl:
hameerabbasi commentedon Apr 9, 2025
Funny, I can't seem to reproduce this:
I also tested with
NUMBA_BOUNDSCHECK=1to make sure no out-of-bounds accesses were happening. Can you provide more info?0xDA41 commentedon Apr 10, 2025
Sure, what can I give you so it's hopefully easier to reproduce?
It's a Conda-Forge venv, with Python 1.13, on Ubuntu 22.04 and an Intel 11th gen CPU. Python just quits, I'm suspecting an infinite loop of some kind.
hameerabbasi commentedon Apr 10, 2025
That's counter intuitive, the algorithm is completely deterministic and would also lead to a timeout on my machine if there was an infinite loop.
0xDA41 commentedon Apr 11, 2025
Okay so I did an experiment with
python -vvv, and it didn't make me any smarter. Here'spip listin case it helps:0xDA41 commentedon Apr 11, 2025
Okay, updated my sparse version to current HEAD (
sparse-0.16.1.dev3+ge669565), created a fresh conda env, and just didpip install -e .in the sparse source tree... Result is the same. Then I did a new conda env, this time with python 3.12, the same result.Here's the test script in full:
hameerabbasi commentedon Apr 11, 2025
Hmm, the only deps we have are NumPy and Numba, and I couldn't replicate the issue with those versions. Let me try a Ubuntu 22.04 VM.
hameerabbasi commentedon Apr 11, 2025
Hmm, you're right. It does happen on Ubuntu 22.04 with Intel emulation on my ARM Mac; so it's either x86-64 related or Linux/Ubuntu 22.04 related.
I'll look into this more, it's a curious bug indeed.
Edit: What's more, it happens with the Numba JIT entirely disabled, which means very likely this is a pure-NumPy bug you've hit on!
Edit 2: It exits almost immediately, it doesn't hang for me.
hameerabbasi commentedon Apr 11, 2025
It seems to be Numba-related, I've reported it upstream at numba/numba#10040.
0xDA41 commentedon Apr 14, 2025
how fun! 😇
thanks for looking into it...