-
Notifications
You must be signed in to change notification settings - Fork 355
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
Fix Roundoff Domain #3247
Fix Roundoff Domain #3247
Conversation
38d3a0a
to
eeaf026
Compare
A test is here. https://github.com/WeiqunZhang/amrex-devtests/blob/main/roundoff_domain/main.cpp It takes up to 53 iterations. Need to test with different compiler optimization flags and fp model flags. Also need to test single precision and mixed precision. |
a060252
to
fb3b6d4
Compare
Using |
fb3b6d4
to
0d740b2
Compare
aefa307
to
3d89977
Compare
There was a flaw in amrex::Geometry::computeRoundoffDomain. If probhi is close to zero, std::nextafter towards negative infinity will be a very small number (e.g., 1.e-300). So the function will be able to find the lowest value of roundoff_hi that's outside the domain within a reasonable number of iterations. In the new implementation, we use bisection to find the lowest value of roundoff_lo that's inside the domain and the highest value fo roundoff_hi that's inside the domain, up to a tolerance.
3d89977
to
5a1ca61
Compare
Also fix an assertion issue in AMReX-Codes#3247.
Also fix an assertion issue in AMReX-Codes#3247.
Also fix an assertion issue in AMReX-Codes#3247.
Also fix an assertion issue in AMReX-Codes#3247.
Also fix an assertion issue in AMReX-Codes#3247.
Also fix an assertion issue in AMReX-Codes#3247.
Also fix an assertion issue in AMReX-Codes#3247.
The new test exposes an issue with Intel compiler. So we have to rewrite the computeRoundoffDomain slightly. Also fix an assertion issue in AMReX-Codes#3247.
The new test exposes an issue with Intel compiler. So we have to rewrite the computeRoundofDomain function in a slightly different way to avoid roundoff difference between `auto r = f(x-y)` and `z = x-y; auto r = f(z)`. Also fix an assertion issue in #3247.
There was a flaw in amrex::Geometry::computeRoundoffDomain. If probhi is close to zero, std::nextafter towards negative infinity will be a very small number (e.g., 1.e-300). So the function will be able to find the lowest value of roundoff_hi that's outside the domain within a reasonable number of iterations. In the new implementation, we use bisection to find the lowest value of roundoff_lo that's inside the domain and the highest value fo roundoff_hi that's inside the domain, up to a tolerance. X-ref: - AMReX-Codes#3243 - AMReX-Codes#3199
The new test exposes an issue with Intel compiler. So we have to rewrite the computeRoundofDomain function in a slightly different way to avoid roundoff difference between `auto r = f(x-y)` and `z = x-y; auto r = f(z)`. Also fix an assertion issue in AMReX-Codes#3247.
* Rework handling of roundoff domain extent (AMReX-Codes#3199) * Fix periodic boundary bug in AMReX-Codes#3199 (AMReX-Codes#3243) * Fix Roundoff Domain (AMReX-Codes#3247) * Add Tests/RoundoffDomain (AMReX-Codes#3248) * Roundoff errors in computeRoundoffDomain (AMReX-Codes#3255)
There was a flaw in amrex::Geometry::computeRoundoffDomain. If probhi is close to zero, std::nextafter towards negative infinity will be a very small number (e.g., 1.e-300). So the function will be able to find the lowest value of roundoff_hi that's outside the domain within a reasonable number of iterations.
In the new implementation, we use bisection to find the lowest value of roundoff_lo that's inside the domain and the highest value fo roundoff_hi that's inside the domain, up to a tolerance.
X-ref: