install_cmdstan | R Documentation |
The install_cmdstan()
function attempts to download and
install the latest release of CmdStan.
Installing a previous release or a new release candidate is also possible
by specifying the version
or release_url
argument.
See the first few sections of the CmdStan
installation guide
for details on the C++ toolchain required for installing CmdStan.
The rebuild_cmdstan()
function cleans and rebuilds the CmdStan
installation. Use this function in case of any issues when compiling models.
The cmdstan_make_local()
function is used to read/write makefile flags
and variables from/to the make/local
file of a CmdStan installation.
Writing to the make/local
file can be used to permanently add makefile
flags/variables to an installation. For example adding specific compiler
switches, changing the C++ compiler, etc. A change to the make/local
file
should typically be followed by calling rebuild_cmdstan()
.
The check_cmdstan_toolchain()
function attempts to check for the required
C++ toolchain. It is called internally by install_cmdstan()
but can also
be called directly by the user. On Windows only, calling the function with
the fix = TRUE
argument will attempt to install the necessary toolchain
components if they are not found. For Windows users with RTools and CmdStan
versions >= 2.35 no additional toolchain configuration is required.
NOTE: When installing CmdStan on Windows with RTools and CmdStan versions
prior to 2.35.0, the above additional toolchain configuration
is still required. To enable this configuration, set the environment variable
CMDSTANR_USE_MSYS_TOOLCHAIN
to 'true' and call
check_cmdstan_toolchain(fix = TRUE)
.
install_cmdstan(
dir = NULL,
cores = getOption("mc.cores", 2),
quiet = FALSE,
overwrite = FALSE,
timeout = 1200,
version = NULL,
release_url = NULL,
release_file = NULL,
cpp_options = list(),
check_toolchain = TRUE,
wsl = FALSE
)
rebuild_cmdstan(
dir = cmdstan_path(),
cores = getOption("mc.cores", 2),
quiet = FALSE,
timeout = 600
)
cmdstan_make_local(dir = cmdstan_path(), cpp_options = NULL, append = TRUE)
check_cmdstan_toolchain(fix = FALSE, quiet = FALSE)
dir |
(string) The path to the directory in which to install CmdStan.
The default is to install it in a directory called |
cores |
(integer) The number of CPU cores to use to parallelize building
CmdStan and speed up installation. If |
quiet |
(logical) For |
overwrite |
(logical) Should CmdStan still be downloaded and installed
even if an installation of the same version is found in |
timeout |
(positive real) Timeout (in seconds) for the build stage of the installation. |
version |
(string) The CmdStan release version to install. The default
is |
release_url |
(string) The URL for the specific CmdStan release or
release candidate to install. See https://github.com/stan-dev/cmdstan/releases.
The URL should point to the tarball ( |
release_file |
(string) A file path to a CmdStan release tar.gz file
downloaded from the releases page: https://github.com/stan-dev/cmdstan/releases.
For example: |
cpp_options |
(list) Any makefile flags/variables to be written to
the |
check_toolchain |
(logical) Should |
wsl |
(logical) Should CmdStan be installed and run through the Windows
Subsystem for Linux (WSL). The default is |
append |
(logical) For |
fix |
For |
For cmdstan_make_local()
, if cpp_options=NULL
then the existing
contents of make/local
are returned without writing anything, otherwise
the updated contents are returned.
## Not run:
check_cmdstan_toolchain()
# install_cmdstan(cores = 4)
cpp_options <- list(
"CXX" = "clang++",
"CXXFLAGS+= -march=native",
PRECOMPILED_HEADERS = TRUE
)
# cmdstan_make_local(cpp_options = cpp_options)
# rebuild_cmdstan()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.