Another reduce_sum() example

I’ve written a short post on a successful application of reduce_sum() to a moderately complex model. The post is here: https://extragalactic.blog/2020/06/04/multithreading-comes-to-stan/. This is more or less a companion to the immediately previous post: https://extragalactic.blog/2020/03/22/the-current-state-of-my-star-formation-history-modeling/.

I didn’t get into the nitty-gritty details of installing and running CmdStan and cmdstanr because it was pretty easy and anyway I didn’t take notes. I did get a helpful hint from member @Max_Mantei that the MSYS make used in Rtools 4.0 is named mingw32-make and is not installed into Rtools by default. I have a make.exe somewhere on my path (probably cuda tools) that doesn’t work. I also got some help from various threads here when my initial attempts to write a partial_sum function failed. For some strange reason I failed to understand that a vector is not an “array of any type.”

6 Likes

Nice post. If you are interested in exact reproducibility then use reduce sum static (but do set the grainsizes meaningfully in that case).

Efficient use of the slicing argument is to put parameters there like in a hierarchical model.