From 0c0b1a8db4e82a7285d2f84b90c5c64837195ba5 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Thu, 8 Oct 2020 10:24:30 +0300 Subject: [PATCH] Use only first device for each device type and backend --- backends/source/dppl_sycl_queue_manager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backends/source/dppl_sycl_queue_manager.cpp b/backends/source/dppl_sycl_queue_manager.cpp index e6f64457fa..b858701465 100644 --- a/backends/source/dppl_sycl_queue_manager.cpp +++ b/backends/source/dppl_sycl_queue_manager.cpp @@ -75,8 +75,15 @@ class QMgrHelper vector_class SelectedDevices; for(auto &d : Devices) { auto devty = d.get_info(); - if(devty == DTy && be == BE) + if(devty == DTy && be == BE) { SelectedDevices.push_back(d); + + // Workaround for situations when in some environments + // get_devices() returns each device TWICE. Then it fails in call + // for context constructor with all doubled devices. + // So use only one first device. + break; + } } if (SelectedDevices.size() > 0) { auto Ctx = context(SelectedDevices);