34.1 Command-line options for stanc3
The stanc3 compiler has the following command-line syntax:
> stanc (options) <model_file>
<model_file> is a path to either a Stan model
file ending in suffix
.stan or a Stan functions
file which ends in
The stanc3 options are:
--help- Displays the complete list of stanc3 options, then exits.
--version- Display stanc version number
--info- Print information about the model, such as the type information for variables and the list of used distributions.
--name=<model_name>- Specify the name of the class used for the implementation of the Stan model in the generated C++ code.
--o=<file_name>- Specify a path to an output file for generated C++ code (default =
.hpp) or auto-formatting output (default: no file/print to stdout)
--allow-undefined- Do not throw a parser error if there is a function in the Stan program that is declared but not defined in the functions block.
--include_paths=<dir1,...dirN>- Takes a comma-separated list of directories that may contain a file in an
--use-opencl- If set, will use additional Stan OpenCL features enabled in the Stan-to-C++ compiler.
--auto-format- Pretty prints the program to the console. See more on auto formatting.
--canonicalize- Make changes to the program before pretty-printing by specifying options in a comma separated list. Options are ‘deprecations’, ‘parentheses’, ‘braces’, ‘includes’.
--max-line-length=<number>- Set the column number at which formatting with
--auto-formatattempts to split lines. The default value is 78, which results in most lines being shorter than 80 characters.
--print-canonical- Synonymous with
--auto-format --canonicalize=[all options].
--print-cpp- If set, output the generated C++ Stan model class to stdout.
--standalone-functions- If set, only generate the code for the functions defined in the file. This is the default behavior for
--O0(Default) Do not apply optimizations to the Stan code.
--O1Apply level 1 compiler optimizations (only basic optimizations).
--OexperimentalWARNING: This is currently an experimental feature whose components are not thoroughly tested and may not improve a programs performance! Allow the compiler to apply all optimizations to the Stan code.
--OWARNING: This is currently an experimental feature whose components are not thoroughly tested and may not improve a programs performance! Same as
--Oexperimental. Allow the compiler to apply all optimizations to the Stan code.
--warn-uninitialized- Emit warnings about uninitialized variables to stderr. Currently an experimental feature.
--warn-pedantic- Emit warnings in Pedantic mode which warns of potential issues in the meaning of your program.
The compiler also provides a number of debug options which are
primarily of interest to stanc3 developers; use the
option to see the full set.