There is a CmdStanR issue stan-dev/cmdstanr#1070 reporting that when running generated_quantities time is reported but it is always 0.0s. For example,
Running standalone generated quantities after 4 MCMC chains, all chains in parallel ...
Chain 2 finished in 0.0 seconds.
Chain 4 finished in 0.0 seconds.
Chain 1 finished in 0.0 seconds.
Chain 3 finished in 0.0 seconds.
but in one of my case studies, these times should be around 40s.
The problem is that the timing information has not been written to csv when using generate_quantities in the same way as when using sample.
services/util/mcmc_writer.hpp has write_timing and log_timing methods, but these are missing from services/util/gq_writer.hpp
run_adaptive_sampler in services/util/run_adaptive_sampler.hpp (and run_sampler in services/util/run_sampler.hpp) has calls to std::chrono::steady_clock::now(); and computes the times and then calls write_timing . I think corresponding calls should be added to services/sample/standalone_gqs.hpp
- The reported timing could be, e.g. "Chain 1 Elapsed Time: 40.947 seconds (Generated Quantities)" (Compare to "(Warm-up)" and "(Sampling)" in
mcmc_writer.hpp
If these would be added to stan services, then CmdStan would automatically get these, and CmdStanR would be modified to read the appropriate line from CSV.
There is a CmdStanR issue stan-dev/cmdstanr#1070 reporting that when running
generated_quantitiestime is reported but it is always 0.0s. For example,but in one of my case studies, these times should be around 40s.
The problem is that the timing information has not been written to csv when using
generate_quantitiesin the same way as when usingsample.services/util/mcmc_writer.hpphaswrite_timingandlog_timingmethods, but these are missing fromservices/util/gq_writer.hpprun_adaptive_samplerinservices/util/run_adaptive_sampler.hpp(andrun_samplerinservices/util/run_sampler.hpp) has calls tostd::chrono::steady_clock::now();and computes the times and then callswrite_timing. I think corresponding calls should be added toservices/sample/standalone_gqs.hppmcmc_writer.hppIf these would be added to stan services, then CmdStan would automatically get these, and CmdStanR would be modified to read the appropriate line from CSV.