compileStanModel: Compile stan model with cmdstanr

Description Usage Arguments Value

View source: R/stanUtils.R

Description

NOTE previous name: init_stan_model

Usage

1
2
3
4
5
6
compileStanModel(
  model_path,
  use_thread = NULL,
  use_mpi = NULL,
  use_opencl = NULL
)

Arguments

model_path

string, stan script

use_thread

bool/NULL, when reduce_sum or map_rect in script, set it as TRUE. When running, remember to export STAN_NUM_THREADS=4. Default is NULL.

use_mpi

bool/NULL, when map_rect in script, set it as TRUE. Deault is NULL.

use_opencl

bool/NUYLL, enable the OpenCL backend. Deault is NULL. When set is as TRUE, remember to set STAN_OPENCL=true when compiling. https://mc-stan.org/docs/2_26/cmdstan-guide/parallelization.html

  • The Stan model compiled with STAN_OPENCL can also be supplied the OpenCL platform and device IDs of the target device. These IDs determine the device on which to run the OpenCL-supported functions on. You can list the devices on your system using the clinfo program. If the system has one GPU and no OpenCL CPU runtime, the platform and device IDs of the GPU are typically 0. In that case you can also omit the OpenCL IDs as the default 0 IDs are used in that case. We supply these IDs when starting the executable as shown below: path/to/model sample data file=data.json opencl platform=0 device=1

NOTEBUG: use_xxx = NULL when we don't want to use them. When I set them as FALSE, they still treat them as TRUE.

Value

compiled stan model


beyondpie/mssc documentation built on Jan. 8, 2022, 1:30 p.m.