Hello all,
I was looking into copying the contents of an accessor into the host memory and I came across two methods namely copy
and the update_host
method. I was wondering about the time complexity of the copy
method, because if the implementation is similar to std::copy
(which has a time complexity of O(n)
) with device interfacing then it may nullify the gain due to parallelism.
So, is handler.copy()
the right way to update the host memory from an accessor ?.
Hi,
the handler::copy
function is intended to be a straightforward copy, in OpenCL terms it should generally translate to a single clEnqueueReadBuffer
or something similar, basically a memcpy
. The copy functions are the preferred way of interacting with host memory as well, at least for high performance code, because there is less synchronization involved compared to a host accessor. The copy
function is instead executed asynchronously just like any other SYCL command group.