Skip to content

Commit e8a4c0f

Browse files
committed
Merge branch 'master' of https://github.com/stan-dev/docs
2 parents 643e57f + 6b47dd5 commit e8a4c0f

23 files changed

+330
-311
lines changed

src/cmdstan-guide/command_line_options.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ output file for profiling data. If the model uses no profiling, the output profi
8888
is not produced. If the model uses profiling and `profile_file` is unspecified, the
8989
profiling data is written to a file named `profile.csv` in the current working directory.
9090

91-
The keyword value pair `save_cmdstan_config=<int>` specifies whether to save the
91+
The keyword value pair `save_cmdstan_config=<boolean>` specifies whether to save the
9292
configuration options used to run the program to a file named `<output file>_config.json`
93-
alongside the other output files. The default value is 0, which means the configuration
93+
alongside the other output files. The default value is `false`, which means the configuration
9494
file is not saved.
9595
The contents of this file are similar to the comments in the Stan CSV file, but should
9696
be more portable across versions and easier to parse.

src/cmdstan-guide/external_code.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ on their signatures if used in external C++.
193193

194194
- RNGs must end with `_rng`. They will be passed a "base RNG object" as the
195195
second to last argument, before the pointer to the ostream. We recommend
196-
making this a template, since it may change, but at the moment it is always a
197-
`boost::random::ecuyer1988` object.
196+
making this a template, since it may change. This is currently a
197+
`stan::rng_t` object (a type alias to `boost::rng::mixmax`).
198198
- Functions which edit the `target` directly must end with `_lp` and will be
199199
passed a reference to `lp__` and a reference to a `stan::math::accumulator`
200200
object as the final parameters before the ostream pointer. They are also

src/cmdstan-guide/installation.qmd

Lines changed: 23 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ and compiles all necessary C++ libraries.
174174

175175
```
176176
> cd <cmdstan-home>
177-
> make build # on Windows use mingw32-make
177+
> make build
178178
```
179179

180180
If your computer has multiple cores and sufficient ram, the build process
181181
can be parallelized by providing the `-j` option. For example, to build on 4 cores, type:
182182
```
183-
> make -j4 build # on Windows use mingw32-make
183+
> make -j4 build
184184
```
185185

