search for: registerdosmp

Displaying 4 results from an estimated 4 matches for "registerdosmp".

Did you mean: registerdomc
2010 Nov 10
2
Parallel code runs slower!
...require(TTR) system.time( for (i in 1:nCols) { x = t[,i] xROC = ROC(x) tTA[,i]=xROC } ) user system elapsed 123.24 0.07 123.47 # PARALLEL CODE nCols=ncol(t) nRows=nrow(t) tTA = matrix(nrow=nRows,ncol=nCols) require(doSMP) workers <- startWorkers(4) # My computer has 4 cores registerDoSMP(workers) system.time( foreach (i=1:nCols) %dopar%{ x = t[,i] xROC = ROC(x) tTA[,i]=xROC } ) # stop workers stopWorkers(workers) It is taking ages! Thanks, S
2011 Jun 28
1
parallel computing with 'foreach'
...rary(survival) # Create the simplest test data set test1 <- list(time=c(4,3,1,1,2,2,3), status=c(1,1,1,0,1,1,0), x=c(0,2,1,1,1,0,0), sex=c(0,0,0,0,1,1,1)) # Fit a stratified model coxph(Surv(time, status) ~ x + strata(sex), test1) w <- startWorkers() registerDoSMP(w) foreach(i=1:3) %dopar% { # Fit a stratified model fit<-coxph(Surv(time, status) ~ x + strata(sex), test1) summary(fit)$coef[i] } stopWorkers(w) ####Error message: Error in { : task 1 failed - "could not find function "coxph"" If I call library(survival) inside the foreac...
2011 May 27
0
saving multiple arrays from a foreach loop
...ays "x" and "y"; stop time system.time(for(j in 1:n.run) { z = check(j) x[,, j] <- z$sme y[,, j] <- z$test }) #### trying to do the same with a foreach loop - does not work!! require(doSMP) workers <- startWorkers(2) # My computer has 2 cores registerDoSMP(workers) notcreative = array(NA,dim=c(4,n.vpn,n.l?ufe)) tempList = list(matrix(NA,4,n.vpn),matrix(NA,4,n.vpn)) system.time(notcreative <- foreach(j=1:n.run) %dopar% { tempList=check(j) x[,,j] = tempList$sme y[,,j] = tempList$test }) stopWorkers(workers) -- __________...
2011 Apr 19
0
doSMP package works better than perfect, at least sometimes.
...closed-source addon to R, but it's clear that their releases of packages like doSMP and foreach are important contributions to the community. ###### Toy test code follows:###### # Toy SMP memory.limit(3000) require(doSMP) require(reshape2) getDoParWorkers() w<- startWorkers(workerCount=3) registerDoSMP(w) timeSMP <- function(g, n) # g = number of groups to process # n = size of each group. { for(rep in 1:3) { times <- NULL dd <- data.frame(k=rep(1:g, n), x=runif(g*n)) ddSplit <- split(dd, dd$k) tt<-system.time({ dd2 <- foreach(e=names(ddSplit),...