| micSimParallel | R Documentation |
Splits the population across processor cores, runs micSim() on each,
and recombines the results into one pop data frame.
micSimParallel(
initPop = NULL,
immigrPop = NULL,
initPopList = list(),
immigrPopList = list(),
transitionMatrix,
absStates = NULL,
varInitStates = c(),
initStatesProb = c(),
fixInitStates = c(),
maxAge = 99,
simHorizon,
fertTr = c(),
monthSchoolEnrol = c(),
cores = 1L,
seeds = 1254L,
verbose = TRUE
)
initPop |
Data frame describing the starting population; see
|
immigrPop |
Data frame describing immigrants, or |
initPopList, immigrPopList |
Pre-computed splits, one list element per core. Supply these to control which individuals go to which core; otherwise the split is made automatically into near-equal chunks. Immigrants assigned to a core without a starting population are simulated on the first core that has one. |
transitionMatrix, absStates, varInitStates, initStatesProb, fixInitStates |
As in |
maxAge, simHorizon, fertTr, monthSchoolEnrol |
As in |
cores |
Number of processor cores to use. |
seeds |
Integer seed of the run, used by every worker. |
verbose |
Report progress through |
Individuals are independent of one another in MicSim's model, so simulating them in separate groups and concatenating the results is exactly equivalent to simulating them together.
Reproducibility. Every worker runs with the seed seeds, and
every individual draws from their own L'Ecuyer-CMRG stream derived
from it and their ID. The life courses are therefore the same on any
number of cores and under any split; only the identifiers of newborns
depend on the split (see Identifiers).
Identifiers. Each worker assigns newborn IDs starting above the largest ID in its own group, so different workers can assign the same ID to different newborns. When the results are combined, newborns receive consecutive IDs starting one above the larger of the highest supplied ID and the total number of people in the starting and immigrant populations. All supplied IDs are preserved.
Rate functions are exported to the workers along with everything
else visible where micSimParallel() was called.
The same data frame micSim() returns, for the whole
population.
micSimParallel() is deprecated as of MicSim 4.0.0 and will be removed in a
future release. It still works, and shows a message once per R session
naming its replacement: build the model with micsim_model() and run it with
simulate(model, seed = , cores = ) (simulate.micsim_model()). Set
options(MicSim.show_deprecation = FALSE) to turn the message off.
micSim(), MicSim-concepts
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.