Skip to content

Rhaas/sc#377

Merged
rhaas80 merged 3 commits intolwji/scfrom
rhaas/sc
Mar 24, 2026
Merged

Rhaas/sc#377
rhaas80 merged 3 commits intolwji/scfrom
rhaas/sc

Conversation

@rhaas80
Copy link
Copy Markdown
Member

@rhaas80 rhaas80 commented Mar 12, 2026

@eschnett @lwJi @yosef-zlochower here's some sanity checks that will prevent checkpointing and interpolation when not possible.

@rhaas80 rhaas80 marked this pull request as draft March 12, 2026 22:28
@rhaas80
Copy link
Copy Markdown
Member Author

rhaas80 commented Mar 12, 2026

let me redo this...

@rhaas80 rhaas80 marked this pull request as ready for review March 12, 2026 22:39
@rhaas80
Copy link
Copy Markdown
Member Author

rhaas80 commented Mar 12, 2026

better

// const int component = mfp.index();

min_level_iteration_used =
std::min(min_level_iteration_used, leveldata.iteration);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This test seems to fail because min_level_iteration_used.numerator is long int max, and the test x.num * y.den overflows when den > 1

friend constexpr bool operator<(const rational &x, const rational &y) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

worked around by using -1 to indicate the "unitilalized" case plus a couple of extra workarounds for MPI's MPI_MAX reduction.

A "cleaner" solution would be to make the < comparing not overflow by doing repeating divisions with remainders until a decision has been reached (is slow) or using double-length numbers as intermediaries (that would be fast I think). Both are overkill for this single application though.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I ran a test that confirmed that the code correctly errors out when checkpointing on unaligned time levels and that interpolation errors out if time interpolation is required. Checkpointing on aligned timelevels works and interpolations not requiring time interpolation also work

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Great. Thanks for checking. That leaves as the only place that is a bit iffy the cast to double in the interpolator check, which reduces things to 53 bits of information (size of the mantissa of a double). However the iterations also need to fit into Cactus' cctk_iteration which is a int so 32bit only anyway and since refinement in time is restricted to powers of two we can exactly represent the rat64 as a double for all cases that Cactus can actually encounter.

@rhaas80
Copy link
Copy Markdown
Member Author

rhaas80 commented Mar 23, 2026

Addressed reviewer comments.

@rhaas80 rhaas80 merged commit b93389e into lwji/sc Mar 24, 2026
16 checks passed
@rhaas80 rhaas80 deleted the rhaas/sc branch March 24, 2026 19:17
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