apache / apache/arrow

[Python][GPU] Numba interop tests broken by Numba API changes

Open
#48,265 4 comments 0 reactions 0 assignees View on GitHub
Component: GPU Component: Python Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

On https://github.com/apache/arrow/pull/48259 I got the following failure:
```
___________________ test_numba_memalloc[float32-numba.cuda] ____________________

c = 1, dtype = dtype('float32')

@pytest.mark.parametrize("c", range(len(context_choice_ids)),
ids=context_choice_ids)
@pytest.mark.parametrize("dtype", dtypes, ids=dtypes)
def test_numba_memalloc(c, dtype):
ctx, nb_ctx = context_choices[c]
dtype = np.dtype(dtype)
# Allocate memory using numba context
# Warning: this will not be reflected in pyarrow context manager
# (e.g bytes_allocated does not change)
size = 10
mem = nb_ctx.memalloc(size * dtype.itemsize)
darr = DeviceNDArray((size,), (dtype.itemsize,), dtype, gpu_data=mem)
darr[:5] = 99
darr[5:] = 88
np.testing.assert_equal(darr.copy_to_host()[:5], 99)
np.testing.assert_equal(darr.copy_to_host()[5:], 88)

# wrap numba allocated memory with CudaBuffer
> cbuf = cuda.CudaBuffer.from_numba(mem)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

arrow-dev/lib/python3.12/site-packages/pyarrow/tests/test_cuda_numba_interop.py:178:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyarrow/_cuda.pyx:453: in pyarrow._cuda.CudaBuffer.from_numba
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =
fname = 'context'

def __getattr__(self, fname):
"""Proxy MemoryPointer methods"""
> return getattr(self._view, fname)
^^^^^^^^^^^^^^^^^^^^^^^^^^
E AttributeError: 'AutoFreePointer' object has no attribute 'context'

arrow-dev/lib/python3.12/site-packages/numba_cuda/numba/cuda/cudadrv/driver.py:2022: AttributeError
```

### Component(s)

Python, GPU

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.