AnsweredAssumed Answered

Flags for Creating OPENCL Buffer Objects

Question asked by skmadan84 on Nov 9, 2014
Latest reply on Nov 14, 2014 by dipak



I am new to opencl, and have a question about CL_MEM_USE_HOST_PTR flag. I know flags for creating buffer objects have been discussed before, and I have read the previous discussions, which was very helpful. However, I am still confused about the CL_MEM_USE_HOST_PTR flag. Suppose that the context is for a gpu device. My understanding is that when I use the CL_MEM_USE_HOST_PTR flag, the buffer object uses the memory referenced by host_ptr given as input to clCreateBuffer as storage bits for the memory object. However, when running my code, I seem to observe that using the CL_MEM_USE_HOST_PTR flag, a) creates a buffer object located at a different location from memory referenced by host_ptr, b) copies contents from host_ptr, c) clEnqueueMapBuffer maps the buffer object to memory referenced by host_ptr. Are these observations correct? I have attached my code and the output. Thanks!