Returns a list of devices on the platform.
| 119 | |
| 120 | /// Returns a list of devices on the platform. |
| 121 | std::vector<device> devices(cl_device_type type = CL_DEVICE_TYPE_ALL) const |
| 122 | { |
| 123 | size_t count = device_count(type); |
| 124 | if(count == 0){ |
| 125 | // no devices for this platform |
| 126 | return std::vector<device>(); |
| 127 | } |
| 128 | |
| 129 | std::vector<cl_device_id> device_ids(count); |
| 130 | cl_int ret = clGetDeviceIDs(m_platform, |
| 131 | type, |
| 132 | static_cast<cl_uint>(count), |
| 133 | &device_ids[0], |
| 134 | 0); |
| 135 | if(ret != CL_SUCCESS){ |
| 136 | BOOST_THROW_EXCEPTION(opencl_error(ret)); |
| 137 | } |
| 138 | |
| 139 | std::vector<device> devices; |
| 140 | for(cl_uint i = 0; i < count; i++){ |
| 141 | devices.push_back(device(device_ids[i])); |
| 142 | } |
| 143 | |
| 144 | return devices; |
| 145 | } |
| 146 | |
| 147 | /// Returns the number of devices on the platform. |
| 148 | size_t device_count(cl_device_type type = CL_DEVICE_TYPE_ALL) const |
nothing calls this directly
no test coverage detected