fcompare: Add option for an absolute tolerance check #1537
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a command line option to
fcompare
that takes in a user-specified tolerance for absolute error and adds logic to compare both absolute and relative errors against user-specified tolerances.Since
-a
is already used as a short-form for--allow_diff_grids
, I have only used--abs_tol
as the option without a short version when parsing command line options.Additional background
For ExaWind/AMR-Wind we would like to compare our nightly regression tests executing on GPUs against plot files generated on CPUs. However, due to indeterministic execution of nodal projection on GPUs the solutions are slightly different for each GPU run. In most cases, the relative tolerance specification is sufficient. However, for particular cases when the absolute error is really small, there are situations when relative error exceeds the specified tolerance and the check fails, as shown in the following fcompare output. Here
gpx, gpy, velocityy, velocityz
are failing checks. Having an absolute tolerance check will allow skipping these corner cases.Checklist
The proposed changes: