Changes between Version 18 and Version 19 of BasicApi


Ignore:
Timestamp:
Jan 8, 2009, 11:00:12 AM (15 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BasicApi

    v18 v19  
    9494
    9595`boinc_time_to_checkpoint()` is fast, so it can be called frequently (hundreds or thousands of times a second).
     96
     97If you're using replication, make sure your application generates the same results
     98regardless of where and how often it restarts.
     99This requires:
     100 * In writing the checkpoint file, use conversion codes that don't lose precision; e.g., use %e for doubles.
     101 * If your app uses random numbers, save and restore the state of the RNG.  You can do this by surrounding every boinc_time_to_checkpoint() with the following:
     102{{{
     103int x = rand();
     104if (boinc_time_to_checkpoint()) {
     105   ...
     106}
     107srand(x);
     108}}}
     109Write x to the checkpoint file,
     110and do a srand(x) when restarting from a checkpoint.
    96111
    97112== Critical sections ==