It is often discouraged to generate random numbers in parallel calculation in R by simply setting sequential seeds for each parallel process like
library(parallel)
cl <- makeCluster(4)
y <- parLapply(cl, 1:10, function(i) {
set.seed(i)
runif(n = 5)
})
stopCluster(cl)
(code from https://www.jottr.org/2020/09/22/push-for-statistical-sound-rng/).
I could not find any example that would reproducibly demonstrate a problem with this 'naive' approach.
How can I demonstrate the potential issues with this naive approach?
Aucun commentaire:
Enregistrer un commentaire