Error: mc.cores' > 1 is not supported on Windows

I have a function bar_SE which want to run 100 times.

bar_SE=function(i,bootstr){
  out_6k <- list()
  iter_max <- bootstr
  z <- 0
  while(z < iter_max) {
    z <- z + 1
    set.seed(z + 123)
    out_6k[[z]]  <- sample(i, length(i),replace = TRUE)
    }
  return(out_6k)
}
i=list(c(34:41),c(59:75))

out_all=parallel::mcmapply(function(i,bootstr){
  return(bar_SE(i,bootstr))
}, i=i,bootstr=100,mc.cores=1,SIMPLIFY = FALSE)

This code works well but time consuming.
Is there any way I could run parallely in my winodw having 8 nodes.
May be an alterantive to

out_all=parallel::mcmapply(function(i,bootstr){
  return(bar_SE(i,bootstr))
}, i=i,bootstr=100,mc.cores=1,SIMPLIFY = FALSE)

So, that I could faster while executing it. For instace, how to enable running mc.cores= >1 [which is not supported].

you cant use mcmapply for parallel work in windows as it requires forking which is not supported.
However there are alternatives based on socket approaches; you could look into foreach for example

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.