(c, dtype)
| 198 | ids=context_choice_ids) |
| 199 | @pytest.mark.parametrize("dtype", dtypes, ids=dtypes) |
| 200 | def 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)), |
nothing calls this directly
no test coverage detected