Skip to content

Commit

Permalink
apacheGH-41126: [Python] Test Buffer device/device_type access on CUDA
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Jun 20, 2024
1 parent 89d6354 commit 17edaa9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions python/pyarrow/tests/test_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,25 @@ def put(*args, **kwargs):
put(position=position, nbytes=nbytes)


def test_buffer_device():
buf = cuda.new_host_buffer(10)
assert buf.device_type == pa.DeviceAllocationType.CUDA_HOST
assert isinstance(buf.device, pa.Device)
assert isinstance(buf.memory_manager, pa.MemoryManager)
assert buf.is_cpu
assert buf.device.is_cpu
assert buf.device == pa.default_cpu_memory_manager().device
assert buf.memory_manager.is_cpu

_, buf = make_random_buffer(size=10, target='device')
assert buf.device_type == pa.DeviceAllocationType.CUDA
assert isinstance(buf.device, pa.Device)
assert isinstance(buf.memory_manager, pa.MemoryManager)
assert not buf.is_cpu
assert not buf.device.is_cpu
assert not buf.memory_manager.is_cpu


def test_BufferWriter():
def allocate(size):
cbuf = global_context.new_buffer(size)
Expand Down

0 comments on commit 17edaa9

Please sign in to comment.