patr-schm / TinyAD

Automatic Differentiation in Geometry Processing Made Simple
MIT License
371 stars 17 forks source link

How to terminate gracefully? #12

Open zoharl3 opened 1 month ago

zoharl3 commented 1 month ago

Exceptions shouldn't be thrown out of an omp region, and they aren't caught.

For example, in ScalarObjectiveTerm::eval_with_derivatives_add(), an exception is thrown within an omp parallel:

TINYAD_ASSERT_FINITE_MAT(element_results[i_element].grad)

If an app runs on a dataset and one model is bad, then the application would terminate unexpectedly.