Hello, is there any way to allocate memory on host, that is accessible directly from gpu, without copying? like cudaHostGetDevicePointer in cuda.
+3
A:
Yes, use clCreateBuffer with flags containing one of:
- CL_MEM_USE_HOST_PTR
- CL_MEM_ALLOC_HOST_PTR
Which does what you want. For more information visit the man page of clCreateBuffer.
Matias Valdenegro
2010-08-22 16:36:18
sorry, i did not clarified properly - have read about thouse options, but CL_MEM_USE_HOST_PTR can be cached in device memory - it is not allowed for my task.CL_MEM_ALLOC_HOST_PTR - "allocate memory from host accessible memory..." - will this memory be accessible from device?cudaHostGetDevicePointer uses raw DMA via bus, as i know - would like to find something similiar
2010-08-22 17:05:23
There is nothing 100% similar, OpenCL is a lot more generic that CUDA. All CL buffers are accessible from the device side, including the ones allocated using CL_MEM_ALLOC_HOST_PTR.
Matias Valdenegro
2010-08-22 21:46:43