I need a way to create an memory object which can be accessed parallelly both in CPU and GPU, this memory will be read only. How can I do it?
If you need the memory object to wrap existing host memory, I suggest you look into using the host import feature of https://www.khronos.org/registry/OpenCL/extensions/arm/cl_arm_import_memory.txt. This will allow you to create a buffer from an existing application-supplied pointer. Parallel access is allowed as long as both the CPU and GPU are treating the memory as read-only.
If the memory object doesn't have to be created from an existing pointer, then you can just use clCreateBuffer and map the buffer for reading on the host (CL_MAP_READ) and simultaneously access it on the GPU from a kernel.
As Ben suggested, you can also do this with Shared Virtual Memory.
Regards,
Kevin