File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -83,11 +83,19 @@ class context
83
83
84
84
cl_int error = 0 ;
85
85
86
+ std::vector<cl_device_id > device_ids;
87
+ std::string name, version;
88
+ for (size_t i = 0 ; i < devices.size (); ++i) {
89
+ const device &dev = devices[i];
90
+ name = dev.name ();
91
+ version = dev.version ();
92
+ device_ids.push_back (devices[i].get ());
93
+ }
86
94
m_version = 0 ;
87
95
m_context = clCreateContext (
88
96
properties,
89
- static_cast <cl_uint>(devices .size ()),
90
- reinterpret_cast <const cl_device_id *>(&devices [0 ]),
97
+ static_cast <cl_uint>(device_ids .size ()),
98
+ reinterpret_cast <const cl_device_id *>(&device_ids [0 ]),
91
99
0 ,
92
100
0 ,
93
101
&error
@@ -207,7 +215,12 @@ class context
207
215
// / Returns a vector of devices for the context.
208
216
std::vector<device> get_devices () const
209
217
{
210
- return get_info<std::vector<device> >(CL_CONTEXT_DEVICES);
218
+ std::vector<device> out;
219
+ std::vector<cl_device_id > id_vector = get_info<std::vector<cl_device_id > >(CL_CONTEXT_DEVICES);
220
+ for (std::vector<cl_device_id >::iterator it = id_vector.begin (); it != id_vector.end (); ++it) {
221
+ out.push_back (device (*it));
222
+ }
223
+ return out;
211
224
}
212
225
213
226
// / Returns information about the context.
You can’t perform that action at this time.
0 commit comments