(c, dtype)
| 217 | ids=context_choice_ids) |
| 218 | @pytest.mark.parametrize("dtype", dtypes, ids=dtypes) |
| 219 | def test_pyarrow_jit(c, dtype): |
| 220 | ctx, nb_ctx = context_choices[c] |
| 221 | |
| 222 | @nb_cuda.jit |
| 223 | def increment_by_one(an_array): |
| 224 | pos = nb_cuda.grid(1) |
| 225 | if pos < an_array.size: |
| 226 | an_array[pos] += 1 |
| 227 | |
| 228 | # applying numba.cuda kernel to memory hold by CudaBuffer |
| 229 | size = 10 |
| 230 | arr, cbuf = make_random_buffer(size, target='device', dtype=dtype, ctx=ctx) |
| 231 | threadsperblock = 32 |
| 232 | blockspergrid = (arr.size + (threadsperblock - 1)) // threadsperblock |
| 233 | mem = cbuf.to_numba() |
| 234 | darr = DeviceNDArray(arr.shape, arr.strides, arr.dtype, gpu_data=mem) |
| 235 | increment_by_one[blockspergrid, threadsperblock](darr) |
| 236 | cbuf.context.synchronize() |
| 237 | arr1 = np.frombuffer(cbuf.copy_to_host(), dtype=arr.dtype) |
| 238 | np.testing.assert_equal(arr1, arr + 1) |
nothing calls this directly
no test coverage detected