[Mirror] MueLu: Kokkos::abort if a NaN or inf is encountered in SOC algorithms#71
[Mirror] MueLu: Kokkos::abort if a NaN or inf is encountered in SOC algorithms#71
Conversation
…orithms Signed-off-by: malphil <malphil@sandia.gov>
There was a problem hiding this comment.
Code Review
This pull request introduces finiteness checks for strength-of-connection measures within MueLu's dropping functors to detect and handle non-finite values using a new is_finite_type_safe utility. The review feedback suggests optimizing these checks by eliminating redundant validations within loops—specifically by moving invariant diagonal checks outside the loop and avoiding re-validation of overlapping elements in CutDropFunctor. Additionally, implementing an early exit or immediate abort upon detecting a non-finite value is recommended to prevent unnecessary computation.
| nonFiniteValueEncountered |= !is_finite_type_safe(x_aij); | ||
| nonFiniteValueEncountered |= !is_finite_type_safe(y_aij); |
There was a problem hiding this comment.
This loop contains redundant finiteness checks. Since x at iteration i is the same as y from iteration i-1, x_aij has already been validated in the previous step. To improve efficiency, consider checking the first element of row_permutation once before the loop and then only checking y_aij inside the loop. Additionally, since a non-finite value is a fatal error, using an immediate Kokkos::abort or a break would avoid unnecessary processing of the remaining elements in the row.
| auto aiiajj = ATS::magnitude(diag(rlid)) * ATS::magnitude(diag(clid)); // |a_ii|*|a_jj| | ||
| auto aij2 = ATS::magnitude(val) * ATS::magnitude(val); // |a_ij|^2 | ||
|
|
||
| nonFiniteValueEncountered |= !is_finite_type_safe(aiiajj) || !is_finite_type_safe(aij2); |
There was a problem hiding this comment.
The check !is_finite_type_safe(aiiajj) repeatedly validates diag(rlid), which is constant for the entire row. For better performance, consider checking the finiteness of the row's diagonal entry once outside the column loop. Furthermore, since encountering a non-finite value is a fatal error, using an early exit (e.g., break) after detecting the first such value would avoid wasted iterations. This applies to both DropFunctor and VectorDropFunctor.
|
CDash for AT1 results [Only accessible from Sandia networks] |
Automated mirror of upstream PR trilinos#14716 @trilinos/muelu