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

Function test_numba_context

python/pyarrow/tests/test_cuda_numba_interop.py:200–213  ·  view source on GitHub ↗
(c, dtype)

Source from the content-addressed store, hash-verified

198 ids=context_choice_ids)
199@pytest.mark.parametrize("dtype", dtypes, ids=dtypes)
200def test_numba_context(c, dtype):
201 ctx, nb_ctx = context_choices[c]
202 size = 10
203 with nb_cuda.gpus[0]:
204 arr, cbuf = make_random_buffer(size, target='device',
205 dtype=dtype, ctx=ctx)
206 assert cbuf.context.handle == nb_ctx.handle.value
207 mem = cbuf.to_numba()
208 darr = DeviceNDArray(arr.shape, arr.strides, arr.dtype, gpu_data=mem)
209 np.testing.assert_equal(darr.copy_to_host(), arr)
210 darr[0] = 99
211 cbuf.context.synchronize()
212 arr2 = np.frombuffer(cbuf.copy_to_host(), dtype=dtype)
213 assert arr2[0] == 99
214
215
216@pytest.mark.parametrize("c", range(len(context_choice_ids)),

Callers

nothing calls this directly

Calls 1

make_random_bufferFunction · 0.70

Tested by

no test coverage detected