ptsant

ACML fails regression testing under R (NA handling)

Discussion created by ptsant on Aug 23, 2011
Latest reply on Feb 25, 2014 by lejeczek

I noticed that both ACML and ACML-gpu give significant performance benefits under R and I want to use them. However, when testing R, the reg-BLAS regression test fails (see code below). More precisely, although a "NA" (NaN) result is expected, a 0 is returned. I do not know whether this is undefined or wrong behavior, but I am worried that R results may not always be accurate.

Is anyone aware of this and is there a fix?

----- COPY FROM reg-BLAS.R

## found from fallback test in slam 0.1-15
## most likely indicates an inaedquate BLAS.
x <- matrix(c(1, 0, NA, 1), 2, 2)
y <- matrix(c(1, 0, 0, 2, 1, 0), 3, 2)
(z <- tcrossprod(x, y))
stopifnot(identical(z, x %*% t(y)))
stopifnot(is.nan(log(0) %*% 0))
## depended on the BLAS in use: some (including the reference BLAS)
## had z[1,3] == 0 and log(0) %*% 0 as as.matrix(0).

---- R with standard BLAS library

    [,1] [,2] [,3]
[1,]   NA   NA   NA
[2,]    2    1    0

is.nan(log(0) %*% 0) returns NA

---- R with ACML-mp or ACML-gpu library

     [,1] [,2] [,3]
[1,]   NA   NA    0
[2,]    2    1    0

is.nan(log(0) %*% 0) returns 0

Outcomes