Skip to content

Commit 7629342

Browse files
Fixed TBB warnings on setting GPU queue
Solution is not to create context on devices that are not of the requested device type or not from the requested backend. ``` Python 3.7.7 (default, Jul 14 2020, 22:02:37) Type 'copyright', 'credits' or 'license' for more information IPython 7.17.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import dpctl In [2]: with dpctl.device_context('opencl:gpu'): ...: print(1) ...: 1 In [3]: with dpctl.device_context('level0:gpu'): ...: print(1) ...: 1 ```
1 parent 4e6aabc commit 7629342

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

backends/source/dppl_sycl_queue_manager.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,24 @@ class QMgrHelper
6565
if (Devices.size() == 1) {
6666
auto d = Devices[0];
6767
auto devty = d.get_info<info::device::device_type>();
68-
auto Ctx = context(d);
6968
if(devty == DTy && be == BE) {
70-
queues->emplace_back(Ctx, d);
69+
auto Ctx = context(d);
70+
queues->emplace_back(Ctx, d);
7171
break;
7272
}
7373
}
7474
else {
75-
auto Ctx = context(Devices);
76-
for(auto &d : Devices) {
75+
vector_class<device> SelectedDevices;
76+
for(auto &d : Devices) {
7777
auto devty = d.get_info<info::device::device_type>();
78-
if(devty == DTy && be == BE) {
79-
queues->emplace_back(Ctx, d);
80-
break;
81-
}
82-
}
78+
if(devty == DTy && be == BE)
79+
SelectedDevices.push_back(d);
80+
}
81+
if (SelectedDevices.size() > 0) {
82+
auto Ctx = context(SelectedDevices);
83+
auto d = SelectedDevices[0];
84+
queues->emplace_back(Ctx, d);
85+
}
8386
}
8487
}
8588
return queues;

0 commit comments

Comments
 (0)