Added the ability to run test exclusively OpenCL devices that are listed by sycl::device::get_devices().

This commit is contained in:
Benoit Steiner
2016-11-18 16:26:50 -08:00
parent b5e3285e16
commit dc601d79d1
2 changed files with 29 additions and 9 deletions

View File

@@ -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