tags:

views:

50

answers:

1

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
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
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