-
Notifications
You must be signed in to change notification settings - Fork 28
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
Support for NumPy 2.0 #77
Comments
+1 for supporting both. Probably just following the timeline of https://scientific-python.org/specs/spec-0000/, since that's what downstream users of this package use. So the minimum version that is in use right now is around 1.23.x. There won't be differences of interest between 1.23.x and 1.26.x probably, but it may be useful to document that SPEC 0 is followed. IIRC there is already one CI job with NumPy 1.21 |
I just noticed that this code now bypasses the compat layer completely, since array-api-compat/array_api_compat/common/_helpers.py Lines 74 to 83 in d235910
The order of |
This fix seems indeed necessary and somewhat urgent. Bypassing of the compat layer otherwise causes numpy |
I would suggest moving all of the |
I've fixed that at #79. I plan to implement the other things there too, but if we need that fix specifically soon we can merge it now and do a release. |
That would be nice I think - once CI on gh-79 is green and it's ready for testing with SciPy please ping me. Happy to help move this along. |
I'm trying my best with the CI (#80), but my point was that if this is blocking this, we should just ignore the CI issues for now. |
So ideally, we should be able to just leave most of the helper intact and use them for both 1.26 and 2.0. There will be extra redundant wrapping for most of the functionality in 2.0, but it will make things a lot easier for us to maintain, since we won't have to do version checks, and this will also let us keep the same code for cupy (no idea what the cupy plans for migrating to numpy 2.0), and dask. I read through the numpy wrapper code to see if there's anything that popped out at me as something that could potentially break with this. Here's what I noticed:
That's all I saw from a cursory look at the code, but I haven't looked at the tests yet. Perhaps a good middle ground would be to leave the wrappers for existing functions but use the numpy implementation for functions that are completely implemented from scratch in array-api-compat, like |
Yes, PR is up: numpy/numpy#25168
Yes, that should be a safe assumption I think.
Let's deal with that if an issue pops up? It's brand new, so not in heavy use yet.
Probably okay as is, since you wrote pretty idiomatic code in this package.
Sounds like a good plan to me. |
I was thinking specifically maybe the numpy one does something extra with non-standard dtypes? Anyway this is moot given my other suggestion.
The one thing I saw that worries me is |
I think so, but @mtsokol will know better what (if anything) may happen to |
Actually it looks like we don't have to worry about that because it was already fixed in #63 |
|
To support NumPy 2.0, we should
Add CI to test 2.0 nightlies. We can use
python -m pip install --pre --upgrade --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
.Decide if we want to support just NumPy 2.0 or both NumPy 2.0 and NumPy 1.26.
If we decide to support both, we should check if any of the wrappers here will break with 2.0 having fixed the underlying behavior. Otherwise, I don't think it's that important to wrap conditionally, unless there is a good reason to remove the wrapper when it isn't needed for performance.
If we aren't supporting both we can remove a good number of wrappers.
Personally I think we should support both, at least for the time being.
The text was updated successfully, but these errors were encountered: