Skip to content

Commit 34dc726

Browse files
committed
Add checkpoint-enable flag to enable checkpointing in interactive console. Make sst.rt.simpledebug the default for interactive console and only use --interactive-console to specify a custom IC.
1 parent 79f05f9 commit 34dc726

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

src/sst/core/config.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ Config::insertOptions()
522522
DEF_SECTION_HEADING("Advanced Options - Debug");
523523
DEF_ARG("run-mode", 0, "MODE", "Set run mode [ init | run | both (default)]", runMode_, true, false, true);
524524
DEF_ARG("interactive-console", 0, "ACTION",
525-
"[EXPERIMENTAL] Set console to use for interactive mode. NOTE: This currently only works for serial jobs and "
526-
"this option will be ignored for parallel runs.",
525+
"[EXPERIMENTAL] Set console to use for interactive mode (overrides default console: sst.interactive.simpledebug). "
526+
"NOTE: This currently only works for serial jobs and will be ignored for parallel runs.",
527527
interactive_console_, true, false, false);
528528
DEF_ARG_OPTVAL("interactive-start", 0, "TIME",
529529
"[EXPERIMENTAL] Drop into interactive mode at specified simulated time. If no time is specified, or the time "
@@ -560,6 +560,10 @@ Config::insertOptions()
560560

561561
/* Advanced Features - Checkpoint */
562562
DEF_SECTION_HEADING("Advanced Options - Checkpointing (EXPERIMENTAL)");
563+
DEF_FLAG("checkpoint-enable", 0,
564+
"Allows checkpoints to be triggered from the interactive debug console. "
565+
"This option is not needed if checkpoint-wall-period, checkpoint-period, or checkpoint-sim-period are used.",
566+
checkpoint_enable_, false, false, false);
563567
DEF_ARG("checkpoint-wall-period", 0, "PERIOD",
564568
"Set approximate frequency for checkpoints to be generated in terms of wall (real) time. PERIOD can be "
565569
"specified in hours, minutes, and seconds with "
@@ -649,6 +653,7 @@ Config::setOptionFromModel(const std::string& entryName, const std::string& valu
649653
bool
650654
Config::canInitiateCheckpoint()
651655
{
656+
if (checkpoint_enable_.value == true) return true;
652657
if ( checkpoint_wall_period_.value != 0 ) return true;
653658
if ( checkpoint_sim_period_.value != "" ) return true;
654659
return false;

src/sst/core/config.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,11 @@ class Config : public ConfigShared, public SST::Core::Serialization::serializabl
579579

580580
/**** Advanced options - Checkpointing ****/
581581

582+
/**
583+
* Enable checkpointing for interactive debug
584+
*/
585+
SST_CONFIG_DECLARE_OPTION(bool, checkpoint_enable, 0, &StandardConfigParsers::flag_set_true);
586+
582587
/**
583588
* Interval at which to create a checkpoint in wall time
584589
*/

src/sst/core/impl/interactive/simpleDebug.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// #include "simpleDebug.h"
1313
#include "sst_config.h"
1414

15+
#include "sst/core/simulation_impl.h"
16+
1517
#include "sst/core/impl/interactive/simpleDebug.h"
1618

1719
#include "sst/core/baseComponent.h"
@@ -122,6 +124,7 @@ SimpleDebugger::SimpleDebugger(Params& params) :
122124
"when triggered\n"
123125
"\tAvailable actions include: \n"
124126
"\t interactive, printTrace, checkpoint, set <var> <val>, printStatus, or shutdown\n"
127+
"\t Note: checkpoint action must be enabled at startup via the '--checkpoint-enable' command line option\n"
125128
"\tExample: trace var1 > 90 || var2 == 100 : 32 4 : size count state : printTrace" },
126129
{ "watchlist", "prints the current list of watchpoints and their associated indices" },
127130
{ "addtracevar", "<watchpointIndex> <var1> ... <varN> : adds the specified variables to the specified "
@@ -1035,6 +1038,10 @@ parseAction(std::vector<std::string>& tokens, size_t& index, Core::Serialization
10351038
return new WatchPoint::PrintTraceWPAction();
10361039
}
10371040
else if ( action == "checkpoint" ) {
1041+
if (Simulation_impl::getSimulation()->checkpoint_directory_ == "") {
1042+
std::cout << "Invalid action: checkpointing not enabled (use --checkpoint-enable cmd line option)\n";
1043+
return nullptr;
1044+
}
10381045
return new WatchPoint::CheckpointWPAction();
10391046
}
10401047
else if ( action == "printStatus" ) {

src/sst/core/realtime.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class InteractiveRealTimeAction : public RealTimeAction
126126
InteractiveRealTimeAction();
127127
void execute() override;
128128
bool isValidSigalrmAction() override { return false; }
129+
bool canInitiateCheckpoint() override { return true; }
129130
};
130131

131132
/* Wrapper for RealTimeActions that occur on a time interval */

src/sst/core/simulation.cc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -940,11 +940,18 @@ Simulation_impl::run()
940940

941941
// Setup interactive mode (only in serial jobs for now)
942942
if ( num_ranks.rank == 1 && num_ranks.thread == 1 ) {
943-
if ( interactive_type_ != "" ) {
943+
if ( interactive_type_ != "" ) {
944+
// --interactive-console used to override default
944945
initialize_interactive_console(interactive_type_);
945946
}
946-
if ( interactive_start_ != "" ) {
947-
if ( nullptr == interactive_ ) {
947+
else if ((interactive_start_ != "") || (config.sigusr1() == "sst.rt.interactive") || (config.sigusr2() == "sst.rt.interactive")) {
948+
// use default interactive console
949+
interactive_type_ = "sst.interactive.simpledebug";
950+
initialize_interactive_console(interactive_type_);
951+
}
952+
953+
if ( interactive_start_ != "" ) {
954+
if ( nullptr == interactive_ ) { // Should never get here
948955
sim_output.fatal(CALL_INFO, 1,
949956
"ERROR: Specified --interactive-start, but did not specify --interactive-mode to set the "
950957
"interactive action that should be used.\n");

src/sst/core/watchPoint.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ WatchPoint::getCurrentSimCycle()
4949
void
5050
WatchPoint::setCheckpoint()
5151
{
52-
Simulation_impl::getSimulation()->scheduleCheckpoint();
52+
if (Simulation_impl::getSimulation()->checkpoint_directory_ == "") {
53+
std::cout << "Invalid action: checkpointing not enabled (use --checkpoint-enable cmd line option)\n";
54+
}
55+
else {
56+
Simulation_impl::getSimulation()->scheduleCheckpoint();
57+
}
5358
}
5459

5560
void

0 commit comments

Comments
 (0)