Here’s an R code for analysing post-warmup results
mpimodel = cmdstan_model("normal.stan", quiet = FALSE)
datapath = process_data(list(D=2))
system(paste("mpiexec -n 4 --tag-output ./normal sample data file=", datapath, sep=""))
stanfit = rstan::read_stan_csv(c("mpi.0.output.csv","mpi.1.output.csv","mpi.2.output.csv","mpi.3.output.csv"))
leapfrogs = rstan::get_num_leapfrog_per_iteration(stanfit)
mean(leapfrogs)
rstan::monitor(stanfit)
Getting results for warmup (we’d like to get number of iterations and n_leapfrog per iteration) is more difficult. If I add option save_warmup=1
the csv file is not correct
I rstan::read_stan_csv(c("mpi.0.output.csv", "mpi.1.output.csv", :
the number of iterations after warmup found (200) does not match iter/warmup/thin from CSV comments (1000,1000,1000,1000)
The number of warmup iterations should be set to the actual adaptation result (ping @yizhang)