Gocl - Documentation and Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
struct GoclBuffer; struct GoclBufferClass; cl_mem gocl_buffer_get_buffer (GoclBuffer *self
); gboolean gocl_buffer_read_sync (GoclBuffer *self
,GoclQueue *queue
,gpointer target_ptr
,gsize size
,goffset offset
,GList *event_wait_list
,GError **error
); gboolean gocl_buffer_write_sync (GoclBuffer *self
,GoclQueue *queue
,const gpointer data
,gsize size
,goffset offset
,GList *event_wait_list
,GError **error
);
"context" GoclContext* : Read / Write / Construct Only "flags" guint : Read / Write / Construct Only "size" guint64 : Read / Write / Construct Only
A GoclBuffer represents a buffer object in an OpenCL context. These objects are directly accessible from OpenCL programs.
Buffers are created from a GoclContext, by calling
gocl_context_create_buffer()
method. It is possible to initialize the
contents of the buffer upon creating, by specifying a block of host memory
to copy data from, and the appropriate flag from GoclBufferFlags.
Also, buffers can be initialized at any time by calling
gocl_buffer_write_sync()
.
To read data from a buffer into host memory, gocl_buffer_read_sync()
method
is provided. This is normally used after the execution of a kernel that
affected the contents of the buffer.
Both gocl_buffer_write_sync()
and gocl_buffer_read_sync()
are block program
execution. Asynchronous function will shortly be provided as well.
struct GoclBufferClass { GObjectClass parent_class; };
The class for GoclBuffer objects.
GObjectClass |
The parent class |
cl_mem gocl_buffer_get_buffer (GoclBuffer *self
);
Retrieves the internal OpenCL cl_mem object. This is not normally called by applications. It is rather a low-level, internal API.
|
The GoclBuffer |
Returns : |
The internal cl_mem object. [type guint64][transfer none] |
gboolean gocl_buffer_read_sync (GoclBuffer *self
,GoclQueue *queue
,gpointer target_ptr
,gsize size
,goffset offset
,GList *event_wait_list
,GError **error
);
Reads a block of data of size
bytes from remote context into host memory,
starting at offset
. The operation is actually enqueued in queue
, and
the program execution blocks until the read finishes. If event_wait_list
is provided, the read operation will start only when all the GoclEvent in
the list have triggered.
|
The GoclBuffer |
|
A GoclQueue where the operation will be enqueued |
|
The pointer to copy the data to. [array length=size][element-type guint8] |
|
The size of the data to be read |
|
The offset to start reading from |
|
List or GoclEvent
object to wait for, or NULL . [element-type Gocl.Event][allow-none]
|
|
A pointer to a GError, or NULL . [out][allow-none]
|
Returns : |
TRUE on success, FALSE on error |
gboolean gocl_buffer_write_sync (GoclBuffer *self
,GoclQueue *queue
,const gpointer data
,gsize size
,goffset offset
,GList *event_wait_list
,GError **error
);
Writes a block of data of size
bytes from host memory into remote context
memory, starting at offset
. The operation is actually enqueued in queue
, and
the program execution blocks until the read finishes. If event_wait_list
is provided, the read operation will start only when all the GoclEvent in
the list have triggered.
|
The GoclBuffer |
|
A GoclQueue where the operation will be enqueued |
|
A pointer to write data from |
|
The size of the data to be written |
|
The offset to start writing data to |
|
List or GoclEvent
object to wait for, or NULL . [element-type Gocl.Event][allow-none]
|
|
A pointer to a GError, or NULL . [out][allow-none]
|
Returns : |
TRUE on success, FALSE on error |
"context"
property"context" GoclContext* : Read / Write / Construct Only
The context where this buffer was created.
"flags"
property"flags" guint : Read / Write / Construct Only
The flags used when creating this buffer.
Allowed values: [1,32]
Default value: 1