drstrip

CL_MEM_USE_HOST_PTR vs CL_MEM_COPY_HOST_PTR

Discussion created by drstrip on Mar 16, 2010
Latest reply on Mar 20, 2010 by gaurav.garg

In clCreateBuffer, if I set mem_flags to CL_MEM_USE_HOST_PTR, the spec says that the contents of the host memory may be copied to device memory. However, if I use CL_MEM_COPY_HOST_PTR, it says that the implementation will "allocate memory ... and copy ..." What is not clear to me is whether this means the allocated memory must be on the device (which is what I want).

 

Also, I'm unclear on how one uses CL_MEM_ALLOC_HOST_PTR. If I use this, obviously memory is allocated on the host but are the contents copied to the device? If the answer to the first question above is that CL_MEM_COPY_HOST_PTR requires copy, then if these two are combined, is the newly allocated memory always copied to the device? And how do I get my hands on the allocated memory? The spec is not clear that this is provided in host_ptr on output.

 

Thanks.

Outcomes