MCPcopy Create free account
hub / github.com/boostorg/compute / devices

Method devices

include/boost/compute/platform.hpp:121–145  ·  view source on GitHub ↗

Returns a list of devices on the platform.

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

opencl_errorClass · 0.85
deviceClass · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected