simulation stuck after iteration only when using more then one iterations with mclapply

Hello everyone,

I’m trying to run R simulation with mclapply but if I trying to run more than one iteration the simulation not stop running.

this is the code:

simulationTime<-15*60+20
numO<-1
mm1envs <- mclapply(1:numO, function(i) {
set.seed(((i+100)^2)*3-7)
reset(ElectionDay)%>%run(until=simulationTime) %>%
wrap()
})

if it’s running with numO<-1 everything ok but if I change it to a bigger number the simulation keep running til I clik the stop button

also if I change it like this its working:
numO<-14
mm1envs <- mclapply(1:numO, function(i) {
set.seed(((i+100)^2)*3-7)
reset(ElectionDay)%>%run(until=639) %>%
wrap()
})

but more than time until=639 its stuck (also in 2 simulation)

thanks!

Your code is not really useful to help debug your issue as its substantially incomplete, i.e. it uses functions we dont have on data we dont have. Materials on how to produce reprex can be found here

p.s. are you using a linux based system that supports forking ? if not, i.e. if you are using windows, mclapply wont be parallelising your process.

This topic was automatically closed 21 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.