Skip to content

Commit 2944a01

Browse files
author
Kenneth Griesser
committed
Latest TCL code for interactive console.
Major Changes: - config.h, config.cc Add support for interactive realtime action, sst.rt.interactive (#1266) Add checkpoint-enable flag to enable checkpointing in interactive console. Make sst.interactive.simpledebug the default for interactive console and only use --interactive-console to specify a custom IC File replay option ( --replay ) - from_string.h: Full precision printing of float types. Scientific notation when value is greated than 10**6 or less than 10**-6 - impl/interactive/Makefile.inc Included cmdLineEditor files for build - impl/interactive/cmdLineEditor.h, impl/interactive/cmdLineEditor.cc In-line command editing support - impl/interactive/simpleDebug.h, impl/interactive/simpleDebug.cc Shutdown support (#1311) Watchpoint support Add checkpoint-enabled flag to enable in interactive console. Make sst.rtl.simpledebug the default of interactive console. Only use --interactive-console to specify custom IC. Allow for empty command and other minor whitespace annoyances. Console command logging and replay. Support commented lines for replay scripts. Consolidated commands into a command funtion table. Standardized specifying commands, help text, and command groups Provided auto-completion support for commands and object names Various nullptr checks and fixes to avoid segmentation faults. - interactiveConsole.h Add support for shutdown (#1311) - serialization/objectMap.cc, serialization/objectMap.h Support for trace buffers and watchpoint actions Circular buffer and trigger recording Add ability to check/sample before and after both clock and event handlers. Watchpoint support for adding set var val action. Extended trigger tests functionality: support for logic operators (e.g. v1 < 10 && v2 > 5) and comparisons between two variables Support for trigger comparison between two variables. All set string to handle spaces. watchpoint verbosity control Various bug fixes for command line editing Fixes for nullptr checks and address sanitizer issues causing seg faults. - simulation.cc Interactive console realtime action (#1266) Addition of checkpoint-enable flag to enable checkpoint in IC. Make sst.interactive.simpledebug the default for IC replay option for IC - watchPoint.h, watchPoint.cc Circular buffer, trigger record. Add ability to check/sample before and after both clock and event handlers Add watchpoint action class and add set var val action Add support for trigger comparison between two variables Update watchpoint handling Allow set string to handle spaces Add shutdown as trigger action Add watchpoint index to watchpoint class Add checkpoint-enable flag to enable checkpointing in interactive console. Make sst.interactive.simpledebug the default for interactive console. Only use --interactive-console to specify a custom IC. watchpoint verbosity control
1 parent 00c65bd commit 2944a01

File tree

16 files changed

+3472
-196
lines changed

16 files changed

+3472
-196
lines changed

src/sst/core/config.cc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -526,16 +526,18 @@ Config::insertOptions()
526526
DEF_SECTION_HEADING("Advanced Options - Debug");
527527
DEF_ARG("run-mode", 0, "MODE", "Set run mode [ init | run | both (default)]", runMode_, true, false, true);
528528
DEF_ARG("interactive-console", 0, "ACTION",
529-
"[EXPERIMENTAL] Set console to use for interactive mode. NOTE: This currently only works for serial jobs and "
530-
"this option will be ignored for parallel runs.",
529+
"[EXPERIMENTAL] Set console to use for interactive mode (overrides default console: "
530+
"sst.interactive.simpledebug). "
531+
"NOTE: This currently only works for serial jobs and will be ignored for parallel runs.",
531532
interactive_console_, true, false, false);
532533
DEF_ARG_OPTVAL("interactive-start", 0, "TIME",
533534
"[EXPERIMENTAL] Drop into interactive mode at specified simulated time. If no time is specified, or the time "
534-
"is 0, then it will "
535-
"drop into interactive mode before any events are processed in the main run loop. This option is ignored if no "
536-
"interactive console was set. NOTE: This currently only works for serial jobs and this option will be ignored "
535+
"is 0, then it will drop into interactive mode before any events are processed in the main run loop. "
536+
"NOTE: This currently only works for serial jobs and this option will be ignored "
537537
"for parallel runs.",
538538
interactive_start_time_, true, false, false);
539+
DEF_ARG("replay-file", 0, "FILE", "Specify file for replaying an interactive debug console session.", replay_file_,
540+
false);
539541
#ifdef USE_MEMPOOL
540542
DEF_ARG("output-undeleted-events", 0, "FILE",
541543
"file to write information about all undeleted events at the end of simulation (STDOUT and STDERR can be used "
@@ -561,6 +563,10 @@ Config::insertOptions()
561563

562564
/* Advanced Features - Checkpoint */
563565
DEF_SECTION_HEADING("Advanced Options - Checkpointing (EXPERIMENTAL)");
566+
DEF_FLAG("checkpoint-enable", 0,
567+
"Allows checkpoints to be triggered from the interactive debug console. "
568+
"This option is not needed if checkpoint-wall-period, checkpoint-period, or checkpoint-sim-period are used.",
569+
checkpoint_enable_, false, false, false);
564570
DEF_ARG("checkpoint-wall-period", 0, "PERIOD",
565571
"Set approximate frequency for checkpoints to be generated in terms of wall (real) time. PERIOD can be "
566572
"specified in hours, minutes, and seconds with "
@@ -651,6 +657,7 @@ Config::setOptionFromModel(const std::string& entryName, const std::string& valu
651657
bool
652658
Config::canInitiateCheckpoint()
653659
{
660+
if ( checkpoint_enable_.value == true ) return true;
654661
if ( checkpoint_wall_period_.value != 0 ) return true;
655662
if ( checkpoint_sim_period_.value != "" ) return true;
656663
return false;

src/sst/core/config.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,10 @@ class Config : public ConfigShared, public SST::Core::Serialization::serializabl
512512
std::bind(&StandardConfigParsers::from_string_default<std::string>, std::placeholders::_1,
513513
std::placeholders::_2, "0"));
514514

515+
/**
516+
File to replay an interactive console script
517+
*/
518+
SST_CONFIG_DECLARE_OPTION(std::string, replay_file, "", &StandardConfigParsers::from_string<std::string>);
515519

516520
#ifdef USE_MEMPOOL
517521
/**
@@ -577,6 +581,11 @@ class Config : public ConfigShared, public SST::Core::Serialization::serializabl
577581

578582
/**** Advanced options - Checkpointing ****/
579583

584+
/**
585+
* Enable checkpointing for interactive debug
586+
*/
587+
SST_CONFIG_DECLARE_OPTION(bool, checkpoint_enable, 0, &StandardConfigParsers::flag_set_true);
588+
580589
/**
581590
* Interval at which to create a checkpoint in wall time
582591
*/

src/sst/core/from_string.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#ifndef SST_CORE_FROM_STRING_H
1313
#define SST_CORE_FROM_STRING_H
1414

15+
#include <iomanip>
16+
#include <limits>
17+
#include <sstream>
1518
#include <stdexcept>
1619
#include <string>
1720
#include <type_traits>
@@ -107,7 +110,16 @@ template <class T>
107110
std::enable_if_t<!std::is_enum_v<T>, std::string>
108111
to_string(const T& input)
109112
{
110-
if constexpr ( std::is_arithmetic_v<T> )
113+
if constexpr ( std::is_floating_point_v<T> ) {
114+
std::stringstream s;
115+
T abs_val = input < 0 ? -input : input;
116+
if ( abs_val > (T)10e6 || abs_val < (T)10e-6 )
117+
s << std::scientific << std::setprecision(std::numeric_limits<double>::max_digits10) << input;
118+
else
119+
s << std::fixed << std::setprecision(std::numeric_limits<double>::max_digits10) << input;
120+
return s.str().c_str();
121+
}
122+
else if constexpr ( std::is_arithmetic_v<T> )
111123
return std::to_string(input);
112124
else
113125
return typeid(T).name(); // For now, return a string if the type isn't handled elsewhere

src/sst/core/impl/interactive/Makefile.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55

66
sst_core_sources += \
77
impl/interactive/simpleDebug.cc \
8-
impl/interactive/simpleDebug.h
8+
impl/interactive/simpleDebug.h \
9+
impl/interactive/cmdLineEditor.cc \
10+
impl/interactive/cmdLineEditor.h
911

0 commit comments

Comments
 (0)