GoclDevice

GoclDevice — Object that represents an OpenCL capable device

Stability Level

Unstable, unless otherwise indicated

Synopsis

struct              GoclDevice;
struct              GoclDeviceClass;
cl_device_id        gocl_device_get_id                  (GoclDevice *self);
gsize               gocl_device_get_max_work_group_size (GoclDevice *self);
GoclQueue *         gocl_device_get_default_queue       (GoclDevice *self);
gboolean            gocl_device_has_extension           (GoclDevice *self,
                                                         const gchar *extension_name);
guint               gocl_device_get_max_compute_units   (GoclDevice *self);
gboolean            gocl_device_acquire_gl_objects_sync (GoclDevice *self,
                                                         GList *object_list,
                                                         GList *event_wait_list);
GoclEvent *         gocl_device_acquire_gl_objects      (GoclDevice *self,
                                                         GList *object_list,
                                                         GList *event_wait_list);
gboolean            gocl_device_release_gl_objects_sync (GoclDevice *self,
                                                         GList *object_list,
                                                         GList *event_wait_list);
GoclEvent *         gocl_device_release_gl_objects      (GoclDevice *self,
                                                         GList *object_list,
                                                         GList *event_wait_list);
GoclDevice *        gocl_queue_get_device               (GoclQueue *self);

Object Hierarchy

  GObject
   +----GoclDevice

Properties

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

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.

Details

struct GoclDevice

struct GoclDevice;


struct GoclDeviceClass

struct GoclDeviceClass {
  GObjectClass parent_class;
};

The class for GoclDevice objects.

GObjectClass parent_class;

The parent class

gocl_device_get_id ()

cl_device_id        gocl_device_get_id                  (GoclDevice *self);

Returns the internal cl_device_id.

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.

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.

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.

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.

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.

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_object_sync().

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

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.

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_object_sync().

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

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.

self :

The GoclQueue

Returns :

The GoclDevice this queue refers to. [transfer none]

Property Details

The "context" property

  "context"                  GoclContext*          : Read / Write / Construct Only

The context of this device.


The "id" property

  "id"                       gpointer              : Read / Write / Construct Only

The id of this device.