inducer / pycuda

CUDA integration for Python, plus shiny features
http://mathema.tician.de/software/pycuda
Other
1.85k stars 288 forks source link

Compatibility with numpy 2 #450

Closed vincefn closed 3 months ago

vincefn commented 4 months ago

Hi @inducer I guess this is not a surprise, but pycuda does not work with numpy>=2.

Is there any plan to support it ? Something alike what was done for pyopencl ?

attn @pierrepaleo

inducer commented 4 months ago

Yes, I would definitely like to do that. Help welcome, otherwise I'll likely get to it sometime.

vincefn commented 4 months ago

Hi Andreas, I took a shot at this, using the pyopencl changes as a base. I've pushed changes:

Now all pycuda tests are passing (with python 3.12 and numpy 2.0, and cuda 11.8) , except TestDriver.test_register_host_memory which fails with ValueError: Cannot set the NumPy array 'base' dependency more than once.

I'll add two PR against pycuda and compyte, but this needs a close look - I'm not a numpy C API expert at all...

PS: there are other failures when using python 12.2, when using textures - I guess it's unrelated to numpy 2 ?

pierrepaleo commented 3 months ago

Thanks! I did an (incomplete) attempt a while ago, not sure that's useful, I did not see the changes in pyopencl at the time.

inducer commented 3 months ago

451 should have addressed this.