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
Platforms

The platforms module provides functionality for managing the OpenCL platforms available in the system. More...

Typedefs

typedef struct ccl_platforms CCLPlatforms
 Class which represents the OpenCL platforms available in the system.
 

Functions

cl_uint ccl_platforms_count (CCLPlatforms *platforms)
 Return number of OpenCL platforms found in CCLPlatforms object. More...
 
void ccl_platforms_destroy (CCLPlatforms *platforms)
 Destroy a CCLPlatforms* object, including all underlying platforms, devices and data. More...
 
CCLPlatformccl_platforms_get (CCLPlatforms *platforms, cl_uint index)
 Get platform wrapper object at given index. More...
 
CCLPlatformsccl_platforms_new (CCLErr **err)
 Creates a new CCLPlatforms* object, which contains the list of OpenCL platforms available in the system. More...
 

Detailed Description

The platforms module provides functionality for managing the OpenCL platforms available in the system.

The ccl_platforms_new() function returns a list of platforms available in the system. The ccl_platforms_count() can be used to get the number of platforms in the list, while the ccl_platforms_get() will return the $i^{th}$ platform.

Example:

/* cf4ocl objects. */
CCLPlatforms* platf_list;
CCLPlatform* platf;

/* Other variables. */
cl_uint num_platfs;
CCLErr* err = NULL;

/* Get all platforms in system. */
platf_list = ccl_platforms_new(&err);

/* Get number of platforms in system. */
num_platfs = ccl_platforms_count(platf_list);

/* Cycle through platforms. */
for (cl_uint i = 0; i < num_platfs; ++i) {
/* Get current platform. */
platf = ccl_platforms_get(platf_list, i);

} /* Cycle platforms. */
/* Release platform set, which will release the underlying
* platform wrappers, device wrappers and the requested info. */
ccl_platforms_destroy(platf_list);

Function Documentation

cl_uint ccl_platforms_count ( CCLPlatforms platforms)

Return number of OpenCL platforms found in CCLPlatforms object.

Parameters
[in]platformsObject containing the OpenCL platforms.
Returns
The number of OpenCL platforms found.
Examples:
list_devices.c.

Definition at line 189 of file ccl_platforms.c.

void ccl_platforms_destroy ( CCLPlatforms platforms)

Destroy a CCLPlatforms* object, including all underlying platforms, devices and data.

Parameters
[in]platformsCCLPlatforms object to destroy.
Examples:
list_devices.c.

Definition at line 160 of file ccl_platforms.c.

CCLPlatform * ccl_platforms_get ( CCLPlatforms platforms,
cl_uint  index 
)

Get platform wrapper object at given index.

Parameters
[in]platformsObject containing the OpenCL platforms.
[in]indexIndex of platform to return.
Returns
Platform wrapper object at given index.
Examples:
list_devices.c.

Definition at line 208 of file ccl_platforms.c.

CCLPlatforms * ccl_platforms_new ( CCLErr **  err)

Creates a new CCLPlatforms* object, which contains the list of OpenCL platforms available in the system.

Parameters
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
A new CCLPlatforms object, or NULL in case an error occurs.
Examples:
list_devices.c.

Definition at line 68 of file ccl_platforms.c.