Questions tagged [mclapply]

mclapply is a parallelized version of lapply, it returns a list of the same length as X, each element of which is the result of applying FUN to the corresponding element of X.

mclapply is a parallelized version of lapply. It returns a list of the same length as X, each element of which is the result of applying FUN to the corresponding element of X.

136 questions
0
votes
0 answers

how to use lapply to get exactly same random number from mclapply

library(parallel) RNGkind("L'Ecuyer-CMRG") set.seed(100) mclapply(1:4, function(i) rnorm(1)) The above codes work well. But how can we reproduce the random number in sequential process mode? if we replace the above mclapply with lapply, the results…
Mike Zhang
  • 21
  • 1
0
votes
0 answers

Is there a way to prevent parallel::mclapply() accessing the contents of the global environment?

Can the R function parallel::mclapply() be made to run in a RAM-efficient way in interactive RStudio sessions in situations where large objects reside in the global environment? I find that when I use mclapply() to run analyses on multiple cores,…
Roger
  • 677
  • 2
  • 8
  • 19
0
votes
0 answers

Set OpenMP threads for all dependencies in R package

I'm developing an R package which uses parallel::mclapply and several other library dependencies which possibly rely upon OpenMP. Unfortunately, some functions explode with memory usage, making the R package practically unusable. I've noticed that…
EB2127
  • 1,788
  • 3
  • 22
  • 43
0
votes
1 answer

Using "sample" within mclapply in R not working properly

I'm trying to run multiple iterations of a function using a different subset of of my dataframe each time. In reality the function takes a very long time, so I want to split the iterations across multiple cores using mclapply. For each iteration I'm…
LvG
  • 417
  • 1
  • 4
  • 11
0
votes
0 answers

All scheduled cores encountered errors in user code (unexpected symbol) - but no such code

/EDIT: My problem has been resolved. It turns out it was indeed an error unrelated to parallel. Hi StackOverflow Community, today I have a rather odd problem. I have a function which I am calling to run on 8 cores, and it has a parameter called…
Ben
  • 784
  • 5
  • 14
0
votes
1 answer

Understanding writeValues of raster by parallel processing. Is it possible to writevalues for each raster while using mclapply fork cluster. R

I try to understand how to parallelize raster processing in R. My Goal ist to parallize the following on multiple cores with multiple rasters. I process my raster blockwise and i try to parallelize it with mclapply or other functions. First i want…
Muesgen
  • 152
  • 8
0
votes
1 answer

Parallel computing using `mclapply` in R, Linux

How to convert the code below to perform parallel jobs on 5 cores? From serial processing nfac=length(values) n=10 for (i in 1:5){ system(sprintf('./tools/siteLevelFLUXNET/morris/%s/prep_model_params.sh %s %s %s',i,nfac,n)) } to Parallel…
0
votes
1 answer

replace nested for-loops on multidimensional array with mclapply()

I'm trying to perform an action over a 4-dimensional array. This array ends up being incredibly big, but is necessary for the data that i'm processing. Now the process itself goes swell, but i want to make it ready for parallel computing. I've got…
JadaLovelace
  • 194
  • 4
  • 16
0
votes
0 answers

Trying to Substitute an R base function by its parallel processing cousin (with trace function)

I'm trying to substitute lapply function with mclapply on a shiny application, with the trace function. I'm trying to narrow the trace to the used package's namespace, but it is not working. Most errors are problems of inputs in lapply, either by…
0
votes
0 answers

sapply, mclapply, or nested loop? Objective: fastest processing time

Hello and thank you all for looking at my question. The ultimate goal of this post is to identify my fastest option to input specific distance values, using row and column names that identify the respective spatial location from a small symmetrical…
0
votes
1 answer

mclapply using all cores but not all threads

I have a 4 core Mac with 8 threads. My understanding of mclapply() is that it should utilize the 8 threads as processors, but when I run my script I only see 4 threads working. In my example, I am using a nested list because in my real work I have a…
nateroe
  • 487
  • 3
  • 20
0
votes
1 answer

mclapply() using only 2 cores on 32 core system

I'm trying to speed up computation times associated with the raup-crick dissimilarity as calculated by Chase et al. 2011. In order to accomplish this, I am attempting to utilize parallel computing on a 32 core ubuntu based-machine which is running…
0
votes
1 answer

Parallel recursive function in R?

I’ve been wracking my brain around this problem all week and could really use an outside perspective. Basically I’ve built a recursive tree function where the output of each node in one layer is used as the input for a node in the subsequent layer.…
Jeff Bezos
  • 1,929
  • 13
  • 23
0
votes
2 answers

Parallelizing the R code using mclapply does not generate the correct results

I have a dataframe df and need to apply a function that gives a score to each columns (calc.fitness): df # ch1 ch2 ch3 ch4 ch5 ch6 ch7 ch8 # g1 5 2 7 10 7 10 10 6 # g2 1 …
0
votes
0 answers

In mclapply : scheduled cores 9 encountered errors in user code, all values of the jobs will be affected

I went through the existing stackoverflow links regarding this error, but no solution given there is working (and some questions dont have solutions there either) Here is the problem I am facing: I run Arima models in parallel using mclapply of…
Varun kadekar
  • 427
  • 6
  • 15