From b8f7a5427e82068f61b43373a8c59c6111858b35 Mon Sep 17 00:00:00 2001 From: Vanya Yaneva Date: Mon, 31 Jul 2017 17:38:59 +0100 Subject: [PATCH] Added exception after printing the SYCL exceptions --- SYCLStream.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/SYCLStream.cpp b/SYCLStream.cpp index d334dd1..68b4840 100644 --- a/SYCLStream.cpp +++ b/SYCLStream.cpp @@ -47,14 +47,25 @@ SYCLStream::SYCLStream(const unsigned int ARRAY_SIZE, const int device_index) std::cout << "Driver: " << getDeviceDriver(device_index) << std::endl; std::cout << "Reduction kernel config: " << dot_num_groups << " groups of size " << dot_wgsize << std::endl; - queue = new cl::sycl::queue(dev, [&](cl::sycl::exception_list l) { - try { - for(auto e: l) { - std::rethrow_exception(e); - } - } catch (cl::sycl::exception e) { - std::cout << e.what(); + queue = new cl::sycl::queue(dev, [&](cl::sycl::exception_list l) + { + bool error = false; + for(auto e: l) + { + try + { + std::rethrow_exception(e); } + catch (cl::sycl::exception e) + { + std::cout << e.what(); + error = true; + } + } + if(error) + { + throw std::runtime_error("SYCL errors detected"); + } }); /* Pre-build the kernels */