From dc601d79d14b82bf54b2e90cfa32ee0ce955e3e4 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Fri, 18 Nov 2016 16:26:50 -0800 Subject: Added the ability to run test exclusively OpenCL devices that are listed by sycl::device::get_devices(). --- .../Eigen/CXX11/src/Tensor/TensorDeviceSycl.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h index 7954d4f6c..3fe0219ac 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h @@ -50,6 +50,28 @@ struct QueueInterface { #endif {} + /// creating device by using selector + /// SyclStreamDevice is not owned. it is the caller's responsibility to destroy it. + explicit QueueInterface(cl::sycl::device d): +#ifdef EIGEN_EXCEPTIONS + m_queue(cl::sycl::queue(d, [&](cl::sycl::exception_list l) { + for (const auto& e : l) { + try { + if (e) { + exception_caught_ = true; + std::rethrow_exception(e); + } + } catch (cl::sycl::exception e) { + std::cerr << e.what() << std::endl; + } + } + })) +#else + m_queue(cl::sycl::queue(d)) +#endif + {} + + /// Allocating device pointer. This pointer is actually an 8 bytes host pointer used as key to access the sycl device buffer. /// The reason is that we cannot use device buffer as a pointer as a m_data in Eigen leafNode expressions. So we create a key /// pointer to be used in Eigen expression construction. When we convert the Eigen construction into the sycl construction we -- cgit v1.2.3