Using the OpenCL C++ bindings, device discovery is simple boilerplate code that will enumerate all devices of the requested type in a C++ vector.
Context context(CL_DEVICE_TYPE_ACCELERATOR); std::vector<Device> devices = context.getInfo<CL_CONTEXT_DEVICES>();
The above code will create an OpenCL context containing all devices in the system of type CL_DEVICE_TYPE_ACCELERATOR. It then queries that context to retrieve a list of those devices into a C++ vector object. The DSPs in the TI OpenCL implementation have a device type of CL_DEVICE_TYPE_ACCELERATOR. Other OpenCL device types include:
The TI OpenCL implementation currently only supports DSP devices and therefore the device types CL_DEVICE_TYPE_DEFAULT, CL_DEVICE_TYPE_ACCELERATOR, CL_DEVICE_TYPE_ALL are all synonymous.
There are many OpenCL code examples available on the web. Many of them explicitly use the CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_GPU device types for context creation. The TI OpenCL implementation does not currently support CPU or GPU devices, so those examples unmodified will have empty device lists. When attempting to compile and run these examples on the TI OpenCL implementation, it will be necessary to change the device type to CL_DEVICE_TYPE_DEFAULT, CL_DEVICE_TYPE_ACCELERATOR, or CL_DEVICE_TYPE_ALL.