Skip to content
Snippets Groups Projects
Commit ddb5d844 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

small test code

parent c973246d
No related branches found
No related tags found
No related merge requests found
Pipeline #122754 failed
test.cpp 0 → 100644
#include <iostream>
#include <CL/sycl.hpp>
class invalid_kernel;
int main(int, char**) {
auto exception_handler = [] (cl::sycl::exception_list exceptions) {
for (std::exception_ptr const& e : exceptions) {
try {
std::rethrow_exception(e);
} catch(cl::sycl::exception const& e) {
std::cout << "Caught asynchronous SYCL exception:\n"
<< e.what() << std::endl;
}
}
};
cl::sycl::queue queue(cl::sycl::default_selector{}, exception_handler);
queue.submit([&] (cl::sycl::handler& cgh) {
auto range = cl::sycl::nd_range<1>(cl::sycl::range<1>(1), cl::sycl::range<1>(10));
cgh.parallel_for<class invalid_kernel>(range, [=] (cl::sycl::nd_item<1>) {});
});
try {
queue.wait_and_throw();
} catch (cl::sycl::exception const& e) {
std::cout << "Caught synchronous SYCL exception:\n"
<< e.what() << std::endl;
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment