Skip to content

Checkpoint in freeze only#2107

Open
sharmeye wants to merge 35 commits into
masterfrom
Checkpoint_in_freeze_only
Open

Checkpoint in freeze only#2107
sharmeye wants to merge 35 commits into
masterfrom
Checkpoint_in_freeze_only

Conversation

@sharmeye

Copy link
Copy Markdown
Contributor

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

Mrockwell2 and others added 28 commits March 28, 2024 15:38
- Also marked a section for a more detailed revision in a few days
@brendan-nasa

Copy link
Copy Markdown
Contributor

this MR adds a circular dependency: Executive <=> CheckPointRestart

@coveralls

coveralls commented Apr 29, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 57.337% (+0.4%) from 56.928% — Checkpoint_in_freeze_only into master

checkpoint( chk_name_stream.str() );
checkpoint( file_name );

the_exec->run();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this unfreezes after checkpoint even when it wasn't an auto-freeze

also: indentation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@hchen99

hchen99 commented May 27, 2026

Copy link
Copy Markdown
Contributor

this MR adds a circular dependency: Executive <=> CheckPointRestart

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Comment on lines +363 to +367
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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many parameters for the format string

Comment thread trick_source/sim_services/Executive/Executive_freeze_loop.cpp Outdated
Comment thread trick_source/sim_services/CheckPointRestart/CheckPointRestart.cpp Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants