Discussion: Forcing parallel reproducibility via the default RNG kind?

Aperta
#354 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
r

Direzione di ricerca

Esamina gli entry point RNG standard di R per il multicore e i socket descritti qui, insieme ai test della pull request #80 di parallelMap. L’issue non definisce un obiettivo di implementazione né criteri di accettazione, quindi sarebbe necessario concordare un comportamento e i test corrispondenti prima di poter considerare concluso il lavoro.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

RNG

(This issue should serve as a public place for the discussion @HenrikBengtsson and I had via mail recently)

I wonder if it makes sense to support reproducible parallel streams via the default RNG kind "Mersenne-Twister" within a package to help users who are not aware that this RNG kind does not provide reproducible streams in parallel.

(I am talking about the standard parallel backends in R and not specifically about the way one can do this via the {future} package.)

Multicore backend

   old.seed = .Random.seed 
   seed = sample(1:100000, 1) 
   # we need to reset the seed first in case the user supplied a seed, 
   # otherwise "L'Ecuyer-CMRG" won't be used 
   rm(.Random.seed, envir = globalenv()) 
   set.seed(seed, "L'Ecuyer-CMRG") 

If the user uses set.seed(<number>) and goes parallel via the multicore backend, the code above will ensure parallel RNG streams.

If you want to see in action, https://github.com/mlr-org/parallelMap/pull/80 has some tests to ensure the correct functioning.

Socket backend

Here, one can do

clusterSetRNGStream(cl, iseed = sample(1:100000, 1)) 

to support the default RNG kind in parallel scenarios.

General

Whenever doing this, I wonder if one should at least tell the user that this was done behind the scenes to make them aware of whats happening (including eventual decreases in speed).

Lingua principale
R
Stelle
1k
Fork
93
Merge medio
2g 4h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di futureverse/future

Tutte le issue di futureverse/future

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.