-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/arkode sts #541
base: develop
Are you sure you want to change the base?
Feature/arkode sts #541
Conversation
Unfortunately, the rebase to |
12940d0
to
62bccbd
Compare
Yeah, I think in the future we should not rebase develop on main (if main is updated directly) and instead do a merge. I don't see a real advantage to having the same linear history for main and develop, and it seems the rebase has a pretty big downside. |
Indeed. Although rebasing might be no big deal for branches with 1-2 commits, it is a huge waste of time for a branch with any appreciable amount of development. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still need to look at the changes in src/arkode
, but I wanted to share my comments so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more set of comments, covering the rest of this draft PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've finished reviewing the documentation updates. I'll review the code soon.
Co-authored-by: Daniel R. Reynolds <[email protected]>
Co-authored-by: Daniel R. Reynolds <[email protected]>
I have completed my revision of the PR. @gardner48, thanks for your comments on the RHS evaluations. I’ve found a way to reduce one more line of vectors, which aligns better with our low-storage claim. This new approach involves recomputing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just finished going over the revisions to this PR, and I have a few more minor requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the changes in the .gitlab folder intended?
|
||
#ifndef SUNIfloor | ||
#if defined(SUNDIALS_DOUBLE_PRECISION) | ||
#define SUNIfloor(x) ((sunindextype)(floor((x)) + SUN_RCONST(0.5))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why the +0.5 is necessary (and in round function below). This macro has the potential to cause undefined behavior if x is greater than the max sunindextype value. If we can avoid the cast that would be ideal, but if not we should document the potential for undefined behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think @drreynolds? Where do you think we should document this behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that adding 0.5 is the "standard" trick to ensure that floating-point output from floor
is cast to the correct integer.
SUNDIALS has no documentation for our "math" functions, so I do not have a recommendation on where to put it there. I recommend that the comments above (line 329) be updated to mention the danger when casting the output of floor to the nearest sunindextype
for arguments that exceed the representable range of sunindextype
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that adding 0.5 is the "standard" trick to ensure that floating-point output from floor is cast to the correct integer.
I think this is conflating the standard trick for rounding:
(sunindextype) (x + SUN_RCONST(0.5))
with simply calling round
or floor
and casting. Since floor
is already called, I see no need to for the +0.5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The round
function returns a double
, while an int
is expected. Casting a double
to an int
will truncate the decimal part. If round
produces a value slightly less than the expected integer, casting will result in an integer that is one less than desired. To avoid this phenomena, we add 0.5 after rounding and before casting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be off on this, but if the algorithm to compute the number of required stages for a given step size h
and spectral radius rho
is updated to do the comparisons/calculations in floating-point arithmetic, and to then only cast the final result to int
, do we even need these new integer-valued functions (e.g., SUNIfloor
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No matter at which stage we do, we have to cast ss
to an integer. Can you check the current commit? I think your suggestion will help with limiting ss
so that we will not encounter too big integer issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the change. My only recommendation is to use step_mem->req_stages = SUNIceil(ss);
so that we are certain to use a "stable" number of stages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ceiled the number once on the top to find ss
, so ceiling one more time might end up increasing it by one for the same double
argument type reasoning. round
seemed to be more appropriate option for me.
I'm guessing they are not intended. I noticed that after the Gitlab CI PR #595 was merged, my local repository clones showed conflicts that needed to be resolved using
I'm guessing that @maggul may have "resolved" the issue in some other way. @maggul, can you clarify what you did to update |
@maggul Should just run
and that should fix things. |
This is a draft PR for feedback on new STS module.