Public Member Functions | Protected Attributes
CLArrayBuf< T > Class Template Reference

Create memory buffer associated to an array of type T. More...

#include <CLWorkFlow.hpp>

List of all members.

Public Member Functions

 operator cl_mem ()
 Buffer publically available for OpenCL API.
cl_mem * ptr ()
 Pointer to buffer for clSetKernelArg function.
void put (const T *ptr)
 Copy elements ptr[0],..., ptr[len-1] into buffer.
void get (T *ptr)
 Copy elements from buffer into ptr[0],..., ptr[len-1].
 CLArrayBuf (CLQueue &Q, cl_mem_flags FLAG, size_t len)
 Allocate memory buffer to use CLQueue for data transfers.

Protected Attributes

cl_command_queue queue_
 Command queue for read/write calls.
size_t length_
 Number of array elements.
cl_mem buffer_
 OpenCL memory buffer.
size_t bytes_
 Size of array in bytes.
char adieu [128]

Detailed Description

template<typename T>
class CLArrayBuf< T >

The put and get members facilitate transfer between the host and device by wrapping the clEnqueueWriteBuffer and clEnqueueReadBuffer commands. The class must be initialized with a command queue for these operations.

The size of the buffer is computed as that of an array of length len of objects specified by the template parameter.


Member Function Documentation

template<typename T >
void CLArrayBuf< T >::put ( const T *  ptr)

This is a blocking write, meaning that the command queue waits until all memory is copied.

template<typename T >
void CLArrayBuf< T >::get ( T *  ptr)

This is a blocking read, meaning that the command queue waits until all memory is copied.


The documentation for this class was generated from the following file:
 All Classes Functions Variables