diff --git a/test/test_wrapper.py b/test/test_wrapper.py index 193f198fa8d305780b7bac2dd252c0eeba9b7f91..8aad416e75b9e3e346946cb2b5c5b40836c88ee4 100644 --- a/test/test_wrapper.py +++ b/test/test_wrapper.py @@ -1032,21 +1032,25 @@ def test_coarse_grain_svm(ctx_factory): # {{{ https://github.com/inducer/pyopencl/issues/372 - svm_buf_arr = cl.svm_empty(ctx, cl.svm_mem_flags.READ_ONLY, 10, np.int32) - svm_out_arr = cl.svm_empty(ctx, cl.svm_mem_flags.READ_WRITE, 10, np.int32) + buf_arr = cl.svm_empty(ctx, cl.svm_mem_flags.READ_ONLY, 10, np.int32) + out_arr = cl.svm_empty(ctx, cl.svm_mem_flags.READ_WRITE, 10, np.int32) - with cl.SVM(svm_buf_arr).map_rw(queue) as ary: + svm_buf_arr = cl.SVM(buf_arr) + svm_out_arr = cl.SVM(out_arr) + with svm_buf_arr.map_rw(queue) as ary: ary.fill(17) - prg_ro = cl.Program(ctx, """ + prg_ro = cl.Program(ctx, r""" __kernel void twice_ro(__global int *out_g, __global int *in_g) { out_g[get_global_id(0)] = 2*in_g[get_global_id(0)]; } """).build() - prg_ro.twice_ro(queue, svm_buf_arr.shape, None, - cl.SVM(svm_out_arr), cl.SVM(svm_buf_arr)) + prg_ro.twice_ro(queue, buf_arr.shape, None, svm_out_arr, svm_buf_arr) + + with svm_out_arr.map_ro(queue) as ary: + print(ary) # }}}