Repository navigation
Don't use exact comparison for FP values. - #2742
Conversation
Fixes the test failure in unoptimized builds, where we do accumulate some error.
miscco
left a comment
There was a problem hiding this comment.
I will look into what the actual standard requirements are but that does indeed look like something that might not be required
| if(real(r) != real(z)) | ||
| { | ||
| is_about(real(r), real(z)); | ||
| } |
There was a problem hiding this comment.
We should either completely loosen the assertion or fix the code. I am for loosening it if it is not a required equality
| if(real(r) != real(z)) | |
| { | |
| is_about(real(r), real(z)); | |
| } | |
| is_about(real(r), real(z)); |
There was a problem hiding this comment.
We're comparing pow(i, j) vs exp(j * log(i)). If the compiler does not optimize the comparison away, and we actually have to do exp, log and multiplication, there's no practical way not to lose precision.
If it helps, I can make a list of the values that we happen to trip on right now, and by how much the result happens to be different. The failure I poked at had the result difference of ~1e-18.
There was a problem hiding this comment.
Looks like the numeric differences only affect double, but they are pretty widespread:
https://gist.github.com/Artem-B/19807d5e4f2e3efb0e3d6319ebed1809
There was a problem hiding this comment.
For whatever reason I'm having trouble reproducing the issue on the host today, so it could be caused by my hacks to debug the issue. The original failure only reported the failure on a GPU. So, let's limit the scope to double on GPU.
| if(imag(r) != imag(z)) | ||
| { | ||
| is_about(imag(r), imag(z)); | ||
| } |
There was a problem hiding this comment.
Ditto
| if(imag(r) != imag(z)) | |
| { | |
| is_about(imag(r), imag(z)); | |
| } | |
| is_about(imag(r), imag(z)); |
There was a problem hiding this comment.
Forgot to comment on using is_about unconditionally. IIRC, when real==imag, is_about ends up dividing by zero for some of the test cases. So, your suggestion makes sense, but is_about needs to be fixed first. I'll take a look.
|
pre-commit.ci autofix |
|
/ok to test |
🟩 CI finished in 1h 38m: Pass: 100%/394 | Total: 6d 23h | Avg: 25m 28s | Max: 1h 13m | Hits: 77%/25866
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 394)
| # | Runner |
|---|---|
| 326 | linux-amd64-cpu16 |
| 28 | linux-arm64-cpu16 |
| 25 | linux-amd64-gpu-v100-latest-1 |
| 15 | windows-amd64-cpu16 |
|
/ok to test |
🟩 CI finished in 1h 12m: Pass: 100%/168 | Total: 1d 01h | Avg: 8m 59s | Max: 38m 38s | Hits: 93%/22346
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 168)
| # | Runner |
|---|---|
| 124 | linux-amd64-cpu16 |
| 19 | linux-amd64-gpu-v100-latest-1 |
| 15 | windows-amd64-cpu16 |
| 10 | linux-arm64-cpu16 |
Fixes the test failure in unoptimized builds, where we do accumulate some error.
Fixes the test failure in unoptimized builds, where we do accumulate some error.
Fixes the test failure in unoptimized builds, where we do accumulate some error.
Description
The test uses exact FP comparison for the operation results, and it fails in unoptimized builds where exp/log operations are not optimized away, and we accumulate some errors.
closes #2741
Checklist