186186
When `make build` is successful, the directory `<cmdstan-home>/bin/`
@@ -202,7 +202,7 @@ See [these instructions](https://helpdeskgeek.com/windows-10/add-windows-path-en
202202
for details on changing the `PATH`.
203203
To permanently make this setting for the current user, you may execute:
204204
```
205-
> mingw32-make install-tbb
205+
> make install-tbb
206206
```
207207
After changing the `PATH` environment variable, you must open an new shell
208208
in order for the new environment variable settings to take effect.
@@ -238,7 +238,7 @@ On Windows:
238238

239239
```
240240
# compile the example
241-
> mingw32-make examples/bernoulli/bernoulli.exe
241+
> make examples/bernoulli/bernoulli.exe
242242
243243
# fit to provided data (results of 10 trials, 2 out of 10 successes)
244244
> ./examples/bernoulli/bernoulli.exe sample data file=examples/bernoulli/bernoulli.data.json
@@ -261,7 +261,7 @@ from the `<cmdstan-home>` directory:
261261

262262
```
263263
> cd <cmdstan-home>
264-
> make clean-all # on Windows use mingw32-make
264+
> make clean-all
265265
> make build
266266
```
267267

@@ -282,19 +282,7 @@ error: PCH file uses an older PCH format that is no longer supported
282282
In this case, clean and rebuild CmdStan, as shown in the previous section.
283283

284284

285-
**Windows: 'mingw32-make' is not recognised**
286-
287-
If the C++ toolchain has been installed but not properly registered,
288-
then the call to `mingw32-make` will result in error message:
289-
```
290-
'mingw32-make' is not recognised as an internal or external command
291-
```
292-
To fix this, ensure you have followed the steps for adding the toolchain to your
293-
`PATH` and installing the additional utilities covered in the
294-
[configuration instructions](#windows)
295-
296-
297-
**Windows: 'g++' or 'cut' is not recognized**
285+
**Windows: 'g++', 'make', or 'cut' is not recognized**
298286

299287
The CmdStan makefile uses a few shell utilities which might not be present in Windows,
300288
resulting in the error message:
@@ -308,7 +296,7 @@ To fix this, ensure you have followed the steps for adding the toolchain to your
308296

309297
**Spaces in paths to CmdStan or model**
310298

311-
Both `make` and `mingw32-make` can fail when dealing with files in folders
299+
`make` can fail when dealing with files in folders
312300
with a space somewhere in their file path. Particularly on Windows, this can
313301
be an issue when CmdStan, or the models you are trying to build, are placed in
314302
the `One Drive` folder.
@@ -317,7 +305,7 @@ Unfortunately, the errors created by this situation are not alwas informative.
317305
Some errors you may see are:
318306

319307
```
320-
mingw32-make: *** INTERNAL: readdir: Invalid argument
308+
make: *** INTERNAL: readdir: Invalid argument
321309
```
322310
```
323311
make: *** [make/program:50: x.hpp] Error 2
@@ -399,93 +387,44 @@ xcode-select --install
399387
#### Windows {#windows}
400388

401389

402-
The Windows toolchain consists of programs `g++`, the C++ compiler, and `mingw32-make`, the GNU Make utility.
390+
The Windows toolchain consists of programs `g++`, the C++ compiler, and `make`, the GNU Make utility.
403391
To check if these are present,
404392
open a command shell [^1]
405393
and type:
406394
```
407395
g++ --version
408-
mingw32-make --version
396+
make --version
409397
```
410398

411-
CmdStan is known compatible with the RTools40, RTools42, and RTools43 toolchains. These require slightly
412-
different steps to configure, so please follow the appropriate steps below. All toolchains will require
399+
CmdStan is known compatible with the RTools43 toolchain. The toolchain will require
413400
updating your `PATH` variable, See [these instructions](https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/)
414401
for details on changing the `PATH` if you are unfamiliar. The following instructions will assume that the default installation
415402
directory was used, so be sure to update the paths accordingly if you have chosen a different
416403
directory.
417404

418-
##### RTools40
419-
420-
RTools40 provides both a standard `g++-8` toolchain and a `g++-10` Universal C Runtime (UCRT) toolchain.
421-
Note the that newer `g++-10` UCRT toolchain is only available for 64-bit systems, whereas the `g++-8`
422-
toolchain is available for both. Additionally the UCRT is only natively supported on Windows 10 and newer,
423-
older systems will require a [Microsoft update](https://support.microsoft.com/en-us/topic/update-for-universal-c-runtime-in-windows-c0514201-7fe6-95a3-b0a5-287930f3560c)
424-
425-
###### Installation
426-
427-
Download the [installer](https://github.com/r-windows/rtools-installer/releases/download/2022-02-06/rtools40-x86_64.exe)
428-
and complete the prompts to install.
429-
430-
Next, you need to add the location of the toolchain to your `PATH` environment variable so that it
431-
can be called from the command line. Add the following lines to your `PATH`:
432-
```
433-
C:\rtools40\usr\bin
434405

435-
# Add only one of the below
436-
C:\rtools40\mingw32\bin # 32-bit g++-8
437-
C:\rtools40\mingw64\bin # 64-bit g++-8
438-
C:\rtools40\ucrt64\bin # 64-bit g++-10 (UCRT)
439-
```
440-
441-
CmdStan additionally needs the `mingw32-make` utility, which you can install using RTools.
442-
Navigate to the installation directory (e.g., `C:\rtools40`) and launch the `msys2.exe` file.
443-
Execute the appropriate command below to install `mingw32-make` for your selected toolchain:
444-
```
445-
pacman -Sy mingw-w64-i686-make # 32-bit g++-8
446-
pacman -Sy mingw-w64-x86_64-make # 64-bit g++-8
447-
pacman -Sy mingw-w64-ucrt-x86_64-make # 64-bit g++-10 (UCRT)
448-
```
406+
##### RTools43
449407

450-
##### RTools42 & RTools43
408+
All required utilities (e.g., `make`, `g++`) for compiling and running CmdStan models on Windows are
409+
provided by the RTools43 toolchain from the R Project. Installation steps are provided below,
410+
and for more technical details on the toolchain refer to the [R Project documentation](https://cran.r-project.org/bin/windows/Rtools/rtools43/rtools.html).
451411

452-
Both RTools42 & RTools43 provide 64-bit UCRT toolchains, where RTools42 provides g++-10 and
453-
RTools43 provides g++-12. The installation/configuration is identical for both toolchains.
412+
Note that the toolchain is only available for 64-bit systems, and uses the new Universal C Runtime (UCRT).
413+
UCRT is only natively supported on Windows 10 and newer, older systems will require a
414+
[Microsoft update](https://support.microsoft.com/en-us/topic/update-for-universal-c-runtime-in-windows-c0514201-7fe6-95a3-b0a5-287930f3560c).
454415

455416
###### Installation
456417

457-
Download the installer for your preferred toolchain and complete the prompts for installation:
418+
Download the installer and complete the prompts for installation:
458419

459-
- [RTools42](https://cran.r-project.org/bin/windows/Rtools/rtools42/files/rtools42-5355-5357.exe)
460420
- [RTools43](https://cran.r-project.org/bin/windows/Rtools/rtools43/files/rtools43-5958-5975.exe)
461421

462422
Next, you need to add the toolchain directory to your `PATH` variable. Add the appropriate lines
463423
from below:
464424
```
465-
# RTools42
466-
C:\rtools42\usr\bin
467-
C:\rtools42\ucrt64\bin
468-
469-
# RTools43
470425
C:\rtools43\usr\bin
471-
C:\rtools43\ucrt64\bin
472-
```
473-
474-
Next, you need to install the `mingw32-make` utility and some additional compiler dependencies.
475-
Navigate to the installation directory of the toolchain and launch the `msys2.exe` file.
476-
Execute the below commands to install the needed dependencies:
426+
C:\rtools43\x86_64-w64-mingw32.static.posix\bin
477427
```
478-
pacman -Sy mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-gcc
479-
```
480-
481-
[^1]:
482-
To open a Windows command shell, first open the __Start Menu__,
483-
(usually in the lower left of the screen), select option __All Programs__,
484-
then option __Accessories__, then program __Command Prompt__.
485-
Alternatively, enter `[Windows+r]` (both keys together on the
486-
keyboard), and enter `cmd` into the text field that pops up in the Run window,
487-
then press `[Return]` on the keyboard to run.
488-
489428

490429
## Using GNU Make {#gnu-make}
491430

@@ -533,7 +472,7 @@ into a binary executable.
533472
For example, to compile the Stan program `my_program.stan` in directory `../my_dir/`,
534473
the make target is `../my_dir/my_program` or ` ../my_dir/my_program.exe` (on Windows).
535474

536-
To call Make, you invoke the utility name, either `make` or `mingw32-make`, followed by, in order:
475+
To call Make, you invoke the utility name, `make`, followed by, in order:
537476

538477
- zero or more [Make program options](https://www.gnu.org/software/make/manual/html_node/Options-Summary.html), then specify any Make variables as a series of
539478

@@ -552,7 +491,7 @@ Make targets can be preceded by any number of Makefile variable name=value pairs
552491
For example, to compile `../my_dir/my_program.stan` for an OpenCL (GPU) machine,
553492
set the makefile variable `STAN_OPENCL` to `TRUE`:
554493
```
555-
> make STAN_OPENCL=TRUE ../my_dir/my_program # on Windows use mingw32-make
494+
> make STAN_OPENCL=TRUE ../my_dir/my_program
556495
```
557496
Makefile variables can also be set by creating a file named `local` in the
558497
CmdStan `make` subdirectory which contains a list of `<VARIABLE>=<VALUE>` pairs,
@@ -567,7 +506,7 @@ __Make Targets__
567506

568507
When invoked without any arguments at all, Make prints a help message:
569508
```
570-
> make # on Windows use mingw32-make
509+
> make
571510
--------------------------------------------------------------------------------
572511
CmdStan v2.33.1 help
573512

src/cmdstan-guide/laplace_sample_config.qmd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ This method takes 2 arguments:
2828

2929
- `jacobian` - Whether or not the
3030
[Jacobian adjustment](https://mc-stan.org/docs/stan-users-guide/reparameterization.html)
31-
should be included in the gradient. The default value is 1 (include adjustment).
32-
(Note: in optimization, the default value is `0`, for historical reasons.)
31+
should be included in the gradient. The default value is `true` (include adjustment).
32+
(Note: in optimization, the default value is `false`, for historical reasons.)
3333

3434
- `mode` - Input file of parameters values on the constrained scale.
3535
When Stan's `optimize` method is used to estimate the modal values,
36-
the value of boolean argument `jacobian` should be 0 if `optimize` was
36+
the value of boolean argument `jacobian` should be `false` if `optimize` was
3737
run with default settings, i.e., the input is the MLE estimate;
38-
if `optimize` was run with argument `jacobian=1`, then the `laplace`
39-
method default setting, `jacobian=1`, should be used.
38+
if `optimize` was run with argument `jacobian=true`, then the `laplace`
39+
method default setting, `jacobian=true`, should be used.
4040

4141

4242

@@ -58,7 +58,7 @@ These can be used for diagnostics and importance sampling.
5858
To get an approximate estimate of the mode and standard deviation of the
5959
example Bernoulli model given the example dataset:
6060

61-
- find the MAP estimate by running optimization with argument `jacobian=1`
61+
- find the MAP estimate by running optimization with argument `jacobian=true`
6262

6363
- run the Laplace estimator using the MAP estimate as the `mode` argument.
6464

@@ -90,7 +90,7 @@ The header and first few data rows of the output sample are shown below.
9090
# method = laplace
9191
# laplace
9292
# mode = bernoulli_lbfgs.csv
93-
# jacobian = 1 (Default)
93+
# jacobian = true (Default)
9494
# draws = 1000 (Default)
9595
# id = 1 (Default)
9696
# data

src/cmdstan-guide/log_prob_config.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ convenience and should not be used for serious computation.
2020
This method takes 3 arguments:
2121

2222
- `jacobian` - Whether or not the [Jacobian adjustment for constrained](https://mc-stan.org/docs/stan-users-guide/reparameterization.html)
23-
parameters should be included in the gradient. Default value is 1 (include adjustment).
23+
parameters should be included in the gradient. Default value is `true` (include adjustment).
2424

2525
- `constrained_params` - Input file of parameters values on the constrained scale.
2626
A single set of constrained parameters can be specified using
@@ -81,7 +81,7 @@ This yields
8181
# log_prob
8282
# unconstrained_params = (Default)
8383
# constrained_params = params.json
84-
# jacobian = 1 (Default)
84+
# jacobian = true (Default)
8585
# id = 1 (Default)
8686
# data
8787
# file = bernoulli.data.json

0 commit comments

Comments
 (0)