Print the time duration of each N iterations in the output

I’m using CmdStan in R and I have a question regarding the printed output. Below is my code (stan_code is my complied stan file):

fit2 ← stan_code$sample(cor_dat,seed = 1234,
chains = 2,
iter_warmup = 1000,
iter_sampling = 1000,
parallel_chains = 2,
threads_per_chain = 12,
refresh = 50))

  • Operating System: Windows11
  • CmdStan Version: 2.31.0
  • Compiler/Toolkit: RTools4.2

I’m using a remote computer to run this code and the duration between every 50 iteration is quite inconsistent. I wonder whether is a way to print the absolute time after each 50 iteration or the duration between each printed refresh. Alternatively, is it possible to print a timestamp every N minutes to I could also get an estimation of the duration between each 50 iterations.

Thanks!

None of the standard APIs permit this, but I had something similar to what you’re looking for (and easily modified to be precisely what you’re looking for ) here. I had to pause that project the last while and last I checked it was broken (likely by interim upstream changes), but I’m hoping to revive it soon and certainly you can check out how I achieved the iteration timing (simply monitor the csv files for new lines and timings thereof).