Community
cancel
Showing results for 
Search instead for 
Did you mean: 
wang_h_
Beginner
66 Views

How dose clCreateBuffer( CL_MEM_USE_HOST_PTR) work when platform and device are both CPU

When my OpenCL platform and device are both CPU, would the behaviour (creating buffer using CL_MEM_USE_HOST_PTR )copy another uniform data or just link to the host_ptr address without copy? Dose any one knows? Thank you!
0 Kudos
3 Replies
Dmitry_K_Intel
Employee
66 Views

Intel OpenCL implementation for CPU device never copies data to/from buffers unless user requested the copy explicitly by using clEnqueueRead/Write/Copy or by providing CL_MEM_COPY_HOST_PTR to clCreateBuffer call.
wang_h_
Beginner
66 Views

Dmitry Kaptsenel (Intel) wrote:

Intel OpenCL implementation for CPU device never copies data to/from buffers unless user requested the copy explicitly by using clEnqueueRead/Write/Copy or by providing CL_MEM_COPY_HOST_PTR to clCreateBuffer call.

oh,thank you.But the time by using clEnqueuewriteBuffer (CL_MEM_ALLOC_HOST_PTR) to transform data is just the same long as clCreateBuffer by using CL_USE_HOST_PTR, so that I doubt there is data copy reaction. As you say, the latter time should be much shorter. Am I right?
Dmitry_K_Intel
Employee
66 Views

wang h. wrote:
But the time by using clEnqueuewriteBuffer (CL_MEM_ALLOC_HOST_PTR) to transform data is just the same long as clCreateBuffer by using CL_USE_HOST_PTR, so that I doubt there is data copy reaction. As you say, the latter time should be much shorter. Am I right?
Sorry for the late answer. Yes, it should be shorter. But if the buffer size is not too huge and the buffer creation is not dominated by the copy operation time you will not feel a difference.