Skip to content

Commit b70fd23

Browse files
committed
disable NaN checks before BLAS calls dsolve.R
1 parent def0385 commit b70fd23

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

benchmark/scripts/R/dsolve.R

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
argv <- commandArgs(trailingOnly = TRUE)
44

5+
if (!is.null(options("matprod")[[1]])) {
6+
options(matprod = "blas")
7+
}
8+
59
nfrom <- 128
610
nto <- 2048
711
nstep <- 128
@@ -19,39 +23,30 @@ if (length(argv) > 0) {
1923
loops <- as.numeric(argv[z])
2024
}
2125
}
22-
2326
}
2427

2528
p <- Sys.getenv("OPENBLAS_LOOPS")
2629
if (p != "") {
2730
loops <- as.numeric(p)
2831
}
2932

30-
31-
cat(sprintf(
32-
"From %.0f To %.0f Step=%.0f Loops=%.0f\n",
33-
nfrom,
34-
nto,
35-
nstep,
36-
loops
37-
))
33+
cat(sprintf("From %.0f To %.0f Step=%.0f Loops=%.0f\n", nfrom, nto, nstep, loops))
3834
cat(sprintf(" SIZE Flops Time\n"))
3935

4036
n <- nfrom
4137
while (n <= nto) {
42-
A <- matrix(rnorm(n * n), ncol = n, nrow = n)
43-
B <- matrix(rnorm(n * n), ncol = n, nrow = n)
38+
A <- matrix(rnorm(n * n), nrow = n)
39+
B <- matrix(rnorm(n * n), nrow = n)
4440

4541
z <- system.time(for (l in 1:loops) {
4642
solve(A, B)
4743
})
4844

49-
mflops <-
50-
(2.0 / 3.0 * n * n * n + 2.0 * n * n * n) * loops / (z[3] * 1.0e6)
45+
mflops <- (2.0/3 * n * n * n + 2 * n * n * n) * loops/ (z[3] * 1e6)
5146

5247
st <- sprintf("%.0fx%.0f :", n, n)
5348
cat(sprintf("%20s %10.2f MFlops %10.6f sec\n", st, mflops, z[3]))
5449

5550
n <- n + nstep
56-
5751
}
52+

0 commit comments

Comments
 (0)