Suggestion from Perry for parallelization
Build a small collection of compiled nimble objects (model, MCMC, calculator,
simulate function), one per core, and let each core keep its own across one
replicate after another. For example, for 100 replicates on 5 cores, that is 5
compilations, not 100. Compiled nimble objects cannot be sent between
processes, so each core builds its own; the point is that it builds it once.
Suggested tool: the future package.
To do:
- Make the collection buildable from the specifications alone, so a core can
build its own with nothing passed in.
- Add
future to Suggests, and keep the serial loop working without it.
- Decide what gets reset between replicates.
Suggestion from Perry for parallelization
Build a small collection of compiled nimble objects (model, MCMC, calculator,
simulate function), one per core, and let each core keep its own across one
replicate after another. For example, for 100 replicates on 5 cores, that is 5
compilations, not 100. Compiled nimble objects cannot be sent between
processes, so each core builds its own; the point is that it builds it once.
Suggested tool: the
futurepackage.To do:
build its own with nothing passed in.
futureto Suggests, and keep the serial loop working without it.