O'Reilly logo

OpenCL Parallel Programming Development Cookbook by Raymond Tay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Copying data between memory objects

You will quickly realize how useful the event mechanism in OpenCL is in controlling the various parts of your algorithm, and it can be found in the common kernel and memory commands. This recipe will continue from creating memory objects and focus on how those memory objects can be transferred from the host memory to the device memory and vice versa and we'll be fixated on the data transfer APIs clEnqueueReadBuffer and clEnqueueWriteBuffer, which is for one-dimensional data blocks, and clEnqueueReadBufferRect and clEnqueueWriteBufferRect for two-dimensional data blocks; we'll also look at clEnqueueCopyBuffer for data transfers between memory objects in the device. First, we look at copying data between memory ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required