1
0
mirror of https://github.com/andre-wojtowicz/blas-benchmarks synced 2024-11-28 05:40:28 +01:00

added saving host info;

added saving results in rds files;
renamed benchmark scripts
This commit is contained in:
Andrzej Wójtowicz 2016-05-19 19:11:33 +02:00
parent d1f13a3a06
commit eb01728fb6
7 changed files with 139 additions and 62 deletions

1
.gitignore vendored
View File

@ -19,3 +19,4 @@ vignettes/*.pdf
cpuinfo cpuinfo
hosts-list.txt hosts-list.txt
ssh/rsa.key ssh/rsa.key
*.rds

75
benchmark-revolution.R Normal file
View File

@ -0,0 +1,75 @@
# source: https://gist.github.com/andrie/24c9672f1ea39af89c66#file-rro-mkl-benchmark-r
runs = 10
results = data.frame(name=character(), time=numeric())
cat(c("Runs :", runs, "\n"))
# Initialization
set.seed (1)
m <- 10000
n <- 5000
A <- matrix (runif (m*n),m,n)
cat("Matrix Multiply : ")
cumulate = 0
for (i in 1:runs)
cumulate = cumulate + as.numeric(system.time (B <- crossprod(A))[3])
results = rbind(results, data.frame(name="Matrix Multiply",
time=cumulate/runs))
cat(c(cumulate/runs, "\n"))
cat("Cholesky Factorization : ")
cumulate = 0
for (i in 1:runs)
cumulate = cumulate + as.numeric(system.time (C <- chol(B))[3])
results = rbind(results, data.frame(name="Cholesky Factorization",
time=cumulate/runs))
cat(c(cumulate/runs, "\n"))
cat("Singular Value Deomposition : ")
m <- 10000
n <- 2000
A <- matrix (runif (m*n),m,n)
cumulate = 0
for (i in 1:runs)
cumulate = cumulate + as.numeric(system.time (S <- svd (A,nu=0,nv=0))[3])
results = rbind(results, data.frame(name="Singular Value Deomposition",
time=cumulate/runs))
cat(c(cumulate/runs, "\n"))
cat("Principal Components Analysis : ")
m <- 10000
n <- 2000
A <- matrix (runif (m*n),m,n)
cumulate = 0
for (i in 1:runs)
cumulate = cumulate + as.numeric(system.time (P <- prcomp(A))[3])
results = rbind(results, data.frame(name="Principal Components Analysis",
time=cumulate/runs))
cat(c(cumulate/runs, "\n"))
cat("Linear Discriminant Analysis : ")
library('MASS')
g <- 5
k <- round (m/2)
A <- data.frame (A, fac=sample (LETTERS[1:g],m,replace=TRUE))
train <- sample(1:m, k)
cumulate = 0
for (i in 1:runs)
cumulate = cumulate + as.numeric(system.time (L <- lda(fac ~., data=A, prior=rep(1,g)/g, subset=train))[3])
results = rbind(results, data.frame(name="Linear Discriminant Analysis",
time=cumulate/runs))
cat(c(cumulate/runs, "\n"))
attr(results, "runs") = runs
saveRDS(results, paste0("test-revolution-", ifelse(exists("blasLibName"), blasLibName, ""), ".rds"))

View File

@ -1,7 +1,6 @@
# source: http://r.research.att.com/benchmarks/R-benchmark-25.R # source: http://r.research.att.com/benchmarks/R-benchmark-25.R
library(methods) # for Rscript # R Benchmark 2.5.1 (05/2016)
# R Benchmark 2.5 (06/2008) [Simon Urbanek] # R Benchmark 2.5 (06/2008) [Simon Urbanek]
# version 2.5: scaled to get roughly 1s per test, R 2.7.0 @ 2.6GHz Mac Pro # version 2.5: scaled to get roughly 1s per test, R 2.7.0 @ 2.6GHz Mac Pro
# R Benchmark 2.4 (06/2008) [Simon Urbanek] # R Benchmark 2.4 (06/2008) [Simon Urbanek]
@ -27,14 +26,18 @@ library(methods) # for Rscript
# by Stephan Steinhaus (stst@informatik.uni-frankfurt.de) # by Stephan Steinhaus (stst@informatik.uni-frankfurt.de)
# Reference for Escoufier's equivalents vectors (test III.5): # Reference for Escoufier's equivalents vectors (test III.5):
# Escoufier Y., 1970. Echantillonnage dans une population de variables # Escoufier Y., 1970. Echantillonnage dans une population de variables
# aleatoires réelles. Publ. Inst. Statis. Univ. Paris 19 Fasc 4, 1-47. # aleatoires r?elles. Publ. Inst. Statis. Univ. Paris 19 Fasc 4, 1-47.
# #
# type source("c:/<dir>/R2.R") to start the test # type source("c:/<dir>/R2.R") to start the test
runs <- 3 # Number of times the tests are executed library(methods) # for Rscript
set.seed(1)
results = data.frame(name=character(), time=numeric())
runs <- 10 # Number of times the tests are executed
times <- rep(0, 15); dim(times) <- c(5,3) times <- rep(0, 15); dim(times) <- c(5,3)
require(Matrix) # Optimized matrix operations library(Matrix) # Optimized matrix operations
require(SuppDists) # Optimized random number generators library(SuppDists) # Optimized random number generators
#Runif <- rMWC1019 # The fast uniform number generator #Runif <- rMWC1019 # The fast uniform number generator
Runif <- runif Runif <- runif
# If you don't have SuppDists, you can use: Runif <- runif # If you don't have SuppDists, you can use: Runif <- runif
@ -43,10 +46,10 @@ Runif <- runif
# If you don't have SuppDists, you can use: Rnorm <- rnorm # If you don't have SuppDists, you can use: Rnorm <- rnorm
#b <- rziggurat(10, new.start=TRUE) # Init. the generator #b <- rziggurat(10, new.start=TRUE) # Init. the generator
Rnorm <- rnorm Rnorm <- rnorm
remove("a", "b")
options(object.size=100000000) options(object.size=100000000)
cat("\n\n R Benchmark 2.5\n") cat("\n\n R Benchmark 2.5.1\n")
cat(" ===============\n") cat(" ===============\n")
cat(c("Number of times each test is run__________________________: ", runs)) cat(c("Number of times each test is run__________________________: ", runs))
cat("\n\n") cat("\n\n")
@ -71,6 +74,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[1, 1] <- timing times[1, 1] <- timing
cat(c("Creation, transp., deformation of a 2500x2500 matrix (sec): ", timing, "\n")) cat(c("Creation, transp., deformation of a 2500x2500 matrix (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Creation, transp., deformation of a 2500x2500 matrix", time=as.numeric(timing)))
remove("a", "b") remove("a", "b")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -87,6 +91,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[2, 1] <- timing times[2, 1] <- timing
cat(c("2400x2400 normal distributed random matrix ^1000____ (sec): ", timing, "\n")) cat(c("2400x2400 normal distributed random matrix ^1000____ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="2400x2400 normal distributed random matrix ^1000", time=as.numeric(timing)))
remove("a", "b") remove("a", "b")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -104,6 +109,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[3, 1] <- timing times[3, 1] <- timing
cat(c("Sorting of 7,000,000 random values__________________ (sec): ", timing, "\n")) cat(c("Sorting of 7,000,000 random values__________________ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Sorting of 7,000,000 random values", time=as.numeric(timing)))
remove("a", "b") remove("a", "b")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -120,6 +126,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[4, 1] <- timing times[4, 1] <- timing
cat(c("2800x2800 cross-product matrix (b = a' * a)_________ (sec): ", timing, "\n")) cat(c("2800x2800 cross-product matrix (b = a' * a)_________ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="2800x2800 cross-product matrix (b = a' * a)", time=as.numeric(timing)))
remove("a", "b") remove("a", "b")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -148,6 +155,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[5, 1] <- timing times[5, 1] <- timing
cat(c("Linear regr. over a 3000x3000 matrix (c = a \\ b')___ (sec): ", timing, "\n")) cat(c("Linear regr. over a 3000x3000 matrix (c = a \\ b')___ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Linear regr. over a 3000x3000 matrix (c = a \ b')", time=as.numeric(timing)))
remove("a", "b", "c", "qra") remove("a", "b", "c", "qra")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -172,6 +180,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[1, 2] <- timing times[1, 2] <- timing
cat(c("FFT over 2,400,000 random values____________________ (sec): ", timing, "\n")) cat(c("FFT over 2,400,000 random values____________________ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="FFT over 2,400,000 random value", time=as.numeric(timing)))
remove("a", "b") remove("a", "b")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -193,6 +202,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[2, 2] <- timing times[2, 2] <- timing
cat(c("Eigenvalues of a 640x640 random matrix______________ (sec): ", timing, "\n")) cat(c("Eigenvalues of a 640x640 random matrix______________ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Eigenvalues of a 640x640 random matrix", time=as.numeric(timing)))
remove("a", "b") remove("a", "b")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -213,6 +223,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[3, 2] <- timing times[3, 2] <- timing
cat(c("Determinant of a 2500x2500 random matrix____________ (sec): ", timing, "\n")) cat(c("Determinant of a 2500x2500 random matrix____________ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Determinant of a 2500x2500 random matrix", time=as.numeric(timing)))
remove("a", "b") remove("a", "b")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -232,6 +243,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[4, 2] <- timing times[4, 2] <- timing
cat(c("Cholesky decomposition of a 3000x3000 matrix________ (sec): ", timing, "\n")) cat(c("Cholesky decomposition of a 3000x3000 matrix________ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Cholesky decomposition of a 3000x3000 matrix", time=as.numeric(timing)))
remove("a", "b") remove("a", "b")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -251,6 +263,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[5, 2] <- timing times[5, 2] <- timing
cat(c("Inverse of a 1600x1600 random matrix________________ (sec): ", timing, "\n")) cat(c("Inverse of a 1600x1600 random matrix________________ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Inverse of a 1600x1600 random matrix", time=as.numeric(timing)))
remove("a", "b") remove("a", "b")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -275,6 +288,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[1, 3] <- timing times[1, 3] <- timing
cat(c("3,500,000 Fibonacci numbers calculation (vector calc)(sec): ", timing, "\n")) cat(c("3,500,000 Fibonacci numbers calculation (vector calc)(sec): ", timing, "\n"))
results = rbind(results, data.frame(name="3,500,000 Fibonacci numbers calculation (vector calc)", time=as.numeric(timing)))
remove("a", "b", "phi") remove("a", "b", "phi")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -293,6 +307,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[2, 3] <- timing times[2, 3] <- timing
cat(c("Creation of a 3000x3000 Hilbert matrix (matrix calc) (sec): ", timing, "\n")) cat(c("Creation of a 3000x3000 Hilbert matrix (matrix calc) (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Creation of a 3000x3000 Hilbert matrix (matrix calc)", time=as.numeric(timing)))
remove("a", "b") remove("a", "b")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -311,6 +326,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[3, 3] <- timing times[3, 3] <- timing
cat(c("Grand common divisors of 400,000 pairs (recursion)__ (sec): ", timing, "\n")) cat(c("Grand common divisors of 400,000 pairs (recursion)__ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Grand common divisors of 400,000 pairs (recursion)", time=as.numeric(timing)))
remove("a", "b", "c", "gcd2") remove("a", "b", "c", "gcd2")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -333,6 +349,7 @@ for (i in 1:runs) {
timing <- cumulate/runs timing <- cumulate/runs
times[4, 3] <- timing times[4, 3] <- timing
cat(c("Creation of a 500x500 Toeplitz matrix (loops)_______ (sec): ", timing, "\n")) cat(c("Creation of a 500x500 Toeplitz matrix (loops)_______ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Creation of a 500x500 Toeplitz matrix (loops)", time=as.numeric(timing)))
remove("b", "j", "k") remove("b", "j", "k")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -375,6 +392,7 @@ for (i in 1:runs) {
} }
times[5, 3] <- timing times[5, 3] <- timing
cat(c("Escoufier's method on a 45x45 matrix (mixed)________ (sec): ", timing, "\n")) cat(c("Escoufier's method on a 45x45 matrix (mixed)________ (sec): ", timing, "\n"))
results = rbind(results, data.frame(name="Escoufier's method on a 45x45 matrix (mixed)", time=as.numeric(timing)))
remove("x", "p", "vt", "vr", "vrt", "rvt", "RV", "j", "k") remove("x", "p", "vt", "vr", "vrt", "rvt", "RV", "j", "k")
remove("x2", "R", "Rxx", "Ryy", "Rxy", "Ryx", "Rvmax", "Trace") remove("x2", "R", "Rxx", "Ryy", "Rxy", "Ryx", "Rvmax", "Trace")
if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console() if (R.Version()$os == "Win32" || R.Version()$os == "mingw32") flush.console()
@ -385,5 +403,9 @@ cat(c(" Trimmed geom. mean (2 extremes eliminated): ", exp(mean(l
cat(c("Total time for all 15 tests_________________________ (sec): ", sum(times), "\n")) cat(c("Total time for all 15 tests_________________________ (sec): ", sum(times), "\n"))
cat(c("Overall mean (sum of I, II and III trimmed means/3)_ (sec): ", exp(mean(log(times[2:4, ]))), "\n")) cat(c("Overall mean (sum of I, II and III trimmed means/3)_ (sec): ", exp(mean(log(times[2:4, ]))), "\n"))
attr(results, "runs") = runs
saveRDS(results, paste0("test-urbanek-", ifelse(exists("blasLibName"), blasLibName, ""), ".rds"))
remove("cumulate", "timing", "times", "runs", "i") remove("cumulate", "timing", "times", "runs", "i")
cat(" --- End of test ---\n\n") cat(" --- End of test ---\n\n")

View File

@ -13,7 +13,7 @@ function configure_hosts {
echo -n "${host} ... " echo -n "${host} ... "
echo -n "config-push " echo -n "config-push "
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} slave-cmds.sh cpuinfo sample-benchmark.R R-benchmark-25.R revolution-benchmark.R root@${host}:/root scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} slave-cmds.sh cpuinfo benchmark-sample.R benchmark-urbanek.R benchmark-revolution.R root@${host}:/root
ret=$? ret=$?
if [ $ret -ne 0 ] ; then if [ $ret -ne 0 ] ; then
echo "error $ret"; continue echo "error $ret"; continue
@ -29,6 +29,7 @@ function configure_hosts {
echo "config-run " echo "config-run "
{ ssh ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host} 'bash slave-cmds.sh mro_install netlib_install atlas_st_install openblas_install atlas_mt_install gotoblas2_install mkl_install blis_install cublas_install > install.log 2>&1' ; { ssh ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host} 'bash slave-cmds.sh mro_install netlib_install atlas_st_install openblas_install atlas_mt_install gotoblas2_install mkl_install blis_install cublas_install > install.log 2>&1' ;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/install.log install-${host}.log; scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/install.log install-${host}.log;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/host-info.log host-info-${host}.log;
echo "${host} finished" ; } & echo "${host} finished" ; } &
done done
@ -59,6 +60,15 @@ function benchmark {
echo "benchmark-run " echo "benchmark-run "
{ ssh ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host} "bash slave-cmds.sh test_${BENCHMARK_TEST} netlib_check atlas_st_check openblas_check atlas_mt_check gotoblas2_check mkl_check blis_check cublas_check > test-${BENCHMARK_TEST}.log 2>&1" ; { ssh ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host} "bash slave-cmds.sh test_${BENCHMARK_TEST} netlib_check atlas_st_check openblas_check atlas_mt_check gotoblas2_check mkl_check blis_check cublas_check > test-${BENCHMARK_TEST}.log 2>&1" ;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/test-${BENCHMARK_TEST}.log test-${BENCHMARK_TEST}-${host}.log; scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/test-${BENCHMARK_TEST}.log test-${BENCHMARK_TEST}-${host}.log;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/test-${BENCHMARK_TEST}-netlib.rds test-${BENCHMARK_TEST}-${host}-netlib.rds;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/test-${BENCHMARK_TEST}-atlas_st.rds test-${BENCHMARK_TEST}-${host}-atlas_st.rds;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/test-${BENCHMARK_TEST}-openblas.rds test-${BENCHMARK_TEST}-${host}-openblas.rds;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/test-${BENCHMARK_TEST}-atlas_mt.rds test-${BENCHMARK_TEST}-${host}-atlas_mt.rds;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/test-${BENCHMARK_TEST}-gotoblas2.rds test-${BENCHMARK_TEST}-${host}-gotoblas2.rds;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/test-${BENCHMARK_TEST}-mkl.rds test-${BENCHMARK_TEST}-${host}-mkl.rds;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/test-${BENCHMARK_TEST}-blis.rds test-${BENCHMARK_TEST}-${host}-blis.rds;
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host}:/root/test-${BENCHMARK_TEST}-cublas.rds test-${BENCHMARK_TEST}-${host}-cublas.rds 2> /dev/null;
echo "${host} finished" ; } & echo "${host} finished" ; } &
done done

View File

@ -1,34 +0,0 @@
# source: https://gist.github.com/andrie/24c9672f1ea39af89c66#file-rro-mkl-benchmark-r
# Initialization
set.seed (1)
m <- 10000
n <- 5000
A <- matrix (runif (m*n),m,n)
# Matrix multiply
system.time (B <- crossprod(A))
# Cholesky Factorization
system.time (C <- chol(B))
# Singular Value Deomposition
m <- 10000
n <- 2000
A <- matrix (runif (m*n),m,n)
system.time (S <- svd (A,nu=0,nv=0))
# Principal Components Analysis
m <- 10000
n <- 2000
A <- matrix (runif (m*n),m,n)
system.time (P <- prcomp(A))
# Linear Discriminant Analysis
library('MASS')
g <- 5
k <- round (m/2)
A <- data.frame (A, fac=sample (LETTERS[1:g],m,replace=TRUE))
train <- sample(1:m, k)
system.time (L <- lda(fac ~., data=A, prior=rep(1,g)/g, subset=train))

View File

@ -3,7 +3,7 @@
WGET_OPTIONS="--no-check-certificate" WGET_OPTIONS="--no-check-certificate"
MRO_VERSION="3.2.4" MRO_VERSION="3.2.4"
CHECKPOINT_DATE="2016-04-01" CHECKPOINT_DATE="2016-04-01"
R_BENCHMARK_SCRIPT="sample-benchmark.R" R_BENCHMARK_SCRIPT="benchmark-sample.R"
DIR_BLAS="/opt/blas-libs" DIR_BLAS="/opt/blas-libs"
if [ ! -f ./cpuinfo ]; then if [ ! -f ./cpuinfo ]; then
@ -20,6 +20,11 @@ function mro_install {
echo "Started installing Microsoft R Open and dependencies" echo "Started installing Microsoft R Open and dependencies"
# save host info
./cpuinfo -g | grep -oP 'Processor name( +):( +)\K(.+)' > host-info.log
cat /proc/meminfo | grep -oP 'MemTotal:( +)\K(\d+)' >> host-info.log
lspci -nn | grep -oP "VGA.*\KNVIDIA.*?]" >> host-info.log
# update debian repos & upgrade packages # update debian repos & upgrade packages
echo "deb http://snapshot.debian.org/archive/debian/20160411T102554Z/ jessie-backports main" >> /etc/apt/sources.list echo "deb http://snapshot.debian.org/archive/debian/20160411T102554Z/ jessie-backports main" >> /etc/apt/sources.list
apt-get -o Acquire::Check-Valid-Until=false update apt-get -o Acquire::Check-Valid-Until=false update
@ -47,9 +52,9 @@ function mro_install {
# prepare R checkpoint # prepare R checkpoint
mkdir ~/.checkpoint mkdir ~/.checkpoint
Rscript -e "library(checkpoint); checkpoint('${CHECKPOINT_DATE}')" Rscript -e "library(checkpoint); checkpoint('${CHECKPOINT_DATE}')"
sed -i "1i\library(checkpoint); checkpoint('${CHECKPOINT_DATE}', scanForPackages=FALSE, verbose=FALSE)" sample-benchmark.R sed -i "1i\library(checkpoint); checkpoint('${CHECKPOINT_DATE}', scanForPackages=FALSE, verbose=FALSE)" benchmark-sample.R
sed -i "1i\library(checkpoint); checkpoint('${CHECKPOINT_DATE}', scanForPackages=FALSE, verbose=FALSE)" revolution-benchmark.R sed -i "1i\library(checkpoint); checkpoint('${CHECKPOINT_DATE}', scanForPackages=FALSE, verbose=FALSE)" benchmark-urbanek.R
sed -i "1i\library(checkpoint); checkpoint('${CHECKPOINT_DATE}', scanForPackages=FALSE, verbose=FALSE)" R-benchmark-25.R sed -i "1i\library(checkpoint); checkpoint('${CHECKPOINT_DATE}', scanForPackages=FALSE, verbose=FALSE)" benchmark-revolution.R
# make directory for BLAS and LAPACK libraries # make directory for BLAS and LAPACK libraries
mkdir -p ${DIR_BLAS} mkdir -p ${DIR_BLAS}
@ -107,9 +112,9 @@ function netlib_remove {
function netlib_check { function netlib_check {
echo "Started checking netlib." echo "Started checking netlib"
LD_PRELOAD="${DIR_NETLIB}/libblas.so.3.0 ${DIR_NETLIB}/liblapack.so.3.0" Rscript ${R_BENCHMARK_SCRIPT} LD_PRELOAD="${DIR_NETLIB}/libblas.so.3.0 ${DIR_NETLIB}/liblapack.so.3.0" Rscript -e "blasLibName='netlib'; source('${R_BENCHMARK_SCRIPT}')"
echo "Finished checking netlib" echo "Finished checking netlib"
} }
@ -149,7 +154,7 @@ function atlas_st_check {
echo "Started checking ATLAS (single-threaded)" echo "Started checking ATLAS (single-threaded)"
LD_PRELOAD="${DIR_ATLAS_ST}/libatlas.so.3 ${DIR_ATLAS_ST}/libblas.so.3 ${DIR_ATLAS_ST}/liblapack.so.3" Rscript ${R_BENCHMARK_SCRIPT} LD_PRELOAD="${DIR_ATLAS_ST}/libatlas.so.3 ${DIR_ATLAS_ST}/libblas.so.3 ${DIR_ATLAS_ST}/liblapack.so.3" Rscript -e "blasLibName='atlas_st'; source('${R_BENCHMARK_SCRIPT}')"
echo "Finished checking ATLAS (single-threaded)" echo "Finished checking ATLAS (single-threaded)"
} }
@ -198,7 +203,7 @@ function openblas_check {
echo "Started checking OpenBLAS" echo "Started checking OpenBLAS"
LD_PRELOAD="${DIR_OPENBLAS}/libopenblas.so.0 ${DIR_OPENBLAS}/libblas.so.3 ${DIR_OPENBLAS}/liblapack.so.3" Rscript ${R_BENCHMARK_SCRIPT} LD_PRELOAD="${DIR_OPENBLAS}/libopenblas.so.0 ${DIR_OPENBLAS}/libblas.so.3 ${DIR_OPENBLAS}/liblapack.so.3" Rscript -e "blasLibName='openblas'; source('${R_BENCHMARK_SCRIPT}')"
echo "Finished checking OpenBLAS" echo "Finished checking OpenBLAS"
} }
@ -257,7 +262,7 @@ function atlas_mt_check {
echo "Started checking ATLAS (multi-threaded)" echo "Started checking ATLAS (multi-threaded)"
LD_PRELOAD="${DIR_ATLAS_MT}/libtatlas.so" Rscript ${R_BENCHMARK_SCRIPT} LD_PRELOAD="${DIR_ATLAS_MT}/libtatlas.so" Rscript -e "blasLibName='atlas_mt'; source('${R_BENCHMARK_SCRIPT}')"
echo "Finished checking ATLAS (multi-threaded)" echo "Finished checking ATLAS (multi-threaded)"
} }
@ -313,13 +318,11 @@ function gotoblas2_check {
echo "${DIR_GOTOBLAS2}" > /etc/ld.so.conf.d/gotoblas2.conf echo "${DIR_GOTOBLAS2}" > /etc/ld.so.conf.d/gotoblas2.conf
ldconfig ldconfig
sed "2i\library(RhpcBLASctl); blas_set_num_threads(${NPROC})" ${R_BENCHMARK_SCRIPT} > benchmark-gotoblas2.R
LD_PRELOAD="${DIR_GOTOBLAS2}/libgoto2blas.so ${DIR_GOTOBLAS2}/libgoto2lapack.so" GOTO_NUM_THREADS=${NPROC} Rscript benchmark-gotoblas2.R LD_PRELOAD="${DIR_GOTOBLAS2}/libgoto2blas.so ${DIR_GOTOBLAS2}/libgoto2lapack.so" GOTO_NUM_THREADS=${NPROC} Rscript -e "blasLibName='gotoblas2'; library(checkpoint); checkpoint('${CHECKPOINT_DATE}', scanForPackages=FALSE, verbose=FALSE); library(RhpcBLASctl); blas_set_num_threads(${NPROC}); source('${R_BENCHMARK_SCRIPT}')"
rm /etc/ld.so.conf.d/gotoblas2.conf rm /etc/ld.so.conf.d/gotoblas2.conf
ldconfig ldconfig
rm benchmark-gotoblas2.R
echo "Finished checking GotoBLAS2" echo "Finished checking GotoBLAS2"
} }
@ -366,7 +369,7 @@ function mkl_check {
echo "Started checking MKL" echo "Started checking MKL"
LD_PRELOAD="${DIR_MKL}/libRblas.so ${DIR_MKL}/libRlapack.so ${DIR_MKL}/libmkl_vml_mc3.so ${DIR_MKL}/libmkl_vml_def.so ${DIR_MKL}/libmkl_gnu_thread.so ${DIR_MKL}/libmkl_core.so ${DIR_MKL}/libmkl_gf_lp64.so ${DIR_MKL}/libiomp5.so ${DIR_MKL}/libmkl_gf_ilp64.so" MKL_INTERFACE_LAYER="GNU,LP64" MKL_THREADING_LAYER="GNU" Rscript ${R_BENCHMARK_SCRIPT} LD_PRELOAD="${DIR_MKL}/libRblas.so ${DIR_MKL}/libRlapack.so ${DIR_MKL}/libmkl_vml_mc3.so ${DIR_MKL}/libmkl_vml_def.so ${DIR_MKL}/libmkl_gnu_thread.so ${DIR_MKL}/libmkl_core.so ${DIR_MKL}/libmkl_gf_lp64.so ${DIR_MKL}/libiomp5.so ${DIR_MKL}/libmkl_gf_ilp64.so" MKL_INTERFACE_LAYER="GNU,LP64" MKL_THREADING_LAYER="GNU" Rscript -e "blasLibName='mkl'; source('${R_BENCHMARK_SCRIPT}')"
echo "Finished checking MKL" echo "Finished checking MKL"
} }
@ -482,7 +485,7 @@ function blis_check {
((PARALLEL_STEPS--)) ((PARALLEL_STEPS--))
done done
LD_PRELOAD="${DIR_BLIS}/libblis.so" BLIS_JC_NT=${COUNT_JC} BLIS_IC_NT=${COUNT_IC} BLIS_JR_NT=${COUNT_JR} BLIS_IR_NT=${COUNT_IR} Rscript ${R_BENCHMARK_SCRIPT} LD_PRELOAD="${DIR_BLIS}/libblis.so" BLIS_JC_NT=${COUNT_JC} BLIS_IC_NT=${COUNT_IC} BLIS_JR_NT=${COUNT_JR} BLIS_IR_NT=${COUNT_IR} Rscript -e "blasLibName='blis'; source('${R_BENCHMARK_SCRIPT}')"
echo "Finished checking BLIS" echo "Finished checking BLIS"
} }
@ -598,7 +601,7 @@ function cublas_check {
echo "Started checking cuBLAS" echo "Started checking cuBLAS"
NVBLAS_CONFIG_FILE="${DIR_CUBLAS}/nvblas.conf" LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libnvblas.so.6.5 /usr/lib/x86_64-linux-gnu/libcublas.so.6.5" Rscript ${R_BENCHMARK_SCRIPT} NVBLAS_CONFIG_FILE="${DIR_CUBLAS}/nvblas.conf" LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libnvblas.so.6.5 /usr/lib/x86_64-linux-gnu/libcublas.so.6.5" Rscript -e "blasLibName='cublas'; source('${R_BENCHMARK_SCRIPT}')"
echo "Finished checking cuBLAS" echo "Finished checking cuBLAS"
} }
@ -620,13 +623,13 @@ else
NPROC=${PROCESSOR_CPUS} NPROC=${PROCESSOR_CPUS}
;; ;;
test_sample) test_sample)
R_BENCHMARK_SCRIPT="sample-benchmark.R" R_BENCHMARK_SCRIPT="benchmark-sample.R"
;; ;;
test_urbanek) test_urbanek)
R_BENCHMARK_SCRIPT="R-benchmark-25.R" R_BENCHMARK_SCRIPT="benchmark-urbanek.R"
;; ;;
test_revolution) test_revolution)
R_BENCHMARK_SCRIPT="revolution-benchmark.R" R_BENCHMARK_SCRIPT="benchmark-revolution.R"
;; ;;
*) *)
$i $i