From 881ca4231de0b85b986b3e6a19949edcdf6340ec Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Thu, 28 May 2020 14:49:08 +0200 Subject: [PATCH] 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 --- include/boost/compute/context.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/boost/compute/context.hpp b/include/boost/compute/context.hpp index 13154a968..03279b178 100644 --- a/include/boost/compute/context.hpp +++ b/include/boost/compute/context.hpp @@ -187,7 +187,15 @@ class context /// Returns a vector of devices for the context. std::vector get_devices() const { - return get_info >(CL_CONTEXT_DEVICES); + std::vector device_ids = + get_info >(CL_CONTEXT_DEVICES); + + std::vector 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.