Skip to content

Commit

Permalink
Correct compute::context::get_devices method
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
JablonskiMateusz committed Jul 8, 2020
1 parent 36c8913 commit 881ca42
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion include/boost/compute/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,15 @@ class context
/// Returns a vector of devices for the context.
std::vector<device> get_devices() const
{
return get_info<std::vector<device> >(CL_CONTEXT_DEVICES);
std::vector<cl_device_id> device_ids =
get_info<std::vector<cl_device_id> >(CL_CONTEXT_DEVICES);

std::vector<device> devices;
for(size_t i = 0; i < device_ids.size(); i++) {
devices.push_back(device(device_ids[i]));
}

return devices;
}

/// Returns information about the context.
Expand Down

0 comments on commit 881ca42

Please sign in to comment.