I have some questions about pinned memory in OpenCL.
First of all what is the difference between pinned memory and normal memory?
As written in “NVIDIA OpenCL Best Practices Guide” applications do not have direct control whether objects are allocated in pinned memory or not. The only thing that can be done is to set CL_MEM_ALLOC_HOST_PTR flag.
As it isn’t garanteed that pinned memory is used, is there any possiblity to check if pinned memory is used (after setting CL_MEM_ALLOC_HOST_PTR)?
Are there any special limitations concerning pinned memory (e.g. size)?
I tried to use pinned memory but I didn’t see any performance increases.
c_mem = clCreateBuffer(context,CL_MEM_READ_WRITE|CL_MEM_ALLOC_HOST_PTR, buffer_size, NULL, &err); float* data = NULL; data = (float*)clEnqueueMapBuffer(cmd_queue, c_mem, CL_TRUE, CL_MAP_WRITE, 0, buffer_size,0,NULL,NULL,NULL); //filling data err = clEnqueueWriteBuffer(cmd_queue,c_mem, CL_FALSE, 0, buffer_size, data,0 ,NULL , NULL);
Is there any thing else to consider in code?