Ufo.Resources

g GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object Ufo.Resources Ufo.Resources GObject.Object->Ufo.Resources Gio.Initable->Ufo.Resources

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

clerr (error)

class

error_quark ()

class

new ()

add_path (path)

get_cached_kernel (filename, kernel)

get_gpu_nodes ()

get_kernel (filename, kernel, options)

get_kernel_from_source (source, kernel, options)

get_kernel_source (filename)

Virtual Methods

Inherited:

GObject.Object (7), Gio.Initable (1)

Properties

Name

Type

Flags

Short Description

platform-index

int

r/w

Platform index, -1 denotes any platform

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Ufo.Resources(**kwargs)
Bases:

GObject.Object, Gio.Initable

Abstract:

No

Structure:

Ufo.ResourcesClass

Manages OpenCL resources. The contents of the Ufo.Resources structure are private and should only be accessed via the provided API.

classmethod clerr(error)
Parameters:

error (int) – An OpenCL error code

Returns:

A static string of error.

Return type:

str

Get a human-readable string representation of error.

classmethod error_quark()
Return type:

int

classmethod new()
Raises:

GLib.Error

Returns:

A new Ufo.Resources

Return type:

Ufo.Resources

Create a new Ufo.Resources instance.

add_path(path)
Parameters:

path (str) – a path to OpenCL kernel files

get_cached_kernel(filename, kernel)
Parameters:
  • filename (str) – Name of the .cl kernel file

  • kernel (str) – Name of a kernel, or None

Raises:

GLib.Error

Returns:

a cl_kernel object that is load from filename or None on error

Return type:

object or None

Loads a and builds a kernel from a file. The file is searched in the current working directory and all paths added through Ufo.Resources.add_path (). If kernel is None, the first encountered kernel is returned. The kernel object is cached and should not be used by two threads concurrently.

get_gpu_nodes()
Returns:

List with Ufo.GpuNode objects. Free with g_list_free() but not its elements.

Return type:

[Ufo.GpuNode]

Get all Ufo.GpuNode objects managed by self.

get_kernel(filename, kernel, options)
Parameters:
  • filename (str) – Name of the .cl kernel file

  • kernel (str) – Name of a kernel, or None

  • options (str) – Options passed to the OpenCL compiler or None

Raises:

GLib.Error

Returns:

a cl_kernel object that is load from filename or None on error

Return type:

object or None

Loads and builds a kernel from a file. The file is searched in the current working directory and all paths added through Ufo.Resources.add_path (). If kernel is None, the first encountered kernel is returned. Options are passed verbatim to the OpenCL compiler and ignored if None.

get_kernel_from_source(source, kernel, options)
Parameters:
  • source (str) – OpenCL source string

  • kernel (str) – Name of a kernel or None

  • options (str) – Options passed to the OpenCL compiler

Raises:

GLib.Error

Returns:

a cl_kernel object that is load from filename

Return type:

object or None

Loads and builds a kernel from a string. If kernel is None, the first kernel defined in source is used.

get_kernel_source(filename)
Parameters:

filename (str) – Name of the .cl kernel file

Raises:

GLib.Error

Returns:

a string (str) load from filename or None on error, user is responsible for free() it after using it.

Return type:

str

Loads a file present in the kernel PATH search list. The file is searched in the current working directory and all paths added through Ufo.Resources.add_path ().

Property Details

Ufo.Resources.props.platform_index
Name:

platform-index

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Platform index, -1 denotes any platform