Last active
October 26, 2015 13:56
-
-
Save andrie/1efde1d1e903350273f1 to your computer and use it in GitHub Desktop.
This code originated in the RRO mailing list at https://groups.google.com/forum/#!topic/rropen/MG98lXsFepo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(parallel) | |
set.seed(1) | |
m <- 10000 | |
n <- 2000 | |
A <- matrix(runif (m*n),m,n) | |
setMKLthreads(1) | |
system.time(S <- svd (A,nu=0,nv=0)) | |
# user system elapsed | |
# 7.282 0.133 7.431 | |
setMKLthreads(4) | |
system.time(S <- svd (A,nu=0,nv=0)) | |
# user system elapsed | |
# 16.584 0.347 5.377 | |
setMKLthreads(1) | |
system.time(mclapply(X=list(A, A, A, A), | |
FUN=svd, | |
nu=0, | |
nv=0, | |
mc.cores=4)) | |
# user system elapsed | |
# 852.845 35.167 19.691 | |
setMKLthreads(4) | |
system.time(mclapply(X=list(A, A, A, A), | |
FUN=svd, | |
nu=0, | |
nv=0, | |
mc.cores=1)) | |
# user system elapsed | |
# 66.333 1.245 21.573 | |
setMKLthreads(4) | |
system.time(mclapply(X=list(A, A, A, A), | |
FUN=svd, | |
nu=0, | |
nv=0, | |
mc.cores=4)) | |
# threads sleep; use 0% cpu and do not finish |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment