PROFASI  Version 1.5
Public Types | Public Member Functions | List of all members
prf_utils::Timer Class Reference

ProFASi's own timer for managing time limited runs. More...

#include <Timer.hh>

Public Types

enum  recommendation_type
 Timer recommendation type.
 

Public Member Functions

 Timer ()
 Default constructor.
 
void Start (unsigned long startpos=0)
 Start the stop-watch.
 
void Stop (unsigned long endpos=0)
 Stop the stop-watch.
 
void Reset ()
 Reset the stop-watch.
 
double Measurement ()
 Interval since the start or the last reset in seconds.
 
void PrintInterval ()
 Print interval between start and stop in hours, minutes, seconds etc.
 
void space_axis_name (std::string nam)
 A name for what is changing with time.
 
void set_new_goal (unsigned long newgoal)
 Set a new target to be reached.
 
void set_current_progress (unsigned long progr)
 Tell the timer how much progress has been made.
 
void have_endless_time ()
 Tell the timer that we have infinite time for the task.
 
void allocate_time (double dur)
 Tell the timer how much time is available for the task.
 
void flush_timing_data (const char *timefile)
 Write data about how much time was spent in different stages of the task.
 
void n_progress_reports (int ntpt)
 Set how often the timer should talk about the progress made, time left etc.
 
void record (unsigned long progr)
 Record progress at intervals of progress.
 
void forecast ()
 Calculate how much more time is needed for the job etc.
 
recommendation_type recommendation ()
 Ask the timer, if the application should continue or stop.
 
bool goal_reached ()
 Has the goal been reached ?
 
void abandon ()
 Tell the timer that we are not going any further.
 

Detailed Description

Meaningful simulations of interesting protein systems take a long time. Even with the simplified force field and optimized code of ProFASi, a run might require weeks of computing time. But on large computing facilities, there are limits to how long a single job can run, let's say 12 hours.

ProFASi's simulation programs, such as ParTempRun or SimTempRun make use of this timer class to cleanly suspend an on going run when the allocated time is about to finish. The runs are started with a certain amount of "available time", passed to the programs through the settings file or the command line arguments. The timer measures how fast the program is going about its task. It estimates how far it can go in the available time. If it estimates that it will not come back to the next "check point" (configuration save) before the allocated time is up and the run is killed by the system, it recommends that the simulation program "suspends".

Member Function Documentation

void prf_utils::Timer::abandon ( )
inline

Sometimes, although we expect it would take 1 billion MC cycles to do something, the simulation program might decide that enough is enough, and we have found a converged answer. It would then abandon the mission of reaching the 1 billion cycles. If it tells the timer that the mission is abandonned, the timer prints a more fitting closing message.

void prf_utils::Timer::forecast ( )

This function calculates, how much more time is needed for the job, and if the job can not be completed in the remaining available time, how much more work can be expected to be done in the remaining time.

void prf_utils::Timer::have_endless_time ( )
inline

If there is unlimited available time for the task, the timer does not calculate whether or not the job should be suspended. It merely reports how much longer the job might take, when asked.

void prf_utils::Timer::record ( unsigned long  progr)

At regular intervals during the execution of the task, this function should be called with a value indicating how much of the task has been accomplished. The timer has no way of knowing how many MC cycles have been finished or how many km have been travelled. But the application can every once in a while tell the timer what has happened. The timer will associate a time with that, and use the information to calculate what might happen in the remaining available time.

void prf_utils::Timer::space_axis_name ( std::string  nam)
inline

If we are going somewhere, we might estimate how far we have come and how much of the journey remains in kilometres. For an MC simulation, the progress is measured in MC cycles. This function puts a label on the space axis.


The documentation for this class was generated from the following files:

PROFASI: Protein Folding and Aggregation Simulator, Version 1.5
© (2005-2016) Anders Irbäck and Sandipan Mohanty
Documentation generated on Mon Jul 18 2016 using Doxygen version 1.8.2