MCPcopy Create free account
hub / github.com/apache/arrow / test_dlpack_cuda_not_supported

Function test_dlpack_cuda_not_supported

python/pyarrow/tests/test_dlpack.py:358–376  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

356
357
358def test_dlpack_cuda_not_supported():
359 cuda = pytest.importorskip("pyarrow.cuda", exc_type=ImportError)
360
361 schema = pa.schema([pa.field('f0', pa.int16())])
362 a0 = pa.array([1, 2, 3], type=pa.int16())
363 batch = pa.record_batch([a0], schema=schema)
364
365 cbuf = cuda.serialize_record_batch(batch, cuda.Context(0))
366 cbatch = cuda.read_record_batch(cbuf, batch.schema)
367 carr = cbatch["f0"]
368
369 # CudaBuffers not yet supported
370 with pytest.raises(NotImplementedError, match="DLPack support is implemented "
371 "only for buffers on CPU device."):
372 np.from_dlpack(carr)
373
374 with pytest.raises(NotImplementedError, match="DLPack support is implemented "
375 "only for buffers on CPU device."):
376 carr.__dlpack_device__()
377
378
379@requires_numpy_version("2.1.0")

Callers

nothing calls this directly

Calls 5

schemaMethod · 0.45
fieldMethod · 0.45
arrayMethod · 0.45
read_record_batchMethod · 0.45
__dlpack_device__Method · 0.45

Tested by

no test coverage detected