[SOLVED] Map data objects to device


How can I map data objects to device? Something like ‘enqueueMapBuffer’ and ‘enqueueUnmapMemObject’ on OpenCL API.

For example, if I have something like this on OpenCL:

m_ngrid = cl::Buffer(OCL->context(), CL_MEM_READ_ONLY|CL_MEM_USE_HOST_PTR, m_nlength_bytes,ngrid);
    void *ngrid_map = queue.enqueueMapBuffer(m_ngrid,CL_TRUE,CL_MAP_READ,0,m_nlength_bytes);

How could I do the same with CUDA?

Thank you.

You may want to take a look at zero-copy in CUDA.


Perfect txbob, I have read about zero-copy and it will works fine in my case.

Thank you again.