Skip to content

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

@pitrou

Description

@pitrou

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

On #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 = <numba.cuda.cudadrv.driver.OwnedPointer object at 0x7f8ef0de85b0>
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions