cf4ocl (C Framework for OpenCL)  v2.1.0
Object-oriented framework for developing and benchmarking OpenCL projects in C/C++
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Device query

This module facilitates the querying of OpenCL devices. More...

Data Structures

struct  ccl_devquery_map
 Maps a string to a cl_device_info bitfield. More...
 

Macros

#define ccl_devquery_type2str(type)
 Map an OpenCL cl_device_type object to a string identifying the device type. More...
 
#define ccl_devquery_type2str(type)
 Map an OpenCL cl_device_type object to a string identifying the device type. More...
 

Typedefs

typedef char *(* ccl_devquery_format )(CCLWrapperInfo *info, char *out, size_t size, const char *units)
 Output formatting function. More...
 
typedef char *(* ccl_devquery_format )(CCLWrapperInfo *info, char *out, size_t size, const char *units)
 Output formatting function. More...
 
typedef struct ccl_devquery_map CCLDevQueryMap
 Maps a string to a cl_device_info bitfield.
 
typedef struct ccl_devquery_map CCLDevQueryMap
 Maps a string to a cl_device_info bitfield.
 

Functions

gchar * ccl_devquery_get_prefix_final (const char *prefix)
 Get a final device info prefix in the same format as kept in the ccl_devquery_info_map. More...
 
const CCLDevQueryMapccl_devquery_match (const char *substr, int *idx)
 Search for a device information parameter by matching part of its name. More...
 
cl_device_info ccl_devquery_name (const char *name)
 Return a cl_device_info object given its name. More...
 
const CCLDevQueryMapccl_devquery_prefix (const char *prefix, int *size)
 Get a pointer to the first device information parameter which has the given prefix. More...
 

Variables

const CCLDevQueryMap ccl_devquery_info_map []
 Map of parameter name strings to respective cl_device_info bitfields, long description string, format output function and a units suffix. More...
 
const CCLDevQueryMap ccl_devquery_info_map []
 Map of parameter name strings to respective cl_device_info bitfields, long description string, format output function and a units suffix. More...
 
const int ccl_devquery_info_map_size
 Size of parameter information map. More...
 
const int ccl_devquery_info_map_size
 Size of parameter information map. More...
 

Detailed Description

This module facilitates the querying of OpenCL devices.

It primarily supports the ccl_devinfo utility, but may also be of use to client code.

Macro Definition Documentation

#define ccl_devquery_type2str (   type)
Value:
(((type) & CL_DEVICE_TYPE_CPU) ? "CPU" : \
(((type) & CL_DEVICE_TYPE_GPU) ? "GPU" : \
(((type) & CL_DEVICE_TYPE_ACCELERATOR) ? "Accelerator" : \
(((type) & CL_DEVICE_TYPE_CUSTOM) ? "Custom" : \
"Unknown"))))

Map an OpenCL cl_device_type object to a string identifying the device type.

Parameters
[in]typeThe OpenCL cl_device_type.
Returns
String identifying device type.

Definition at line 135 of file ccl_device_query.h.

#define ccl_devquery_type2str (   type)
Value:
(((type) & CL_DEVICE_TYPE_CPU) ? "CPU" : \
(((type) & CL_DEVICE_TYPE_GPU) ? "GPU" : \
(((type) & CL_DEVICE_TYPE_ACCELERATOR) ? "Accelerator" : \
(((type) & CL_DEVICE_TYPE_CUSTOM) ? "Custom" : \
"Unknown"))))

Map an OpenCL cl_device_type object to a string identifying the device type.

Parameters
[in]typeThe OpenCL cl_device_type.
Returns
String identifying device type.

Definition at line 135 of file ccl_device_query.h.

Typedef Documentation

typedef char*(* ccl_devquery_format)(CCLWrapperInfo *info, char *out, size_t size, const char *units)

Output formatting function.

Parameters
[in]infoCL device information bitfield.
[out]outChar buffer (pre-allocated) were to write formatted output.
[in]sizeMaximum output length.
[in]unitsParameter units suffix.
Returns
Formatted output (same address as parameter out).

Definition at line 58 of file ccl_device_query.h.

typedef char*(* ccl_devquery_format)(CCLWrapperInfo *info, char *out, size_t size, const char *units)

Output formatting function.

Parameters
[in]infoCL device information bitfield.
[out]outChar buffer (pre-allocated) were to write formatted output.
[in]sizeMaximum output length.
[in]unitsParameter units suffix.
Returns
Formatted output (same address as parameter out).

Definition at line 58 of file ccl_device_query.h.

Function Documentation

gchar * ccl_devquery_get_prefix_final ( const char *  prefix)

Get a final device info prefix in the same format as kept in the ccl_devquery_info_map.

Parameters
[in]prefixRaw device information prefix. Several forms are accepted. For example, for CL_DEVICE_ENDIAN_LITTLE, strings such as "CL_DEVICE_ENDIAN_LITTLE", "ENDIAN_LITTLE" or "endian_little" are accepted.
Returns
A final device info prefix in the same format as kept in the ccl_devquery_info_map, or NULL if given prefix is not valid. Should be freed with g_free() function from GLib.

Definition at line 984 of file ccl_device_query.c.

const CCLDevQueryMap * ccl_devquery_match ( const char *  substr,
int *  idx 
)

Search for a device information parameter by matching part of its name.

This function is supposed to be used in a loop.

Parameters
[in]substrString to match with parameter name.
[in,out]idxNext index, should be zero in the first call, and the function updates within calls.
Returns
A matching CCLDevQueryMap*, or NULL if search is over.

Definition at line 1160 of file ccl_device_query.c.

cl_device_info ccl_devquery_name ( const char *  name)

Return a cl_device_info object given its name.

Parameters
[in]nameName of cl_device_info object. Several forms are accepted. For example, for CL_DEVICE_ENDIAN_LITTLE, strings such as "CL_DEVICE_ENDIAN_LITTLE", "ENDIAN_LITTLE" or "endian_little" are accepted.
Returns
A cl_device_info object given its name or 0 if no suitable cl_device_info is found for the given name.

Definition at line 1030 of file ccl_device_query.c.

const CCLDevQueryMap * ccl_devquery_prefix ( const char *  prefix,
int *  size 
)

Get a pointer to the first device information parameter which has the given prefix.

Parameters
[in]prefixDevice information parameter prefix. Can be in lower or uppercase, and start with "cl_device_" or not.
[out]sizeLocation where to put number of matching parameters, or NULL if it is to be ignored.
Returns
pointer to the first device information parameter which has the given prefix or NULL if nothing found.

Definition at line 1072 of file ccl_device_query.c.

Variable Documentation

const CCLDevQueryMap ccl_devquery_info_map[]

Map of parameter name strings to respective cl_device_info bitfields, long description string, format output function and a units suffix.

Definition at line 483 of file ccl_device_query.c.

const CCLDevQueryMap ccl_devquery_info_map[]

Map of parameter name strings to respective cl_device_info bitfields, long description string, format output function and a units suffix.

Definition at line 483 of file ccl_device_query.c.

const int ccl_devquery_info_map_size

Size of parameter information map.

Definition at line 477 of file ccl_device_query.c.

const int ccl_devquery_info_map_size

Size of parameter information map.

Definition at line 477 of file ccl_device_query.c.