Skip to content

Commit b90c143

Browse files
authored
Merge pull request #809 from wlandau/738-instantiate
Document a CmdStan-focused way to pre-compile Stan models in R packages
2 parents 74f39dc + 8505f1c commit b90c143

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

vignettes/cmdstanr-internals.Rmd

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,24 @@ CmdStanR can of course be used for developing other packages that require compil
470470
and running Stan models as well as using new or custom Stan features available
471471
through CmdStan.
472472

473+
### Pre-compiled Stan models in R packages
474+
475+
You may compile a Stan model at runtime (e.g. just before sampling),
476+
or you may compile all the models inside the package file system in advance at installation time.
477+
The latter avoids compilations at runtime, which matters in centrally managed R installations
478+
where users should not compile their own software.
479+
480+
To pre-compile all the models in a package,
481+
you may create top-level scripts `configure` and `configure.win`
482+
which run `cmdstan_model()` with `compile = TRUE` and save the compiled executables
483+
somewhere inside the `inst/` folder of the package source.
484+
The [`instantiate`](https://wlandau.github.io/instantiate/) package helps developers
485+
configure packages this way,
486+
and it documents other topics such as submitting to CRAN and administering CmdStan.
487+
Kevin Ushey's [`configure`](https://github.com/kevinushey/configure) package helps
488+
create and manage package configuration files in general.
489+
490+
473491
### Troubleshooting and debugging
474492

475493
When developing or testing new features it might be useful to have more

0 commit comments

Comments
 (0)