-
Notifications
You must be signed in to change notification settings - Fork 62
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
Explore NumPy 2 compatibility #742
Comments
cc @grlee77 (for vis) |
Current issues running cuCIM with NumPy 2.0 and CuPy 13.2I ran the cuCIM test suite locally with NumPy 2.0 and CuPy 13.2. The remaining compatibility issues encountered are documented here: 1.) use of
|
Thanks Greg! 🙏 cc @seberg (for awareness) |
Looks like the first issue above ( and the second ( The last two can be resolved within cuCIM itself |
Thanks Greg! 🙏 Tweaked the second link in your comment to reference the relevant PR |
This MR resolves issues 3 and 4 reported [here](#742 (comment)) when testing with NumPy 2.0 and CuPy 13.2 locally (issues 1 and 2 will be addressed in CuPy itself) #742 (comment) For now, leave NumPy pinning as-is. Tests should continue to pass with NumPy 1.x Authors: - Gregory Lee (https://github.com/grlee77) Approvers: - https://github.com/jakirkham URL: #746
Is there anything left to do on this one? Or is it just waiting for a new CuPy release with the referenced fixes? |
I still need to make one small PR here with the fixes suggested in the patches for items 3 and 4 in #742 (comment). That will be fine to do for 24.08 as it will also be compatible with NumPy 1.x |
Ah ok. Thought these were resolved in PR ( #746 ). What else is still needed to address 3 & 4? |
sorry, I forgot that I opened #746 before going on vacation. Everything on our end should be addressed then! |
No worries. Great! 🎉 Will leave open to remind us to retest once the CuPy fixes are out |
Would it be possible to retest with the CuPy 13.3.0 dev Conda packages in this PR: conda-forge/cupy-feedstock#272 ? |
I am running the 24.10 nightlies with NumPy 2.0.1 (pip) and CuPy 13.3.0dev30 from the feedstock. (Had one issue with sphinx installed during error collection, but unrelated warning that may need suppressing). Had to also update Looks all fine (at 20%), I assume it'll finish successfully and post if there is a problem. Just posting early to avoid possible unnecessary duplicate work. |
OK, I did ran into an issue, but I don't think it is related:
|
Thanks Sebastian! 🙏 Just to confirm, that is using the 24.08 nightlies of cuCIM? Asking as I would like to confirm PR ( #746 ), which may have a relevant fix, is included |
This was with the |
Ok thanks! 🙏 Could you please try installing |
Already have it installed, but 13.2 fails the same way in these tests (plus the extra failures). |
Thanks for making the Cupy 13.3.0 dev packages @seberg. I tried in a Python 3.10 environment with Numpy 2.0.1 and all tests were passing. I did not use any For cuCIM itself I was on a 24.08 development branch and just installed an in-place build of the Python libs from the
This is the output of
|
Thanks Sebastian and Greg! 🙏 Regarding In any event, sounds like things are working. We just need a CuPy 13.3.0 release. So will close this out |
I found a single test failure on cuCIM with current CuPy 13.3 dev and NumPy 2.0.1. It occurs in kernel fusion code and a simplified pure CuPy reproducer is this: import cupy as cp
delta_phi = cp.full((10, 10), 9.999999e-7, dtype=cp.float32)
dt = cp.asarray(0.5, dtype=cp.float32)
mu = cp.asarray(0.1, dtype=cp.float32)
@cp.fuse()
def _fused_kernel(dt, mu, delta_phi):
return 1 + mu * dt * delta_phi
_fused_kernel(dt, mu, delta_phi) which gives traceback
Oddly, it works again if parenthesis are inserted into the return statement like this @cp.fuse()
def _fused_kernel(one, dt, mu, delta_phi):
return 1 + mu * (dt * delta_phi) or it works without parenthesis if a device scalar is passed in for 1 @cp.fuse()
def _fused_kernel(one, dt, mu, delta_phi):
return one + mu * dt * delta_phi
_fused_kernel(cp.asarray(1.0, dtype=cp.float32), dt, mu, delta_phi) |
We can pass a device scalar for the constant in cuCIM to work around the issue in that single kernel, but I wanted to report it here for completeness. |
Reproduced the same error Greg saw FWIW also found this worked, which avoids picking a type for import cupy as cp
delta_phi = cp.full((10, 10), 9.999999e-7, dtype=cp.float32)
dt = cp.asarray(0.5, dtype=cp.float32)
mu = cp.asarray(0.1, dtype=cp.float32)
@cp.fuse()
def _fused_kernel(dt, mu, delta_phi):
r = mu * dt * delta_phi
r += r.dtype.type(1)
return r |
Filed as upstream issue: cupy/cupy#8536 |
Would be good to explore NumPy 2 compatibility in cuCIM and see what changes are needed to support NumPy 1 & 2.
The text was updated successfully, but these errors were encountered: