Obtain the list of devices available on a platform.
cl_int clGetDeviceIDs(cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices)
Refers to the platform ID returned by
clGetPlatformIDsor can be NULL. If
platformis NULL, the behavior is implementation-defined.
A bitfield that identifies the type of OpenCL device. The
device_typecan be used to query specific OpenCL devices or all OpenCL devices available. The valid values for
device_typeare specified in the following table.
An OpenCL device that is the host processor. The host processor runs the OpenCL implementations and is a single or multi-core CPU.
An OpenCL device that is a GPU. By this we mean that the device can also be used to accelerate a 3D API such as OpenGL or DirectX.
Dedicated OpenCL accelerators (for example the IBM CELL Blade). These devices communicate with the host processor using a peripheral interconnect such as PCIe.
Dedicated accelerators that do not support programs written in OpenCL C.
The default OpenCL device in the system. The default device cannot be a
All OpenCL devices available in the system except
The number of
cl_device_identries that can be added to
devicesis not NULL, the
num_entriesmust be greater than zero.
A list of OpenCL devices found. The
cl_device_idvalues returned in
devicescan be used to identify a specific OpenCL device. If
devicesargument is NULL, this argument is ignored. The number of OpenCL devices returned is the mininum of the value specified by
num_entriesor the number of OpenCL devices whose type matches
The number of OpenCL devices available that match
num_devicesis NULL, this argument is ignored.
clGetDeviceIDs may return all or a subset of the actual physical devices present in the platform and that match
CL_SUCCESS if the function is executed successfully.
Otherwise it returns one of the following errors:
platformis not a valid platform.
device_typeis not a valid value.
num_entriesis equal to zero and
devicesis not NULL or if both
CL_DEVICE_NOT_FOUNDif no OpenCL devices that matched
CL_OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.
CL_OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.