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:156–174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

154
155
156def test_dlpack_cuda_not_supported():
157 cuda = pytest.importorskip("pyarrow.cuda", exc_type=ImportError)
158
159 schema = pa.schema([pa.field('f0', pa.int16())])
160 a0 = pa.array([1, 2, 3], type=pa.int16())
161 batch = pa.record_batch([a0], schema=schema)
162
163 cbuf = cuda.serialize_record_batch(batch, cuda.Context(0))
164 cbatch = cuda.read_record_batch(cbuf, batch.schema)
165 carr = cbatch["f0"]
166
167 # CudaBuffers not yet supported
168 with pytest.raises(NotImplementedError, match="DLPack support is implemented "
169 "only for buffers on CPU device."):
170 np.from_dlpack(carr)
171
172 with pytest.raises(NotImplementedError, match="DLPack support is implemented "
173 "only for buffers on CPU device."):
174 carr.__dlpack_device__()

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected