Following Reduce Sum: A Minimal Example but getting:
> logistic1 <- cmdstan_model("logistic1.stan", threads = TRUE)
Error in self$compile(...) : unused argument (threads = TRUE)
I can compile without
threads = TRUE just fine.
we have refactored the way users enable threading in the last few days.
The signature has changed to
logistic1 <- cmdstan_model("logistic1.stan", cpp_options = list(stan_threads = TRUE))
Its also updated in the case study, but it has changed basically yesterday. So you may be looking at an old version.
The way you use it should however print a warning, not an error, I am working on that.
I apologize, cmdstanr is still in development mode, so things sometimes break. We try not to break it intentionally :)
thanks again !
I refreshed the case study Reduce Sum: A Minimal Example and reinstalled
chains still does not work, so maybe I have an older version still ?
This is cmdstanr version 0.0.0.9000
- Online documentation and vignettes at mc-stan.org/cmdstanr
- CmdStan path set to: /home/shira-rstudio/.cmdstanr/cmdstan-2.23.0
- Use set_cmdstan_path() to change the path
I tried my local machine and a cluster of cores, different values for
num_threads (see my question about how to set these here), but I rarely get speed-up, and never anywhere close to the 2.7 speed-up in the case study.
I must be doing something silly ! thanks again for your help.
Since I can’t get any speed-up in CmdStanR, it might it be worth trying to replicate the case study in regular CmdStan instead ?
I followed Getting Started with CmdStan, used
stan_rdump(names(redcard_data), "redcard.data.R") in RStudio, and then in the terminal:
~/Documents/logistic0 sample data file=~/Documents/redcard.data.R
~/Documents/logistic1 sample data file=~/Documents/redcard.data.R
These compile and sample. But how do I modify to set cores and threads, following the Reduce Sum: A Minimal Example case study ? How can I time things ?
in CmdStan, you need to run the make command to compile everything with threading on - if you’re using the CmdStan 2.23 release, the easiest way to do this is:
make STAN_THREADS=TRUE build
make STAN_THREADS=TRUE my_model
to time things, use the linux
time command -
time my_model sample file=my.data.json yada yada yada
there’s no control for cores - since CmdStan runs a single chain, with threading on, it’ll use all available cores - @wds15 or @rok_cesnovar - is this correct?