GoclDevice

GoclDevice — Object that represents an OpenCL capable device

Stability Level

Unstable, unless otherwise indicated

Functions

Properties

GoclContext * context Read / Write / Construct Only
gpointer id Read / Write / Construct Only

Object Hierarchy

    GObject
    ╰── GoclDevice

Description

A GoclDevice object is not normally created directly. Instead, it is obtained from a GoclContext by calling any of gocl_context_get_device_by_index(), gocl_context_get_default_gpu_sync() or gocl_context_get_default_cpu_sync().

To obtain the maximum work group size of a device, gocl_device_get_max_work_group_size() is used. The number of compute units can be retrieved with gocl_device_get_max_compute_units().

To enqueue operations on this device, a GoclQueue provides a default command queue which is obtained by calling gocl_device_get_default_queue(). More device queues can be created by passing this object as 'device' property in the GoclQueue constructor.

Functions

gocl_device_get_id ()

cl_device_id
gocl_device_get_id (GoclDevice *self);

Returns the internal cl_device_id.

Parameters

self

The GoclDevice

 

Returns

The device id.

[transfer none][type guint64]


gocl_device_get_max_work_group_size ()

gsize
gocl_device_get_max_work_group_size (GoclDevice *self);

Retrieves the maximum work group size for the device, by querying the CL_DEVICE_MAX_WORK_GROUP_SIZE info key through clGetDeviceInfo(). Upon success a value greater than zero is returned, otherwise zero is returned.

Parameters

self

The GoclDevice

 

Returns

The maximum size of the work group for this device.


gocl_device_get_default_queue ()

GoclQueue *
gocl_device_get_default_queue (GoclDevice *self);

Returns a GoclQueue command queue associated with this device, or NULL upon error.

Parameters

self

The GoclDevice

 

Returns

A GoclQueue object, which is owned by the device and should not be freed.

[transfer none]


gocl_device_has_extension ()

gboolean
gocl_device_has_extension (GoclDevice *self,
                           const gchar *extension_name);

Tells whether the device supports a given OpenCL extension, described by extension_name .

Parameters

self

The GoclDevice

 

extension_name

The OpenCL extension name, as string

 

Returns

TRUE if the device supports the extension, FALSE otherwise


gocl_device_get_max_compute_units ()

guint
gocl_device_get_max_compute_units (GoclDevice *self);

Retrieves the number of compute units in an OpenCL device, by querying CL_DEVICE_MAX_COMPUTE_UNITS in device info.

Parameters

self

The GoclDevice

 

Returns

The number of compute units in the device


gocl_device_acquire_gl_objects_sync ()

gboolean
gocl_device_acquire_gl_objects_sync (GoclDevice *self,
                                     GList *object_list,
                                     GList *event_wait_list);

Enqueues a request for acquiring the GoclBuffer (or deriving) objects contained in object_list , which were created from OpenGL objects, blocking the program execution until the operation finishes.

This method works only if the <i>cl_khr_gl_sharing</i> OpenCL extension is supported.

Upon success, TRUE is returned, otherwise FALSE is returned.

Parameters

self

The GoclDevice

 

object_list

A GList of GoclBuffer objects, or NULL.

[element-type Gocl.Buffer][allow-none]

event_wait_list

List or GoclEvent objects to wait for, or NULL.

[element-type Gocl.Event][allow-none]

Returns

TRUE on success, FALSE on error


gocl_device_acquire_gl_objects ()

GoclEvent *
gocl_device_acquire_gl_objects (GoclDevice *self,
                                GList *object_list,
                                GList *event_wait_list);

Enqueues an asynchronous request for acquiring the GoclBuffer (or deriving) objects contained in object_list , which were created from OpenGL objects. For a blocking version of this method, see gocl_device_acquire_gl_objects_sync().

This method works only if the <i>cl_khr_gl_sharing</i> OpenCL extension is supported.

Parameters

self

The GoclDevice

 

object_list

A GList of GoclBuffer objects, or NULL.

[element-type Gocl.Buffer][allow-none]

event_wait_list

List or GoclEvent objects to wait for, or NULL.

[element-type Gocl.Event][allow-none]

Returns

A GoclEvent to get notified when the operation finishes.

[transfer none]


gocl_device_release_gl_objects_sync ()

gboolean
gocl_device_release_gl_objects_sync (GoclDevice *self,
                                     GList *object_list,
                                     GList *event_wait_list);

Enqueues a request for releasing the GoclBuffer (or deriving) objects contained in object_list , which were previously acquired by a call to gocl_device_acquire_gl_objects_sync().

Upon success, TRUE is returned, otherwise FALSE is returned.

Parameters

self

The GoclDevice

 

object_list

A GList of GoclBuffer objects, or NULL.

[element-type Gocl.Buffer][allow-none]

event_wait_list

List or GoclEvent objects to wait for, or NULL.

[element-type Gocl.Event][allow-none]

Returns

TRUE on success, FALSE on error


gocl_device_release_gl_objects ()

GoclEvent *
gocl_device_release_gl_objects (GoclDevice *self,
                                GList *object_list,
                                GList *event_wait_list);

Enqueues an asynchronous request for releasing the GoclBuffer (or deriving) objects contained in object_list , which were created from OpenGL objects. For a blocking version of this method, see gocl_device_release_gl_objects_sync().

This method works only if the <i>cl_khr_gl_sharing</i> OpenCL extension is supported.

Parameters

self

The GoclDevice

 

object_list

A GList of GoclBuffer objects, or NULL.

[element-type Gocl.Buffer][allow-none]

event_wait_list

List or GoclEvent objects to wait for, or NULL.

[element-type Gocl.Event][allow-none]

Returns

A GoclEvent to get notified when the operation finishes.

[transfer none]


gocl_queue_get_device ()

GoclDevice *
gocl_queue_get_device (GoclQueue *self);

Retrieves the device associated with this command queue.

Parameters

self

The GoclQueue

 

Returns

The GoclDevice this queue refers to.

[transfer none]

Types and Values

Property Details

The “context” property

  “context”                  GoclContext *

The context of this device.

Flags: Read / Write / Construct Only


The “id” property

  “id”                       gpointer

The id of this device.

Flags: Read / Write / Construct Only