aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-11-18 16:26:50 -0800
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-11-18 16:26:50 -0800
commitdc601d79d14b82bf54b2e90cfa32ee0ce955e3e4 (patch)
tree562899b36c755f5b118f90647f622eda77837ca8 /unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h
parentb5e3285e1695ab94e1ca9ae30a05b9e7d816cd03 (diff)
Added the ability to run test exclusively OpenCL devices that are listed by sycl::device::get_devices().
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h22
1 files changed, 22 insertions, 0 deletions
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