Checkpoint in freeze only#2107
Conversation
…oints-in-freeze-mode
- Also marked a section for a more detailed revision in a few days
|
this MR adds a circular dependency: |
…f not in freeze mode for checkpoint.
| checkpoint( chk_name_stream.str() ); | ||
| checkpoint( file_name ); | ||
|
|
||
| the_exec->run(); |
There was a problem hiding this comment.
i think this unfreezes after checkpoint even when it wasn't an auto-freeze
also: indentation
There was a problem hiding this comment.
In this branch, only scheduled checkpoint such as calling checkpoint(time, ... ) sets freeze at the specified time, then freeze_loop calls write_checkpoint at the scheduled time which sets to Run back at end. So it's safe.
When calling checkpoint without a time (not scheduled):
- If in Freeze, doesn't go through the route as stated above
- If not in Freeze, warning and no checkpoint done
The auto_freeze flag is only used for checkpoint loading. And we'll discuss if we want to only allow loading when in Freeze mode. This branch uses auto_freeze flag to unfreeze when loading is called in Run mode.
There was a problem hiding this comment.
However though, if input file has both schedule freeze and checkpoint for the same time, after checkpoint, it'd go to unfreeze automatically which might not be as expected. So needs to check if there is scheduled freeze before unfreeze.
It doesn't look like there is circular a dependency at the header/interface level even though CheckPointRestart.cpp includes Executive.hh and Executive_freeze_loop.cpp includes CheckPointRestart.hh. Each .cpp compiles independently with no include cycle and both compile into the same libtrick.a. |
|
|
||
| mode = the_exec->get_mode(); | ||
|
|
||
| if (mode == Run) { |
There was a problem hiding this comment.
Should it be mode != Freeze, otherwise if in Initialization mode, can still do checkpoint?
…otherwise warning also doesn't resume sim if there is a scheduled freeze for the same time.
| std::string msg_format = "WARNING: Loading a checkpoint in 'Run Mode' may cause non time-homogeneous data. "; | ||
| msg_format += "Current Mode: %s (%d)\n"; | ||
|
|
||
| message_publish(MSG_WARNING, msg_format.c_str(), | ||
| file_name.c_str(), simModeCharString(mode), mode); |
There was a problem hiding this comment.
too many parameters for the format string
Implement constraint to allow checkpoints only in freeze mode to preserve homogeneity of data. Also implementing auto-freezing and auto-unfreezing the simulation when a checkpoint is attempted in RUN mode. Credit to @Mrockwell2