OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1718 Discussions

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

wang_h_
Beginner
480 Views
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
480 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.
0 Kudos
wang_h_
Beginner
480 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?
0 Kudos
Dmitry_K_Intel
Employee
480 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.
0 Kudos
Reply