Hello,
I am a newbie and playing with OpenCL for a while. I can't get a simple working example of clEnqueueMapBuffer(). Basically I want to see the effect of CL_MEM_ALLOC_HOST_PTR while creating buffer. Just a small example of vector addiction will also do.
Thanks in advance.
Shailesh
Solved! Go to Solution.
Hi Shailesh,
Welcome to this forum.
Actually, when CL_MEM_ALLOC_HOST_PTR flag is used, the buffer is created in pinned host memory and it's a zero copy buffer. So, it has following properties compared to normal device buffer (i.e. default or created with 0 flag)
For more information, please refer the section "OpenCL Memory Objects" in AMD OpenCL Programming Optimization guide.
I've attached a small program to demonstrate the above points. [Note: memory release and other unrelated things have been ignored]
In the source file, please change MEM_FLAG and NUM_ELEMENTS macros to see the effects. Hope it will be helpful to you.
Regards,
Hi Shailesh,
Welcome to this forum.
Actually, when CL_MEM_ALLOC_HOST_PTR flag is used, the buffer is created in pinned host memory and it's a zero copy buffer. So, it has following properties compared to normal device buffer (i.e. default or created with 0 flag)
For more information, please refer the section "OpenCL Memory Objects" in AMD OpenCL Programming Optimization guide.
I've attached a small program to demonstrate the above points. [Note: memory release and other unrelated things have been ignored]
In the source file, please change MEM_FLAG and NUM_ELEMENTS macros to see the effects. Hope it will be helpful to you.
Regards,
Thanks dipak.
It helped a lot.