parallel.RdOn a multi-processor system, you may wish to run parallel chains using
multiple jags.model objects, each running a single chain on a
separate processor. This function returns a list of values that may
be used to initialize the random number generator of each chain.
parallel.seeds(factory, nchain)parallel.seeds returns a list of RNG states. Each element
is a list of length 2 with the following elements:
The name of the RNG
An integer vector giving the state of the RNG.
It is not yet possible to make the results of parallel.seeds
reproducible. This will be fixed in a future version of JAGS.
jags.model, section “Random number generators”,
for further details on RNG initialization;
list.factories to find the names of available RNG
factories.
##The BaseRNG factory generates up to four distinct types of RNG. If
##more than 4 chains are requested, it will recycle the RNG types, but
##use different initial values
parallel.seeds("base::BaseRNG", 3)
#> [[1]]
#> [[1]]$.RNG.name
#> [1] "base::Wichmann-Hill"
#>
#> [[1]]$.RNG.state
#> [1] 13750 11245 4052
#>
#>
#> [[2]]
#> [[2]]$.RNG.name
#> [1] "base::Marsaglia-Multicarry"
#>
#> [[2]]$.RNG.state
#> [1] 458752115 1133147935
#>
#>
#> [[3]]
#> [[3]]$.RNG.name
#> [1] "base::Super-Duper"
#>
#> [[3]]$.RNG.state
#> [1] -1695665 -652909089
#>
#>
## The lecuyer module provides the RngStream factory, which allows large
## numbers of independent parallel RNGs to be generated.
load.module("lecuyer")
#> module lecuyer loaded
list.factories(type="rng")
#> factory status
#> 1 lecuyer::RngStream TRUE
#> 2 base::BaseRNG TRUE
parallel.seeds("lecuyer::RngStream", 5);
#> [[1]]
#> [[1]]$.RNG.name
#> [1] "lecuyer::RngStream"
#>
#> [[1]]$.RNG.state
#> [1] -713003263 1572853575 1006450429 1988463523 -910586183 144709055
#>
#>
#> [[2]]
#> [[2]]$.RNG.name
#> [1] "lecuyer::RngStream"
#>
#> [[2]]$.RNG.state
#> [1] -2048126357 1860181565 853387892 -1163871536 -512428687 -1467926510
#>
#>
#> [[3]]
#> [[3]]$.RNG.name
#> [1] "lecuyer::RngStream"
#>
#> [[3]]$.RNG.state
#> [1] -402706131 916035018 1577164627 -379450383 2013136851 271862711
#>
#>
#> [[4]]
#> [[4]]$.RNG.name
#> [1] "lecuyer::RngStream"
#>
#> [[4]]$.RNG.state
#> [1] 421387743 -1062957133 -976096765 996706848 -1532124455 1867996631
#>
#>
#> [[5]]
#> [[5]]$.RNG.name
#> [1] "lecuyer::RngStream"
#>
#> [[5]]$.RNG.state
#> [1] 728386752 -582948890 -530853419 -499903599 -1071670872 -467824802
#>
#>