Repository navigation
froll compiled using -O0 fails 2 tests #3353
Description
Activity
- changed the title
[-]Covergage failing on 2 froll tests[/-][+]Coverage failing on 2 froll tests[/+]on Feb 4, 2019 https://travis-ci.org/Rdatatable/data.table/jobs/486208986
it looks like the issue related to rounding error and error correction. Which so far was observed only on windows with 2+ threads #3346, here is Linux and OSX with 1 thread.Related from covr/README.md
Because covr modifies the package code it is possible there are unknown edge cases where that modification affects the output. In addition when tracking coverage for compiled code covr compiles the package without optimization, which can modify behavior (usually due to package bugs which are masked with higher optimization levels).
to reproduce this issue it is enough to set
-O0in Makevars, reinstall and runRscript tests/froll.R. This flag change the way how NaN are handled by compiler.
There might be another problem that matching base R output in those test is likely to depends on-Olevel that has been used during base R installation.ma = function(x, n, na.rm=FALSE, nf.rm=FALSE) { if (!is.double(x)) x = as.double(x) if (!is.integer(n)) n = as.integer(n) ans = rep(NA_real_, nx<-length(x)) if (nf.rm) x[!is.finite(x)] = NA_real_ # exact=F consistency due to https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17441 for (i in n:nx) ans[i]=mean(x[(i-n+1):i], na.rm=na.rm) ans } n = 4 x = 1:16 x[5] = NaN x[6] = NA cc(test=FALSE, debug=TRUE, clean=TRUE) # -O0 data.table(x, frollmean(x, n, algo="exact"), ma(x, n)) # x V2 V3 #... # 4: 4 2.5 2.5 # 5: NaN NaN NaN # 6: NA NA NaN # 7: 7 NA NaN # 8: 8 NA NaN # 9: 9 NA NA # 10: 10 8.5 8.5 #... cc(test=FALSE, debug=FALSE, clean=TRUE) # -O3 data.table(x, frollmean(x, n, algo="exact"), ma(x, n)) # x V2 V3 #... # 4: 4 2.5 2.5 # 5: NaN NaN NaN # 6: NA NaN NaN # 7: 7 NaN NaN # 8: 8 NaN NaN # 9: 9 NA NA # 10: 10 8.5 8.5 #...
Since #3362 is merge issues like this are now properly failing our GL pipeline.
- changed the title
[-]Coverage failing on 2 froll tests[/-][+]compilation using -O0 failing on 2 froll tests[/+]on Feb 6, 2019 - changed the title
[-]compilation using -O0 failing on 2 froll tests[/-][+]froll compiled using -O0 fails 2 tests[/+]on Feb 6, 2019 The issues is more broad, it also affects
gmean, it has been discovered in froll because it is being comprehensively tested.dd(omp=TRUE) ## compile with -O0, still with omp d = data.table(g=c(1L,2L,2L,2L), y=c(3,NaN,NA,7)) d[, mean(y), g, verbose=TRUE] rm(d) cc(test=FALSE, clean=TRUE) ## compile with -O3 d = data.table(g=c(1L,2L,2L,2L), y=c(3,NaN,NA,7)) d[, mean(y), g, verbose=TRUE] rm(d)
output is
GForce optimized j to 'gmean(y)' g V1 <int> <num> 1: 1 3 2: 2 NA # -O0 GForce optimized j to 'gmean(y)' g V1 <int> <num> 1: 1 3 2: 2 NaN # -O3Worth to note that base R is not consistent on NaN/NA handling in mean, as discussed before in https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17441
- added a commit that references this issue
on Feb 6, 2019
We've lost coverage stats due to this :