From 1a610b6e63dae6b447a1451605230199d75f3edb Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Tue, 12 Mar 2019 16:00:41 -0500 Subject: [PATCH 1/3] Test, fix clEnqueueCopyBufferRect wrapper (closes #281 on github) --- src/wrap_cl.hpp | 8 ++++---- test/test_wrapper.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/wrap_cl.hpp b/src/wrap_cl.hpp index 4892e915..ae59fa25 100644 --- a/src/wrap_cl.hpp +++ b/src/wrap_cl.hpp @@ -2404,8 +2404,8 @@ namespace pyopencl py::object py_buffer_origin, py::object py_host_origin, py::object py_region, - py::sequence py_buffer_pitches, - py::sequence py_host_pitches, + py::object py_buffer_pitches, + py::object py_host_pitches, py::object py_wait_for, bool is_blocking ) @@ -2459,8 +2459,8 @@ namespace pyopencl py::object py_src_origin, py::object py_dst_origin, py::object py_region, - py::sequence py_src_pitches, - py::sequence py_dst_pitches, + py::object py_src_pitches, + py::object py_dst_pitches, py::object py_wait_for) { PYOPENCL_PARSE_WAIT_FOR; diff --git a/test/test_wrapper.py b/test/test_wrapper.py index 9776b032..17100535 100644 --- a/test/test_wrapper.py +++ b/test/test_wrapper.py @@ -1086,6 +1086,17 @@ def test_compile_link(ctx_factory): queue.finish() +def test_copy_buffer_rect(ctx_factory): + ctx = ctx_factory() + queue = cl.CommandQueue(ctx) + + arr1 = parray.zeros(queue, (2, 3), "f") + arr2 = parray.zeros(queue, (4, 5), "f") + arr1.fill(1) + cl.enqueue_copy(queue, arr2.data, arr1.data, src_origin=(0, 0), dst_origin=(1, 1), + region=arr1.shape[::-1]) + + if __name__ == "__main__": # make sure that import failures get reported, instead of skipping the tests. import pyopencl # noqa -- GitLab From 6f9bbe559354a32a7a73d46c77c70f23a50bd52d Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Tue, 12 Mar 2019 16:05:53 -0500 Subject: [PATCH 2/3] Placate flake8 --- test/test_wrapper.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/test_wrapper.py b/test/test_wrapper.py index 17100535..3a010682 100644 --- a/test/test_wrapper.py +++ b/test/test_wrapper.py @@ -1090,10 +1090,12 @@ def test_copy_buffer_rect(ctx_factory): ctx = ctx_factory() queue = cl.CommandQueue(ctx) - arr1 = parray.zeros(queue, (2, 3), "f") - arr2 = parray.zeros(queue, (4, 5), "f") + arr1 = cl_array.zeros(queue, (2, 3), "f") + arr2 = cl_parray.zeros(queue, (4, 5), "f") arr1.fill(1) - cl.enqueue_copy(queue, arr2.data, arr1.data, src_origin=(0, 0), dst_origin=(1, 1), + cl.enqueue_copy( + queue, arr2.data, arr1.data, + src_origin=(0, 0), dst_origin=(1, 1), region=arr1.shape[::-1]) -- GitLab From af44ad9bc273bf28fa7a818998d5ad8bf0b9a966 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Tue, 12 Mar 2019 16:10:21 -0500 Subject: [PATCH 3/3] Re-Placate flake8 --- test/test_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_wrapper.py b/test/test_wrapper.py index 3a010682..fa1e1d27 100644 --- a/test/test_wrapper.py +++ b/test/test_wrapper.py @@ -1091,7 +1091,7 @@ def test_copy_buffer_rect(ctx_factory): queue = cl.CommandQueue(ctx) arr1 = cl_array.zeros(queue, (2, 3), "f") - arr2 = cl_parray.zeros(queue, (4, 5), "f") + arr2 = cl_array.zeros(queue, (4, 5), "f") arr1.fill(1) cl.enqueue_copy( queue, arr2.data, arr1.data, -- GitLab