Closed saminbassiri closed 2 months ago
Here is an example for triggering a DAPHNE execution error from DaphneLib:
Contents of py-example.py
:
from daphne.context.daphne_context import DaphneContext
dc = DaphneContext()
X = dc.seq(1, 3) + dc.seq(1, 2) # mismatching shapes
X.print().compute()
Output of ./run-python py-example.py
:
Traceback (most recent call last):
File "py-example.py", line 11, in <module>
X.print().compute()
File "/daphne/src/api/python/daphne/operator/operation_node.py", line 126, in compute
self._script.execute()
File "/daphne/src/api/python/daphne/script_building/script.py", line 106, in execute
raise RuntimeError(f"Error in DaphneDSL script: {error_message}")
RuntimeError: Error in DaphneDSL script: Execution error: The kernel-function _ewAdd__DenseMatrix_int64_t__DenseMatrix_int64_t__DenseMatrix_int64_t failed during runtime with the following message [ EwBinaryMat(Dense) - lhs and rhs must either have the same dimensions, or one of them must be a row/column vector with the width/height of the other, but lhs has shape (3 x 1) and rhs has shape (2 x 1) ]
| Source file -> "/tmp/DaphneLib/tmpdaphne.daphne":3:6
|
3 | V2=V0 + V1;
| ^~~
[DaphneLib-#717] handle daphne failure in daphne lib
Summary This PR closes issue #717 by handling execution errors in DaphneLib.
Changes:
error_message
: Introduced a new variable in DaphneLibResult to store execution error messages from DSL scripts.src/api/internal/daphne_internal.cpp
to capture and store execution error messages in theerror_message
variable when a DSL script fails.src/api/python/daphne/script_building/script.py
to process and log execution error messages during DSL script execution.