Questions tagged [doparallel]

R package that is a “parallel backend” for the foreach package. It provides a mechanism needed to execute foreach loops in parallel.

453 questions
0
votes
1 answer

Fetching data in parallel from mysql using R doParallel or foreach

I am trying to fetch data in parallel from MySQL database using R. Following code is fetching data one by one and working fine. But I want to speed up the process by sending multiple queries and save it into different variables. Later I will merge…
0
votes
2 answers

foreach in doParallel package

I have this code for creating a matrix out of some calculations using a function "cop.theta" in a for loop environment Mat.corr <- matrix(0,6,5,byrow=F) for (i in 1:6){ Mat.corr[i,]=cop.theta(index,EXPR,SURV=survp[,i]) } I wrote an R code using…
lin
  • 33
  • 5
0
votes
1 answer

R: parallelization with foreach

I am new to R. I've written this very simple script to highlight my problem. If I run this regular for loop testdata is updated on each iteration just as I want it. a = 5 b = 4 c = 3 testdata = matrix(nrow=100, ncol=5) for(j in…
Eddy
  • 135
  • 7
0
votes
1 answer

Parallel processing in R using 'doParallel' package

I have a loop that iterates from 2 to a specified value(i.e. ,columnCount). The value of i is crucial as all computation that takes place inside the loop is dependent on the value of i. Loop snippet: > x1=runif(900000,9999,90999) >…
steven
  • 644
  • 1
  • 11
  • 23
0
votes
1 answer

R: caret does not use the master node of the PSOCKcluster when using parallel backend

I am trying to get caret to train xgboost models over a grid of hyperparameters using a parallel backend. Here is some code that uses the Give Me Some Credit data to demonstrate setting up a parallel backend for caret's hyperparameter grid search.…
tchakravarty
  • 10,736
  • 12
  • 72
  • 116
0
votes
3 answers

Use of doParallel / doMC not only with foreach package

all official tutorials doParallel, doParallel-Vignette, doMC and doMC-Vignette I've found so far cover only how to use parallel-computation in combination with foreach. Is there a way to speed up "sequential"-code as well? Imagine it like splitting…
Boern
  • 7,233
  • 5
  • 55
  • 86
0
votes
0 answers

foreach-loop (R/doParallel package) fails with big number of iterations

I have the following R-code: library(doParallel) cl <- makeCluster(detectCores()-4, outfile = "") registerDoParallel(cl) calc <- function(i){ ... #returns a dataframe } system.time( res<- foreach( i = 1:106800, .verbose = TRUE) %dopar%…
Antje Janosch
  • 1,154
  • 5
  • 19
  • 37
0
votes
1 answer

R Parallel computing: select which objects to be distributed into cores

I have a question related to r-parallel computing. I am using something like: cl.tmp = makeCluster(10, type="SOCK") registerDoParallel(cl.tmp) AA <- foreach(i = 1:48, .inorder = TRUE, .combine = rbind, .verbose=TRUE) %dopar% { # A function that…
0
votes
0 answers

Error in function(i) : task 2 failed - "non-character argument" on R

What is Error in funcion_2(i) : task 2 failed - "non-character argument"??. I'm trying to create a list of list , extracting words from xml files named on "lista". cl <- makeCluster(mc) registerDoParallel(cl) list_of_list <- foreach(i=lista_xmls,…
Israel Rodriguez
  • 425
  • 1
  • 6
  • 24
0
votes
0 answers

Updated: Parallel computing using R result in "attempt to replicate an object of type 'closure'"

I have set up a Metropolis-Hastings algorithm, and now I am trying to run the algorithm using parallel computing. I have set up a single-chain function library(parallel) library(foreach) library(mvtnorm) library(doParallel) n<-100 mX <- 1:n vY <-…
Troels
  • 1
  • 1
0
votes
0 answers

Rolling regression in R with doParallel - performance problems

I'm doing a rolling regression analysis and wanted to improve execution speed using multiple cores of my PC. The code i tried looks like this: library(doParallel) y <- reg.data[,1][1:15000] x1 <- reg.data[,2][1:15000] x2 <-…
flipper
  • 531
  • 4
  • 13
0
votes
0 answers

parallel processing with function name as argument

The code below works fine when the function names are passed in for the non-parallel version OR if the function name is hard coded in the parallel version. What changes do I need to make so that I pass in the the function name(s) for the parallel…
ironv
  • 978
  • 10
  • 25
-1
votes
1 answer

r Are there any changes I can make to speed up my parallelized code that combines rasters, does some raster algebra and writes out the results

The code below is a parallel version of a some code I had written earlier. Both versions do what they are supposed to. Both versions take about 5.7 minutes to complete. Constructing a reproducible example would require me to make several tif files…
JerryN
  • 2,356
  • 1
  • 15
  • 49
-1
votes
1 answer

I'd like to run this simple re-ordering code in a GPU with an OpenCl-kernel. Is it possible?

I'd like to run this simple C code in GPU in an OpenCl-Kernel. Is it possible? #include int main() { int a[15]={7,8,0,4,13,1,14,5,10,2,3,11,12,6,9}; int b[15]; printf(input datas: "); for (i=0;i<15;i++)…
-1
votes
1 answer

Writing data back to dataframe after parallel computing in R

I am new to Parallel computing in R. I have gone through various links on StackOverFlow for the topic and wrote an initial code library(doParallel) library(foreach) detectCores() ## [1] 4 # Create cluster with desired number of cores cl <-…
Mohit Bansal
  • 131
  • 9
1 2 3
30
31