Modules

opencl.Kernel OpenCL Kernel

Functions

compile_source(name, soruce) Compile OpenCL source code
cpu_device() The the system's CPU device id
create_memory_buffer(usage, array) Create a memory buffer
device_info(id, param) Get information on a particular device
devices(id) Get the devices on a particular platform
enqueue_kernel(device_id, kernel, ndim, global, local) Enqueue an OpenCL kernel for processing
enqueue_read(device_id, mem, block, global, array) Enqueue a read on an OpenCL memory buffer
execute(device_id, ker, ndim, global, ...) Execute a kernel on a device with arguments
get_kernel(name, [kerenel_name]) Get an OpenCL kernel associated with previously compiled code
gpu_device() The the system's GPU device id
platform_info(id, param) Get information on a particular platform
platforms() Get the platform ids on the system

Functions

compile_source(name, soruce)

A high-level function associating a name with compiled source code. The resulting cl_program is managed internally. The kernels in the program can be retrieved with the get_kernel function by using the same name parameter.

Parameters:

name The name of the source code
soruce The source code

See Also:

cpu_device()

The the system's CPU device id

Return:

  • The id of the CPU device
create_memory_buffer(usage, array)

Create a memory buffer

Parameters:

usage The memory usage flags
array The array data to associate with the kernel

Return:

  • The memory buffer
device_info(id, param)

Get information on a particular device

Parameters:

id The device id
param The name of the parameter to get

Return:

  • The parameter value
devices(id)

Get the devices on a particular platform

Parameters:

id The platform id

Return:

  • The list of device ids
enqueue_kernel(device_id, kernel, ndim, global, local)

Enqueue an OpenCL kernel for processing

Parameters:

device_id The id of the device to use
kernel The kernel to run
ndim The dimensionality of the domain
global The size of the global work area
local The size of the local work area

Return:

  • The resulting event
enqueue_read(device_id, mem, block, global, array)

Enqueue a read on an OpenCL memory buffer

Parameters:

device_id The id of the device to use
mem The memory
block The blocking flag
global The size of the global work area
array The array to read back the data into

Return:

  • The resulting event
execute(device_id, ker, ndim, global, ...)

Execute will set the arguments for the kernel and then enqueue it on the given device. It is a wrapper around Kernel.argument and opencl.enqueue_kernel.

Parameters:

device_id The id of the device to use
ker The kerenel to execute
ndim The dimensionality of the domain
global The dimensions of the domain
... The arguments to the kernel

See Also:

Return:

  • The resulting event
get_kernel(name, [kerenel_name])

If the kernel_name is not provided, the first kernel found will be returned.

Parameters:

name The name of the compiled code
[kerenel_name] Optional name of the kernel

See Also:

Return:

  • The kernel
gpu_device()

The the system's GPU device id

Return:

  • The id of the GPU device
platform_info(id, param)

Get information on a particular platform

Parameters:

id The platform id
param The name of the parameter to get

Return:

  • The parameter value
platforms()

Get the platform ids on the system

Return:

  • List of platform ids