In this exercise you will learn how to handle synchronous and asynchronous exceptions.
Synchronous errors, such as failure to construct an object, are reported immediately by the runtime throwing an exception.
To catch synchronous exceptions simply wrap your application in a try catch
block and catch a SYCL exception
and print out the error message provided by
the what
member function.
Asynchronous errors, such as an error occurring during execution of a kernel on a device, are reported via user-supplied asynchronous error-handlers.
To catch asynchronous exceptions create an async handler using a lambda
expression which takes an exception_list
, iterates over it and rethrows the
exceptions to be caught by the surrounding try-catch block.
For DevCloud via JupiterLab follow these instructions.
For DPC++: instructions.
For AdaptiveCpp: instructions.