Tutorial by Examples

To read an array from the device back to the host, one calls clEnqueueReadBuffer($queue, $memobj, $blocking, $offset, $size, $target, 0, null, null); The $queue is the CommandQueue which was used to allocate the memory on the device. The $memobj contains the address to the device memory, $offset...
Reading an image is almost like reading an array. The only difference beeing that the size and offset need to be three-dimensional. clEnqueueReadImage($queue, $memobj, $blocking, $offset, $size, $stride, $slice_pitch, $target, 0, null, null); The $stride defines how many bytes a row has. Normall...
To copy a texture to the device there are two steps necessary Allocate the memory on the device Copy the image to the device _mem = clCreateImage2D($context, $mem_flags, $image_format, $width, $height, $stride, $source, &err); The $mem_flags define how the memory is allocated. It can...
When allocating Memory you have the option to choose between different modes: Read only memory Write only memory Read/Write memory Read-only memory is allocated in the __constant memory region, while the other two are allocated in the normal __global region. In addition to the accessibility...
Writing an array consists of two steps: Allocating the memory Copying the data To allocate the memory, a simple call to _mem = clCreateBuffer($queue, $mem_flags, $size, $host_ptr, &err); is enough. If you decided to copy the host pointer via the mem_flags, you are done. Otherwise you ...

Page 1 of 1