Skip to content

Commit 3e601bd

Browse files
committed
disable NaN checks before BLAS calls dgemm.R
1 parent 478d3c4 commit 3e601bd

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

benchmark/scripts/R/dgemm.R

+6-19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
argv <- commandArgs(trailingOnly = TRUE)
44

5+
if (!is.null(options("matprod")[[1]])) options(matprod = "blas")
6+
57
nfrom <- 128
68
nto <- 2048
79
nstep <- 128
@@ -19,46 +21,31 @@ if (length(argv) > 0) {
1921
loops <- as.numeric(argv[z])
2022
}
2123
}
22-
2324
}
2425

2526
p <- Sys.getenv("OPENBLAS_LOOPS")
2627
if (p != "") {
2728
loops <- as.numeric(p)
2829
}
2930

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

4034
n <- nfrom
4135
while (n <= nto) {
42-
A <- matrix(runif(n * n),
43-
ncol = n,
44-
nrow = n,
45-
byrow = TRUE)
46-
B <- matrix(runif(n * n),
47-
ncol = n,
48-
nrow = n,
49-
byrow = TRUE)
36+
A <- matrix(runif(n * n), nrow = n)
37+
B <- matrix(runif(n * n), nrow = n)
5038
C <- 1
5139

5240
z <- system.time(for (l in 1:loops) {
5341
C <- A %*% B
5442
l <- l + 1
5543
})
5644

57-
mflops <- (2.0 * n * n * n) * loops / (z[3] * 1.0e6)
45+
mflops <- (2.0 * n * n * n) * loops / (z[3] * 1e+06)
5846

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

6250
n <- n + nstep
63-
6451
}

0 commit comments

Comments
 (0)