High-level Python API¶
OpenCL interface¶
Platforms¶
- class pocky.Platform(id: Capsule, name: str, version: str)¶
Encapsulated OpenCL platform ID with basic information.
- Parameters:
id – Unique platform ID
name – Platform name, as reported by the hardware
version – Platform version, as reported by the hardware
Danger
Do not instantiate this class directly! Rather, use valid output from
pocky.list_all_platforms()
.
Devices¶
- class pocky.Device(iterable=(), /)¶
This is a stub
Contexts¶
- class pocky.Context¶
Opaque object encapsulating the OpenCL context, command queues, kernels, and program.
Danger
Do not instantiate this class directly! Rather, use valid output from
pocky.Context.default()
orpocky.Context.from_device_list()
.- default() Context ¶
Create a context with the default OpenCL platform and devices.
- Returns:
An initialized Context
- devices¶
This is a stub
Buffers¶
- class pocky.BufferPair(context: Context, host_array: numpy.ndarray)¶
Pair of buffers, one host and one device, used for input and output to compiled kernels. Copy operations are carried out before and after each kernel execution.
- Parameters:
context – Valid existing OpenCL context
host_array – NumPy array to serve as host memory buffer
- copy_from_device()¶
Copy the specified device data to the host
- copy_to_device()¶
Copy the host data to the specified device
- dirty¶
Indicates that the host array needs to be copied to the device (True) or that it is unchanged since the last copy (False). This can be used by external modules to avoid redundant copies, but it is not updated dynamically by pocky.
- host¶
Exposes the underlying NumPy host array. The size of the array cannot be increased after the BufferPair is created, but the array can be replaced by one of the same dtype and equal or smaller size.