-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the error handling and reporting #35
Comments
We have the |
There are two broad design goals for error handling for dpCtl:
Our solution can be a combination of both approaches? |
All DPCTL C-api functions change to have It is set to 0 (OK enum) for normal execution, or to a error-signaling enum otherwise. Additionally, the void default_handler(int code, const char *message) {
std::cerr << message << std::endl;
// or fprintf(stderr, "%s\n", message);
} When used by Python, the handler can be used to call void python_handler(int code, const char * message) {
if (PyErr_Occurred()) // if Python error has already been raised, do nothing
return;
switch(code) {
case STD_BAD_ALLOC:
PyErr_SetString(PyExc_MemoryError, message);
break;
case STD_BAD_CAST:
PyErr_SetString(PyExc_TypeError, message);
break;
case SYCL_RUNTIME_ERROR:
// could use PyErr_SetObject to pass both code and message to the exception constructor
PyErr_SetString(PyExc_SyclError, message);
break;
....
default:
break;
}
return;
} Cython functions calling DPCTL library will check for Also, all Cython The error handler function pointer will be used from within SYCL asynchronous error handler, used by DPCTL in SYCL context and SYCL queue constructors. @PokhodenkoSA @shssf @Alexander-Makaryev @diptorupd @reazulhoque |
Since @diptorupd pointed out that MPI solves this problem by keeping/passing around a library state (communicator). Translating this solution to |
As the error handling infrastructure has been totally overhauled in |
The current dpctl error handling broke once we transitioned from the C++ API to the C API. The error reporting and handling in dpctl needs complete redesign.
The text was updated successfully, but these errors were encountered: