- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorneed more infoIndicates that an issue, pull request, or discussion needs more informationIndicates that an issue, pull request, or discussion needs more informationupstream
Description
sparse version checks
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.
To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
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.
Steps or code to reproduce the bug
a = sparse.COO(
[[1, 100, 215, 66],[5, 101, 242, 11],[3, 5, 1, 11],[13, 1, 3, 1],[55, 1, 6, 8]],
[5, 10, 2, 1],
shape=(255, 255, 255, 255, 255)
)
b = a.asformat('gcxs')
b[1, :, :, :, :]
Expected results
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)
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorneed more infoIndicates that an issue, pull request, or discussion needs more informationIndicates that an issue, pull request, or discussion needs more informationupstream
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
dani-corie 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=1
to make sure no out-of-bounds accesses were happening. Can you provide more info?dani-corie 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.
dani-corie commentedon Apr 11, 2025
Okay so I did an experiment with
python -vvv
, and it didn't make me any smarter. Here'spip list
in case it helps:dani-corie 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.
1 remaining item