Threading and cmdstan 2.18


#1

Just wondering if there are any more examples of models with threading floating around (in addition to the two examples in ch22 of the latest edition of the manual)?

Would love to make this work, but primarily just lots of questions so far.

Edit: Or should users hold their horses with the questions till you have actually released 2.18…? :P


#2

Is anything unclear with the doc? You will have to code up your model using map rect. The rest is taken care of for you…but I agree in that this facility is not super user friendly due to the need for packing and unpacking of the parameters and the data.


#3

Right now I am wondering how to e.g. pack a standard regression, where y is a vector and X is a matrix (and hence no int).

Should then both y and X be mapped to the real[] x_rs function argument, and then unpacked into y and X in the function that evaluates the likelihood? Or more generally: Should all data types that are not integers be packed into real[] x_rs, and all integers be placed in int[] x_is?

I think the doc is great, but as I haven’t worked with mapping functions before I’ll probably need quite a bit of trial and error to figure it out. So more examples with different data/parameter types would save some time.


#4

Where’s chapter 22? I’m using pure C++ with Stan and I cannot get multi-threading to work with the sampling. Hoping the documentation you’re referring to might give me some hints.


#5

The user manual for 2.18 here:


#6

Thanks @Ole_Petter_Hansen Is it the “Map-Reduce” section you’re talking about?


#7

Nope. We’re happy to take examples.

And hopefully we’ll get more examples out ourselves of how to do things. We tend to just doc the behavior in the manual. Then we need to get the users guide up to par for this, which means a bunch of examples.

We’ll also be adding utilitiles on top of the basic map_rect going forward. We wanted to use the basic form for a while before deciding how to abstract.


#8

The answer is likely yes here. However, we definitely need to provide examples which show how to efficiently code this up. Also, the utility/speedup of map_rect has been demonstrated for ODE models and rather expensive PK/PD models (in analytic form) so far. The standard regression examples should also benefit, but it remains to be seen what data sizes are needed in order to make up for the additional overhead incurred by map_rect in comparison to using the really fast vectorized expressions in Stan straight.

… so I would recommend to start with easy examples and benchmarks before one embarks into coding your super-complex model in map_rect. The facility is new and we all need to learn when and how to use it best.


#9

Great, thanks. Then I’ll just try :-)


#10

Feel free to share the example for comments.