Skip to content
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

fcompare: Add option for an absolute tolerance check #1537

Merged
merged 1 commit into from
Nov 13, 2020

Conversation

sayerhs
Copy link
Contributor

@sayerhs sayerhs commented Nov 12, 2020

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.

--------------------------------------------------------------------------

            variable name            absolute error            relative error
                                        (||A - B||)         (||A - B||/||A||)
 ----------------------------------------------------------------------------
 level = 0
 density                                          0                         0
 gpx                                1.108446668e-14           1.669216956e-10
 gpy                                 5.96855898e-15           1.675179285e-07
 gpz                                9.048317651e-15           4.122654211e-14
 mu_turb                            7.160938509e-15           2.134236096e-14
 p                                  1.136868377e-13           3.862064706e-15
 temperature                        4.547473509e-13           1.697082323e-15
 tke                                4.468647674e-15           4.855703851e-14
 velocityx                          1.065814104e-14           1.332264646e-15
 velocityy                          3.714614144e-15           1.064078537e-10
 velocityz                           1.17857113e-14           1.076369457e-10
 velocity_mueff                     7.160938509e-15           2.134236096e-14

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • are described in the proposed changes to the AMReX documentation, if appropriate

@sayerhs sayerhs self-assigned this Nov 12, 2020
@WeiqunZhang WeiqunZhang merged commit c80007d into AMReX-Codes:development Nov 13, 2020
@sayerhs sayerhs deleted the f/fcompare branch November 13, 2020 00:38
sayerhs added a commit to sayerhs/amr-wind that referenced this pull request Nov 13, 2020
- Update AMReX to get latest fcompare that supports absolute tolerance
checks (AMReX-Codes/amrex#1537)

- Change CTestList to add tolerances
sayerhs added a commit to sayerhs/amrex that referenced this pull request Nov 14, 2020
PR AMReX-Codes#1537 introduced the option to allow tolerance checks on both absolute and
relative tolerances. However, the check used `and` instead of `or` to allow
tests to pass when either absolute or relative error was below user-specified
tolerance.
WeiqunZhang pushed a commit that referenced this pull request Nov 16, 2020
PR #1537 introduced the option to allow tolerance checks on both absolute and
relative tolerances. However, the check used `and` instead of `or` to allow
tests to pass when either absolute or relative error was below user-specified
tolerance.

## Checklist

The proposed changes:
- [X] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX users
- [ ] are described in the proposed changes to the AMReX documentation, if appropriate
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