Skip to content

Instantly share code, notes, and snippets.

@revodavid
Forked from andrie/run-urbanek-benchmark-25.R
Created November 19, 2014 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save revodavid/1821f38ee98dd4ab3eae to your computer and use it in GitHub Desktop.
Save revodavid/1821f38ee98dd4ab3eae to your computer and use it in GitHub Desktop.
# Run Simon Urbanek's benchmark v2.5
cat("R version\n")
cat("=========\n")
print(R.version)
if(exists("Revo.version")) {
cat("Revo version")
cat("============")
print(Revo.version)
}
totalTestTime <- system.time({
source(url("http://r.research.att.com/benchmarks/R-benchmark-25.R"))
})
cat("Total test time:", totalTestTime[[3]], "seconds")
## Nick's benchmark script
library(Revobase)
runMKLBenchmarks<-function()
{
cat("MKL Threads being used: ", getMKLthreads(), "\n")
cat("Matrix Multiply\n")
set.seed (1)
m <- 10000
n <- 5000
A <- matrix (runif (m*n),m,n)
print(system.time (B <- crossprod(A)))
cat("Cholesky Factorization\n")
print(system.time (C <- chol(B)))
cat("Singular Value Deomposition\n")
m <- 10000
n <- 2000
A <- matrix (runif (m*n),m,n)
print(system.time (S <- svd (A,nu=0,nv=0)) )
cat("Principal Components Analysis\n")
m <- 10000
n <- 2000
A <- matrix (runif (m*n),m,n)
print(system.time (P <- prcomp(A)) )
cat("Linear Discriminant Analysis\n")
require ('MASS')
g <- 5
k <- round (m/2)
A <- data.frame (A, fac=sample (LETTERS[1:g],m,replace=TRUE))
train <- sample(1:m, k)
print(system.time (L <- lda(fac ~., data=A, prior=rep(1,g)/g, subset=train)))
}
getMKLthreads()
runMKLBenchmarks()
setMKLthreads(1)
runMKLBenchmarks()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment