ShPavel
ShPavel

Reputation: 973

OpenCL, direct access to host memory from GPU kernels

Is there any way to allocate memory on host, that is accessible directly from GPU, without copying?

Like cudaHostGetDevicePointer in CUDA.

Upvotes: 5

Views: 2823

Answers (1)

Dr. Snoopy
Dr. Snoopy

Reputation: 56417

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.

Upvotes: 8

Related Questions