search for: dopar

Displaying 20 results from an estimated 85 matches for "dopar".

Did you mean: opar
2010 Apr 29
2
dopar parallel assignments
Hi guys, I was wondering why this piece of code doesn't work: foreach (i = c(1.25,1.50)) %dopar% { assign(paste("test_",i,sep=""),i) } but, this does: foreach (i = c(1.25,1.50)) %do% { assign(paste("test_",i,sep=""),i) } Obviously, the difference is %dopar% vs. %do%. If I use %do%, I get objects test_1.25 and test_1.50, but I don't get these obje...
2015 May 11
1
Foreach %dopar% operator incorrectly load balancing
Dear R-SIG-Debian, I am using R version 3.1.2 with rstudio-server 0.98.113 on debian build 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u1 x86_64 GNU/Linux. I often use the %dopar% operator in from the foreach package to run code in parallel. However, the only other use on the box seemingly installed a few items and suddenly %dopar% will use far more than the number of cores I am specifying and seems to load balance between all of them. The issue with this is that it doesn...
2012 Feb 18
3
foreach %do% and %dopar%
Hi everyone, I'm working on a script trying to use foreach %dopar% but without success, so I manage to run the code with foreach %do% and looks like this: The code is part of a MCMC model for projects valuation, returning the most important results (VPN, TIR, EVA, etc.) of the simulation. foreach (simx = NsimT, .combine=cbind, .inorder=FALSE, .verbose=TRUE) %do...
2011 May 27
0
object not found with %dopar% when using foreach
Dear R-List member, tried implement the foreach loop. It works fine, when I'm using %do%, but not when I'm using %dopar%. I always receive one of the following error messages: error in { : task 1 failed - "Objekt 'S3' not found" - could the .export be an solution for this?? Any help is much appreciated! The Code hast the following structure: ########## dft3 = function (...) { ... } optDFT...
2011 Jul 12
2
foreach not recognizing functions in memory
...testFun". Can anyone provide a fix? I hope its just a simple mistake on my part and not a limitation of foreach. > source(.trPaths[5], echo=TRUE, max.deparse.length=150) > "testFun" <- function(m) { + out <- m*m + } > out <- foreach(m=1:10, .combine=rbind) %dopar% testFun(m) > "helper" <- function(i) { + + out <- foreach(m=1:i, .combine=rbind) %dopar% testFun(m) + } > out <- helper(10) Error in testFun(m) : task 1 failed - "could not find function "testFun"" > Thanks, Roger **********************...
2018 Mar 12
0
Package gamlss used inside foreach() and %dopar% fails to find an object
...quest at r-project.org You can reach the person managing the list at r-help-owner at r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of R-help digest..." Today's Topics: 1. . Package gamlss used inside foreach() and %dopar% fails to find an object (Nik Tuzov) (Dimitrios Stasinopoulos) 2. error message from sqldf (Ding, Yuan Chun) 3. Re: error message from sqldf (=?iso-8859-1?Q?Jos=E9_Mar=EDa?= Mateos) ---------------------------------------------------------------------- Message: 1 Date: Sat, 10 M...
2015 Mar 05
3
Submit a package which use doParallel
Hi, I'm trying to submit my first package which depends on doParallel: Depends: R (>= 3.0), igraph, doParallel Running hadley devtools: devtools::check() and devtools::release() result in no problem (no ERROR nor NOTE on Linux, Mac and Windows). However, when in use the devtools::build_win() command, it results in the following note: * checking R code for...
2017 Jun 13
1
fedback from foreach
Hi useRs, I am running a foreach loop and hoped to get a small message when it hits a multiple of 1000, but it does not work. p <- foreach(i=1:10000, .combine='c') %dopar% { if(i%%1000==0) print(i) sqrt(i) } What is the proper way to do it. Thanks everybody. Stephen B [[alternative HTML version deleted]]
2018 Mar 10
0
. Package gamlss used inside foreach() and %dopar% fails to find an object (Nik Tuzov)
Dear Nik Try the following code loo_predict.mu <- function(model.obj, input.data) { yhat <- foreach(i = 1 : nrow(input.data), .packages="gamlss", .combine = rbind) %dopar% { updated.model.obj <- update(model.obj, data = input.data[-i, ]) predict(updated.model.obj, what = "mu", data = input.data[-i, ], newdata = input.data[i,], type = "response") } return(data.frame(result = yhat[, 1], row.names = NULL)) } par.run <-...
2018 Mar 09
0
Package gamlss used inside foreach() and %dopar% fails to find an object
...searched for similar issues, but haven't managed to figure >it out. This is on Windows 10 platform. > >Thanks in advance, >Nik > ># -------------------------------------------------------------- > >library('gamlss') >library('foreach') >library('doParallel') > >registerDoParallel(cores = 4) ># Generate data >set.seed(314) >sample.size <- 30 >input.processed.cut <- data.frame(TP = round(runif(sample.size) * 100), > > FP = round(runif(sample.size) * 100), >...
2018 Mar 09
2
Package gamlss used inside foreach() and %dopar% fails to find an object
...seems to work when %do% is used. I have searched for similar issues, but haven't managed to figure it out. This is on Windows 10 platform. Thanks in advance, Nik # -------------------------------------------------------------- library('gamlss') library('foreach') library('doParallel') registerDoParallel(cores = 4) # Generate data set.seed(314) sample.size <- 30 input.processed.cut <- data.frame(TP = round(runif(sample.size) * 100), FP = round(runif(sample.size) * 100), x = runif(sample.size))...
2011 Feb 08
3
Parallel processing question ...
...oreach are combined, but what if there is more than one variable within the loop? Below is a snippet (non-functioning) of code that I hope provides enough insight into what I am trying to do. The commented out lines are what I would be doing (successfully) if I wasn't trying to implement the %dopar% . The goal is to do statistics on the sequence of lambda vectors that were originally accumulated in the matrix lambdas using cbind. Thanks in advance for any suggestions, Dave ---------------snip update_N <- function(sets, indexes, lam) { n <- length(indexes)-1 # count of events...
2012 Jun 15
0
argument "x" is missing, with no default - Please help find argument x
...to 10 groups numberOfRows<-dim(ml.frame)[1] lengthOfDiv<-numberOfRows/nfolds shuffled<-sample(c(1:numberOfRows), numberOfRows, replace=F) rownumber<-split(shuffled, 1:nfolds) #combine mymean into my vec myvec<-foreach (i = 1:length(rownumber), .combine="rbind") %dopar% bottomloop(i, mtry = mtry, rownumber=rownumber, ntrees=ntrees, shuffled=shuffled) #print(myvec) return(myvec) } toploop <- function (ntrees=ntrees, ml.frame=ml.frame) { require(foreach) require(ggplot2) require(reshape) require(foreign) mtry = c(5:25) ddd<-foreach(mtry, .com...
2012 Sep 21
2
Parallel Programming
...g and I tried this library(doSNOW) library(foreach) testfunc<-function(x){ x<-x+1 x } noc<-2 cl <- makeCluster(do.call(rbind,rep(list("localhost"),noc)), type = "SOCK") registerDoSNOW(cl) clusterExport(cl=cl,c("testfunc.r")) testl<-foreach(pp=1:2) %dopar% { testfunc(pp) } And this works but if I try to enclose my commands inside a text file to be sourced it doesn't work noc<-2 testfunc<-function(x){ x<-x+1 x } cl <- makeCluster(do.call(rbind,rep(list("localhost"),noc)), type = "SOCK") registerDoSNOW(cl) cl...
2012 May 08
1
revolution foreach oddity
...rns the same numbers. The only way I can get revolution to give different numbers is using 1 instead of 8 in registerDoSNOW(makeCluster(8, type = "SOCK")) but that seems to defeat the point. library(foreach) library(doSNOW) registerDoSNOW(makeCluster(8, type = "SOCK")) getDoParWorkers() getDoParName() getDoParVersion() mySamples <- foreach (jj = 1:4, .combine=cbind) %dopar% { return(sample(1:10,10,replace=TRUE)) } mySamples ########## r 2.14.1 ########## > library(foreach) > library(doSNOW) > registerDoSNOW(makeCluster(8, type = "SOCK")) &...
2011 Jun 28
1
doMC - compiler - concatenate an expression vector into a single expression?
Hi, this post is about foreach operators, the compiler package and the last update of doMC that includes support for the compiler functionality. I am using a home-made %dopar%-like operator that adds some custom expression to be executed before the foreach loop expression itself (see sample code below). It used to work perfectly with doMC 1.2.1, but with the introduction of the compiler functionality, things do not work properly. The change in the doMC package consis...
2013 Apr 24
0
help with execution of 'embarrassingly parallel' problem using foreach, doParallel on a windows system
...cores I have available to me (e.g. eight cores, eight chunks). I spent much of the day today trying to wrap myself around an expedient way to do this on a windows system in R (seems like the 'best' way to do this on systems that support forking is much more settled), and picked foreach and doParallel based on the package documentation for foreach; I'm open to other suggestions. Having tried it out though, it doesn't seem to be doing anything to speed up the task - indeed, it takes more time! Also, compiling the functions results in the 'winner' in terms of the serial and (...
2017 Dec 07
2
parallel computing with foreach()
...p in separate folders. splist <- c("juoc", "juos", "jusc", "pico", "pifl", "pipo", "pire", "psme") covset <- c("PEN", "Thorn") foreach(i = 1:length(splist)) %:% foreach(j = 1:length(covset)) %dopar% { spname <- splist[i]; spname myTorP <- covset[j]; myTorP DataSpecies = data.frame(prsabs = rep(1, 10), lon = rep(30, 10), lat = rep(80, 10)) myResp = as.numeric(DataSpecies[,1]) myRespXY = DataSpecies[, c("lon", "lat")] # directory of a bunch of raster files specific t...
2009 Oct 08
3
foreach loop - rejection method
...bda[l-1]) p2<-cand2[l-1]^-1.5*exp(-y[l]^2/(2*cand2[l-1]))*exp(-((log(cand2[l-1])-mu_t_cand[l-1])^2)/2*sigmasq) ratio<-p2/(c[l-1]*q2) if (runif(1)< ratio) {break} } f2[l-1]<-min(p2,c[l-1]*q2) }} foreach(l=2:(n-1),.combine=c,.packages='MCMCpack',.options.nws=li st(chunkSize=250)) %dopar% test() even though i've created the array earlier called cand2 when i run this code i get the error object "cand2" not found. What I'm trying to do is the rejection method for my cand2. i need cand2 and f2 as vectors as output both of length l-2 in the correct order. if i do a...
2017 Aug 13
2
Paralelizar el cálculo de distancias
Buenas, Quiero ver si he paralelizado correctamente el proceso. Tengo dos dataframes, A y B y quiero calcular la distancia euclídea de todas las filas de A sobre todas las filas de B. Para ello he hecho lo siguiente #cargo las librerias library(foreach) library(doParallel) #establezco el numero de clusters, en mi caso 4, ya que el procesador tiene 4 nucleos cl<-makeCluster(4) registerDoParallel(cl) #Creo los dataframes A<-as.data.frame(matrix(rnorm(50,10,2),ncol=5,nrow=10)) B<-as.data.frame(matrix(rnorm(50,10,2),ncol=5,nrow=10)) #calculo las di...