GH-47128: [Python] Numba-CUDA interop with NVIDIA bindings#47150
GH-47128: [Python] Numba-CUDA interop with NVIDIA bindings#47150kou merged 2 commits intoapache:mainfrom
Conversation
Numba and Numba-CUDA return a different type from `Context.memalloc()` depending on whether their built-in ctypes bindings or the NVIDIA CUDA Python bindings are in use - either e `ctypes.c_void_p` or a `cuda.bindings.driver.CUdeviceptr`. Whilst this inconsistency is unfortunate, it's hard to change as existing code in the wild depends on it. The issue in Arrow is that the value of the pointer cannot be obtained by `device_pointer.value` for a `CUdeviceptr`. Numba and Numba-CUDA do provide another property, `device_pointer_value`, that provides the device pointer as an `int` regardless of the kind of binding in use, so we can switch to use this for consistency between the two kinds of bindings. Fixes apache#47128.
|
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
|
|
|
@github-actions crossbow submit -g cuda |
|
Revision: 232c66e Submitted crossbow builds: ursacomputing/crossbow @ actions-6712a32a6e
|
|
It seems the cuda runners haven't been available for the last several days. I am trying to investigate, cc @assignUser |
|
@github-actions crossbow submit -g cuda |
|
Revision: 232c66e Submitted crossbow builds: ursacomputing/crossbow @ actions-9953d44aa0
|
|
@assignUser the cuda runners still doesn't seem to be working 🤔 |
|
@raulcd ah sorry I was testing with the nanoarrow cluster, looks like there are some issue with the crossbow ones. Investigating now. |
|
@raulcd the cuda nodes are back up! |
|
A gentle ping on this one (perhaps for @pitrou ?) |
|
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit ddd25d1. There weren't enough matching historic benchmark results to make a call on whether there were regressions. The full Conbench report has more details. |
|
Sorry for not looking at this earlier, I was on holiday. It's nice that the CI is green, but when looking at the logs it seems the tests are actually skipped: Can you take a look at this @gmarkall ? |
Yes, I will take a look at this - thanks for spotting it and mentioning! |
|
Oh, sorry. I should have noticed it... |

Rationale for this change
Testing with Numba-CUDA which uses the NVIDIA CUDA Python bindings by default identified that PyArrow Numba interop has an incompatibility with Numba / Numba-CUDA using the NVIDIA bindings. See Issue #47128.
What changes are included in this PR?
The fix is to get device pointer values from their
device_pointer_valueproperty, which is consistent across the ctypes and NVIDIA bindings in Numba.I also attempted to update the CI config to install Numba-CUDA. I think some of the comments in
docker-compose.ymlwere a bit out of sync with changes to it, so I also updated comments that appeared to be relevant to reflect what I had to run locally. I could have got the CI changes all wrong - happy to change these, as they're not really the critical part of this PR.Fixes #47128.
Are these changes tested?
Yes, by the existing
test_cuda_numba_interop.pyand the CI changes in this PR.Are there any user-facing changes?
No.