I’m running some benchmarking cases and trying to get sense of how MIPPS vary over the initial N iterations of the simulations. It seems like the commonwriter is what triggers the console output with all the statistics, but is there any functionality in the code to display all this information without actually writing anything out ever?
Hello @rschanta,
indeed, the summary including MIPPS information is only printed out when writing. If writing is disabled, then we do not show the summary information until the end.
The simplest way to get the information you want without making changes to GPUSPH would be to look into the info stream that each running GPUSPH process publishes, which on Linux should be called something like /dev/shm/GPUSPH-pid where pid is the process ID (this, by the way, is the information shown by scripts/running-gpusph).
So one way to watch how the MIPPS change over time would be to do some kind of loop like:
towatch=/dev/shm/GPUSPH-$(pidof DamBreak3D)
while [ -e "$towach" ] ; do
cat "$towatch"
sleep 10
done
which would show the current status summary every 10 seconds. Of course, replace the test case name argument of pidof with your own ![]()
The limitation of this approach is that your sampling rate is determined by the wall clock rather than number of iterations of the model. If you wish to get sampling information at regular intervals, (like every k iterations), then we’ll need to add a new command-line option which we could call e.g. --status-every that would take as argument an integer, and do a printStatus() with the given period.
if you want to try your hand at this, it should be relatively straightforward, although it may need touching of multiple files.
Command-line values are in src/Options.h: you’ll need to add a new public member to the list, and its default value (which would be 0 in this case) in the constructor.
Command-line processing is done in src/main.cc (remember to also updated print_usage() and the list of command-line options in docs/user-guide.adoc under the Debugging options:: group (should be aroud line 314 of the file). There’s a huge switch in parse_options() in which you should add a check for the given option and store its value in _clOptions.
Finally, in src/GPUSPH.cc find the check_write() member function: you’ll see here that there’s a split logic here:
- if the
--debug benchmark_onlyoption is enabled, then we skip the whole function altogether, and only print the status if this is the lastcheck_writeof the simulation (we_are_doneflag); - otherwise, we do the usual pre-write post-processing and invoke the writers that should be called at this time; only if we do some actual writing, and we aren’t writing at every timestep, and this is not a forced write (invoked by sending
SIGUSR1to the process) we do theprintStatus().
I think that you may wanto change the login in both places:
- in the benchmark-only case, do a printStatus() also if if the
status_everycommand-line option is nonzero and the current iteration is a multiple of it; - same, in the regular writing case, if we didn’t call
printStatus()by the regular logic.
Let me know if you need further assistance in implementing this. When you’re satisfied with the result, I’d like to integrate this feature upstream, since it’s a nice complement to the existing debugging and benchmarking options.