1
0
mirror of https://github.com/andre-wojtowicz/blas-benchmarks synced 2024-12-22 06:00:29 +01:00

added gcbd benchmark;

added power-off option
This commit is contained in:
Andrzej Wójtowicz 2016-05-20 12:54:32 +02:00
parent eb01728fb6
commit 26712e11ab
3 changed files with 110 additions and 1 deletions

81
benchmark-gcbd.R Normal file
View File

@ -0,0 +1,81 @@
# source: CRAN gcbd package
size = c(100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1250, 1500, 1750, 2000, 2500, 3000, 3500, 4000, 4500, 5000)
runs = c( 50, 50, 50, 50, 50, 50, 50, 50, 50, 30, 30, 30, 30, 20, 20, 5, 5, 5, 5, 5)
meanTrim = 0.1
results = data.frame(t1=numeric(), t2=numeric(), t3=numeric(), t4=numeric())
library(Matrix)
# functions
getMatrix <- function(N) {
a <- rnorm(N*N)
dim(a) <- c(N,N)
invisible(gc())
invisible(a)
}
matmultBenchmark <- function(N, n, trim=0.1) {
a <- getMatrix(N)
traw <- replicate(n, system.time(crossprod(a))[3])
tmean <- mean(traw,trim=trim)
}
qrBenchmark <- function(N, n, trim=0.1) {
a <- getMatrix(N)
traw <- replicate(n, system.time(qr(a, LAPACK=TRUE))[3])
tmean <- mean(traw,trim=trim)
}
svdBenchmark <- function(N, n, trim=0.1) {
a <- getMatrix(N)
traw <- replicate(n, system.time(svd(a))[3])
tmean <- mean(traw,trim=trim)
}
luBenchmark <- function(N, n, trim=0.1) {
a <- getMatrix(N)
traw <- replicate(n, system.time(lu(a))[3])
tmean <- mean(traw,trim=trim)
}
# Initialization
set.seed (1)
cat(paste0("Mean trim : ", meanTrim, "\n"))
for (i in 1:length(size))
{
n = size[i]
r = runs[i]
cat(paste0("Size : ", n, "\n"))
cat(paste0("Runs : ", r, "\n"))
t1 = matmultBenchmark(n, r, meanTrim)
cat(paste0("Matrix Multiply : ", t1, "\n"))
t2 = qrBenchmark(n, r, meanTrim)
cat(paste0("QR Decomposition : ", t2, "\n"))
t3 = svdBenchmark(n, r, meanTrim)
cat(paste0("Singular Value Deomposition : ", t3, "\n"))
t4 = luBenchmark(n, r, meanTrim)
cat(paste0("Triangular Decomposition : ", t4, "\n"))
results = rbind(results, data.frame(t1=t1, t2=t2, t3=t3, t4=t4))
}
colnames(results) = c("Matrix Multiply", "QR Decomposition",
"Singular Value Deomposition", "Triangular Decomposition")
attr(results, "size") = size
attr(results, "runs") = runs
attr(results, "meanTrim") = meanTrim
saveRDS(results, paste0("test-gcbd-", ifelse(exists("blasLibName"), blasLibName, ""), ".rds"))

View File

@ -13,7 +13,7 @@ function configure_hosts {
echo -n "${host} ... "
echo -n "config-push "
scp ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} slave-cmds.sh cpuinfo benchmark-sample.R benchmark-urbanek.R benchmark-revolution.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 benchmark-gcbd.R root@${host}:/root
ret=$?
if [ $ret -ne 0 ] ; then
echo "error $ret"; continue
@ -49,6 +49,23 @@ function configure_hosts {
}
function power_off {
echo "* Power-off hosts:"
for host in `cat hosts-list.txt`
do
echo -n "${host} ... "
echo "power off "
ssh ${SSH_OPTIONS} -i ssh/${SSH_KEY_PRIV} root@${host} 'poweroff'
done
echo "* Done"
}
function benchmark {
echo "* Benchmark: ${BENCHMARK_TEST}"
@ -99,6 +116,9 @@ else
configure_hosts)
configure_hosts
;;
power_off)
power_off
;;
test_sample)
BENCHMARK_TEST="sample"
benchmark
@ -111,6 +131,10 @@ else
BENCHMARK_TEST="revolution"
benchmark
;;
test_gcbd)
BENCHMARK_TEST="gcbd"
benchmark
;;
*)
echo "unknown command"
esac

View File

@ -55,6 +55,7 @@ function mro_install {
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)" benchmark-urbanek.R
sed -i "1i\library(checkpoint); checkpoint('${CHECKPOINT_DATE}', scanForPackages=FALSE, verbose=FALSE)" benchmark-revolution.R
sed -i "1i\library(checkpoint); checkpoint('${CHECKPOINT_DATE}', scanForPackages=FALSE, verbose=FALSE)" benchmark-gcbd.R
# make directory for BLAS and LAPACK libraries
mkdir -p ${DIR_BLAS}
@ -631,6 +632,9 @@ else
test_revolution)
R_BENCHMARK_SCRIPT="benchmark-revolution.R"
;;
test_gcbd)
R_BENCHMARK_SCRIPT="benchmark-gcbd.R"
;;
*)
$i
esac