-
-
Notifications
You must be signed in to change notification settings - Fork 11k
BUG: segmentation fault running nan_to_num
on a 3D complex array
#25959
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
Can you run python under faulthandler and/or lldb to get a traceback for the segfault? |
$ lldb python test_nan.py
(lldb) run
Process 23842 launched: '/Users/staniewi/miniconda3/envs/mapping-311/bin/python' (arm64)
Process 23842 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x157f1c000)
frame #0: 0x0000000106c93458 _multiarray_umath.cpython-311-darwin.so`FLOAT_isnan + 704
_multiarray_umath.cpython-311-darwin.so`FLOAT_isnan:
-> 0x106c93458 <+704>: ld2.4s { v24, v25 }, [x21]
0x106c9345c <+708>: b 0x106c933f0 ; <+600>
0x106c93460 <+712>: mov x21, x0
0x106c93464 <+716>: ld4.4s { v1, v2, v3, v4 }, [x21], x16
Target 0: (python) stopped. |
|
In lldb, execute |
sorry about that! I haven't used
|
No worries, remote debugging is fun. If you can share the problematic file via some other means, that would help too. npy files that don’t contain inline pickle files are safe to share. |
Ah right, I realized it's not hard to just make a repo for it. Here you go: https://github.com/scottstanie/numpy-nan-to-num-debug/blob/main/test_nan.py |
Can you share the output FWIW, the value you mentioned: |
ah you're right that i should have just zipped it:
Just noting that the numbers are supposed to be |
Thanks, I can reproduce this with 1.26.2, but not with 1.26.4. So I suspect you should simply upgrade and this is probably a fixed SIMD issue. Although, unfortunately, I can't say I know which PR would have fixed it.
Ah, thought they were complex128. Could be that these are slightly odd NaN values (as they differ for real and imaginary part, but didn't check). |
Thanks for checking! Yes I was able to solve this for my own purposes by upgrading. I only reported to help keep the problem from creeping back into future versions |
Aha, Thanks for the report, though. |
Describe the issue:
I'm getting a segmentation fault using
np.nan_to_num
on a certain array. I'd like to attach it here somehow, but github doesn't let me attach binary files (it's about 10MB).Reproduce the code example:
Error message:
Python and NumPy Versions:
Runtime Environment:
Context for the issue:
I have tried narrowing down the array to something as small as possible, but when I limit to subsets, the segfault goes away.
I've also tried just creating something with
np.full(shape, 1j * np.nan)
, but that also doesn't error.I ran
$ xxd nan_check_smaller.bin binary_contents.txt
and tried to see if there was some malformed number, but all the data in the array looks to have the same'0000 c0ff 0000 c07f 0000 c0ff 0000 c07f'
content.I'm running this on an M1 Macbook with numpy 1.26. If I install another environment with 1.24.4, I don't get the segfault.
The text was updated successfully, but these errors were encountered: