Skip to content

[Mirror] MueLu: Kokkos::abort if a NaN or inf is encountered in SOC algorithms#71

Open
csiefer2 wants to merge 1 commit intodevelopfrom
pr-mirror-14716
Open

[Mirror] MueLu: Kokkos::abort if a NaN or inf is encountered in SOC algorithms#71
csiefer2 wants to merge 1 commit intodevelopfrom
pr-mirror-14716

Conversation

@csiefer2
Copy link
Copy Markdown
Owner

@csiefer2 csiefer2 commented Apr 7, 2026

Automated mirror of upstream PR trilinos#14716 @trilinos/muelu

…orithms

Signed-off-by: malphil <malphil@sandia.gov>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +977 to +978
nonFiniteValueEncountered |= !is_finite_type_safe(x_aij);
nonFiniteValueEncountered |= !is_finite_type_safe(y_aij);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

CDash for AT1 results [Only accessible from Sandia networks]
CDash for AT2 results [Currently only accessible from Sandia networks]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants