< GeeXLab Reference Guide />
> Back to Reference Guide Index
gh_opencl library
Description
gh_opencl is the module that manages OpenCL functions. Currently OpenCL functions only covers simple API queries.
Number of functions: 6
- gh_opencl.get_device_compute_units_info ()
- gh_opencl.get_device_info ()
- gh_opencl.get_device_type ()
- gh_opencl.get_num_devices ()
- gh_opencl.get_num_platforms ()
- gh_opencl.get_platform_info ()
get_device_compute_units_info
Description
Returns the information about a the compute units of an OpenCL device.
Syntax
max_compute_units, clock_freq, flops = gh_opencl.get_device_compute_units_info(
pla_index,
dev_index
)
Languages
Parameters
- pla_index [INTEGER]: platform index
- dev_index [INTEGER]: device index
Return Values
- max_compute_units, clock_freq, flops [INTEGER]: max compute units, clock frequency in MHz, and FLOPS
Code sample
max_compute_units, clock_freq, flops = gh_opencl.get_device_compute_units_info(0, 0)
get_device_info
Description
Returns the identification information about an OpenCL device.
Syntax
vendor, name, version, driver = gh_opencl.get_device_info(
pla_index,
dev_index
)
Languages
Parameters
- pla_index [INTEGER]: platform index
- dev_index [INTEGER]: device index
Return Values
- vendor, name, version, driver [STRING]: vendor, name, version and driver of the OpenCL device
Code sample
vendor, name, version = gh_opencl.get_device_info(0, 0)
get_device_type
Description
Returns the type (GPU or CPU) of an OpenCL device.
Syntax
type = gh_opencl.get_device_type(
pla_index,
dev_index
)
Languages
Parameters
- pla_index [INTEGER]: platform index
- dev_index [INTEGER]: device index
Return Values
- type [ENUM]: type: 1 (GPU) or 2 (CPU)
Code sample
type = gh_opencl.get_device_type(0, 0)
get_num_devices
Description
Returns the number of OpenCL devices of a particular platform.
Syntax
num_devices = gh_opencl.get_num_devices(
pla_index
)
Languages
Parameters
- pla_index [INTEGER]: platform index
Return Values
- num_devices [INTEGER]: number of OpenCL devices
Code sample
num_devices = gh_opencl.get_num_devices(0)
get_num_platforms
Description
Returns the number of OpenCL platforms.
Syntax
num_platforms = gh_opencl.get_num_platforms()
Languages
Parameters
This function has no input parameter(s).
Return Values
- num_platforms [INTEGER]: number of OpenCL platforms
Code sample
num_platforms = gh_opencl.get_num_platforms()
get_platform_info
Description
Returns the main information about an OpenCL platform.
Syntax
vendor, name, version = gh_opencl.get_platform_info(
pla_index
)
Languages
Parameters
- pla_index [INTEGER]: platform index
Return Values
- vendor, name, version [STRING]: vendor, name and version of the OpenCL platform
Code sample
vendor, name, version = gh_opencl.get_platform_info(0)
| |