vincefn / pyvkfft

Python interface to VkFFT
MIT License
51 stars 6 forks source link

Add (some) support for numpy 2.0 #35

Closed alexfikl closed 1 month ago

alexfikl commented 2 months ago

I'm not sure this is all there is to fix, but it seems to work for me: the project builds and the tests run (haven't ran all of them, I think).

The main changes are:

vincefn commented 2 months ago

Thanks for the PR ! I've not yet had time to spend on numpy 2, so this is very welcome.

Regarding random.uniform, would it not be more straightforward to replace np.random.uniform by np.random.Generator.uniform ?

What backend(s) did you test this with ?

alexfikl commented 2 months ago

Regarding random.uniform, would it not be more straightforward to replace np.random.uniform by np.random.Generator.uniform ?

That's what 9dc7e12 does. But you need to instantiate a generator first, so it just does np.random.default_rng() to get one.

What backend(s) did you test this with ?

I only have pyopencl installed and ran python -m pytest -v -s pyvkfft to go through the tests. I haven't tested with pycuda or cupy (or other backends).

For context, I attempted running the test suite from https://github.com/inducer/sumpy with numpy 2.0 and it failed due to np.alltrue being removed in pyvkfft. It seems to work now, but it probably uses just a small chunk of pyvkfft, so it's not a thorough test.

vincefn commented 2 months ago

Thanks ! I'll try to test this more closely next week.