Skip to content

Commit 866aa11

Browse files
Correct compute::context::get_devices method
get a vector of cl_device_id and then use the device ids to populate a vector of compute::device Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 36c8913 commit 866aa11

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

include/boost/compute/context.hpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,15 @@ class context
187187
/// Returns a vector of devices for the context.
188188
std::vector<device> get_devices() const
189189
{
190-
return get_info<std::vector<device> >(CL_CONTEXT_DEVICES);
190+
std::vector<cl_device_id> device_ids =
191+
get_info<std::vector<cl_device_id>>(CL_CONTEXT_DEVICES);
192+
193+
std::vector<device> devices;
194+
for(size_t i = 0; i < device_ids.size(); i++) {
195+
devices.push_back(device(device_ids[i]));
196+
}
197+
198+
return devices;
191199
}
192200

193201
/// Returns information about the context.

0 commit comments

Comments
 (0)