-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The parallel vignette shows how one can get reproducible parallel RNG streams in principle. However, this is not very convenient. It would be nice to have an analogue function for clusterSetRNGStream, e.g.:
dqclusterSetRNGStream <- function(cl = NULL, iseed = NULL) {
if (is.null(cl))
cl <- parallel::getDefaultCluster()
if (is.null(iseed))
iseed <- dqrng::generateSeedVectors(1L)[[1L]]
invisible(parallel::clusterApply(cl,
seq_along(cl),
function(seed, stream) {
dqrng::dqset.seed(seed, stream)},
seed = iseed))
}- This is just one way to achieve reproducibility, see https://pat-s.me/reproducibility-when-going-parallel/ by @pat-s for more details.
- It would be nice to not use R's RNG here via
dqrng::generateSeedVectors. Instead, the random seed could be taken from dqrng's RNG. - It would make sense to offer the possibility to set the RNG kind as well.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request