56 friend int ::main(
int argc,
char** argv);
57 friend class SSTModelDescription;
58 friend class Simulation;
69 void initialize(uint32_t num_ranks,
bool first_rank);
78 bool checkConfigFile();
83 bool setOptionFromModel(
const std::string& entryName,
const std::string& value);
124 SST_CONFIG_DECLARE_OPTION_NOVAR(usage, std::bind(&
Config::parseUsage,
this, std::placeholders::_1));
135 SST_CONFIG_DECLARE_OPTION_NOVAR(help, std::bind(&
Config::parseHelp,
this, std::placeholders::_1));
142 printf(
"SST-Core Version (" PACKAGE_VERSION);
143 if ( strcmp(SSTCORE_GIT_HEADSHA, PACKAGE_VERSION) != 0 ) {
144 printf(
", git branch : " SSTCORE_GIT_BRANCH);
145 printf(
", SHA: " SSTCORE_GIT_HEADSHA);
152 SST_CONFIG_DECLARE_OPTION_NOVAR(version, std::bind(&
Config::parseVersion, std::placeholders::_1));
159 uint32_t num_ranks_ = 1;
162 uint32_t num_ranks()
const {
return num_ranks_; }
171 SST_CONFIG_DECLARE_OPTION(uint32_t, num_threads, 1, &StandardConfigParsers::from_string<uint32_t>);
176 SST_CONFIG_DECLARE_OPTION(std::string, configFile,
"NONE", &StandardConfigParsers::from_string<std::string>);
181 SST_CONFIG_DECLARE_OPTION(std::string, model_options,
"",
182 std::bind(&StandardConfigParsers::append_string,
" \"",
"\"", std::placeholders::_1, std::placeholders::_2));
187 SST_CONFIG_DECLARE_OPTION(
int, print_timing, 0,
188 std::bind(&StandardConfigParsers::from_string_default<int>, std::placeholders::_1, std::placeholders::_2, 2));
193 SST_CONFIG_DECLARE_OPTION(std::string, stop_at,
"0ns", &StandardConfigParsers::from_string<std::string>);
198 SST_CONFIG_DECLARE_OPTION(uint32_t, exit_after, 0, &StandardConfigParsers::wall_time_to_seconds);
203 SST_CONFIG_DECLARE_OPTION(std::string, partitioner,
"sst.linear", &StandardConfigParsers::element_name);
208 SST_CONFIG_DECLARE_OPTION(uint32_t, heartbeat_wall_period, 0, &StandardConfigParsers::wall_time_to_seconds);
213 SST_CONFIG_DECLARE_OPTION(std::string, heartbeat_sim_period,
"",
214 std::bind(&StandardConfigParsers::check_unitalgebra_store_string,
"s, Hz", std::placeholders::_1,
215 std::placeholders::_2));
220 SST_CONFIG_DECLARE_OPTION(std::string, output_directory,
"", &StandardConfigParsers::from_string<std::string>);
225 SST_CONFIG_DECLARE_OPTION(
226 std::string, output_core_prefix,
"#@x SST Core: ", &StandardConfigParsers::from_string<std::string>);
235 SST_CONFIG_DECLARE_OPTION(std::string, output_config_graph,
"", &StandardConfigParsers::from_string<std::string>);
241 SST_CONFIG_DECLARE_OPTION(std::string, output_json,
"", &StandardConfigParsers::from_string<std::string>);
247 int parse_parallel_output(
bool& var, std::string arg)
249 if ( num_ranks_ == 1 )
return 0;
251 int ret_code = StandardConfigParsers::flag_default_true(var, arg);
252 if ( ret_code != 0 )
return ret_code;
256 if ( var ) output_partition_.value1 =
true;
260 SST_CONFIG_DECLARE_OPTION(
bool, parallel_output,
false,
261 std::bind(&Config::parse_parallel_output,
this, std::placeholders::_1, std::placeholders::_2));
271 SST_CONFIG_DECLARE_OPTION(std::string, output_dot,
"", &StandardConfigParsers::from_string<std::string>);
276 SST_CONFIG_DECLARE_OPTION(uint32_t, dot_verbosity, 0, &StandardConfigParsers::from_string<uint32_t>);
281 int parse_output_partition(
bool& output_part_flag, std::string& file_name, std::string arg)
284 output_part_flag =
true;
292 SST_CONFIG_DECLARE_OPTION_PAIR(
bool, output_partition,
false, std::string, component_partition_file,
"",
293 std::bind(&Config::parse_output_partition,
this, std::placeholders::_1, std::placeholders::_2,
294 std::placeholders::_3));
307 static std::string ext_help_timebase();
309 SST_CONFIG_DECLARE_OPTION(std::string, timeBase,
"1ps",
310 std::bind(&StandardConfigParsers::check_unitalgebra_store_string,
"s, Hz", std::placeholders::_1,
311 std::placeholders::_2),
312 &Config::ext_help_timebase);
333 int parse_parallel_load(
bool& parallel_load,
bool& parallel_load_mode_multi, std::string arg)
336 if ( num_ranks_ == 1 )
return 0;
339 parallel_load =
true;
343 std::string arg_lower(arg);
345 for (
auto& ch : arg_lower )
346 ch = std::tolower(ch, loc);
348 if ( arg_lower ==
"none" ) {
349 parallel_load =
false;
353 parallel_load =
true;
355 if ( arg_lower ==
"single" )
356 parallel_load_mode_multi =
false;
357 else if ( arg_lower ==
"multi" )
358 parallel_load_mode_multi =
true;
361 "Invalid option '%s' passed to --parallel-load. Valid options are NONE, SINGLE and MULTI.\n",
369 std::string parallel_load_str()
const
371 if ( !parallel_load_.value1 )
return "NONE";
372 if ( parallel_load_.value2 )
return "MULTI";
378 SST_CONFIG_DECLARE_OPTION_PAIR(
bool, parallel_load,
false,
bool, parallel_load_mode_multi,
true,
380 &Config::parse_parallel_load,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
385 SST_CONFIG_DECLARE_OPTION(
386 std::string, timeVortex,
"sst.timevortex.priority_queue", &StandardConfigParsers::from_string<std::string>);
391 SST_CONFIG_DECLARE_OPTION(
bool, interthread_links,
false, &StandardConfigParsers::flag_default_true);
399 SST_CONFIG_DECLARE_OPTION(
bool, cache_align_mempools,
false, &StandardConfigParsers::flag_default_true);
404 SST_CONFIG_DECLARE_OPTION(std::string, debugFile,
"/dev/null", &StandardConfigParsers::from_string<std::string>);
426 static std::string ext_help_enable_python_coverage();
428 SST_CONFIG_DECLARE_OPTION(
bool, enable_python_coverage,
false, &StandardConfigParsers::flag_set_true,
429 &Config::ext_help_enable_python_coverage);
437 static std::string ext_help_enable_profiling();
439 SST_CONFIG_DECLARE_OPTION(std::string, enabled_profiling,
"",
440 std::bind(&StandardConfigParsers::append_string,
";",
"", std::placeholders::_1, std::placeholders::_2),
441 &Config::ext_help_enable_profiling);
446 SST_CONFIG_DECLARE_OPTION(
447 std::string, profiling_output,
"stdout", &StandardConfigParsers::from_string<std::string>);
457 static int parseRunMode(SimulationRunMode& val, std::string arg)
459 if ( !arg.compare(
"init") )
460 val = SimulationRunMode::INIT;
461 else if ( !arg.compare(
"run") )
462 val = SimulationRunMode::RUN;
463 else if ( !arg.compare(
"both") )
464 val = SimulationRunMode::BOTH;
466 fprintf(stderr,
"Unknown option for --run-mode: %s\n", arg.c_str());
467 val = SimulationRunMode::UNKNOWN;
470 return val != SimulationRunMode::UNKNOWN ? 0 : -1;
473 SST_CONFIG_DECLARE_OPTION(SimulationRunMode, runMode, SimulationRunMode::BOTH, &Config::parseRunMode);
481 switch ( runMode_ ) {
482 case SimulationRunMode::INIT:
484 case SimulationRunMode::RUN:
486 case SimulationRunMode::BOTH:
488 case SimulationRunMode::UNKNOWN:
499 SST_CONFIG_DECLARE_OPTION(std::string, interactive_console,
"", &StandardConfigParsers::from_string<std::string>);
504 SST_CONFIG_DECLARE_OPTION(std::string, interactive_start_time,
"",
505 std::bind(&StandardConfigParsers::from_string_default<std::string>, std::placeholders::_1,
506 std::placeholders::_2,
"0"));
511 SST_CONFIG_DECLARE_OPTION(std::string, replay_file,
"", &StandardConfigParsers::from_string<std::string>);
521 SST_CONFIG_DECLARE_OPTION(std::string, event_dump_file,
"", &StandardConfigParsers::from_string<std::string>);
528 SST_CONFIG_DECLARE_OPTION(
bool, rank_seq_startup,
false, &StandardConfigParsers::flag_set_true);
551 SST_CONFIG_DECLARE_OPTION(
bool, enable_sig_handling,
true, &StandardConfigParsers::flag_set_false);
556 static std::string ext_help_signals();
558 SST_CONFIG_DECLARE_OPTION(std::string, sigusr1,
"sst.rt.status.core",
559 &StandardConfigParsers::from_string<std::string>, Config::ext_help_signals);
564 SST_CONFIG_DECLARE_OPTION(std::string, sigusr2,
"sst.rt.status.all",
565 &StandardConfigParsers::from_string<std::string>, Config::ext_help_signals);
570 SST_CONFIG_DECLARE_OPTION(std::string, sigalrm,
"",
571 std::bind(&StandardConfigParsers::append_string,
";",
"", std::placeholders::_1, std::placeholders::_2),
572 Config::ext_help_signals);
580 SST_CONFIG_DECLARE_OPTION(
bool, checkpoint_enable, 0, &StandardConfigParsers::flag_set_true);
585 SST_CONFIG_DECLARE_OPTION(uint32_t, checkpoint_wall_period, 0, &StandardConfigParsers::wall_time_to_seconds);
590 SST_CONFIG_DECLARE_OPTION(std::string, checkpoint_sim_period,
"",
591 std::bind(&StandardConfigParsers::check_unitalgebra_store_string,
"s, Hz", std::placeholders::_1,
592 std::placeholders::_2));
597 SST_CONFIG_DECLARE_OPTION(
bool, load_from_checkpoint,
false, &StandardConfigParsers::flag_set_true);
602 static std::string ext_help_checkpoint_prefix();
604 SST_CONFIG_DECLARE_OPTION(std::string, checkpoint_prefix,
"checkpoint", &StandardConfigParsers::nonempty_string,
605 &Config::ext_help_checkpoint_prefix);
610 static int parse_checkpoint_name_format(std::string& var, std::string arg);
612 static std::string ext_help_checkpoint_format();
614 SST_CONFIG_DECLARE_OPTION(std::string, checkpoint_name_format,
"%p_%n_%t/%p_%n_%t",
615 std::bind(&Config::parse_checkpoint_name_format, std::placeholders::_1, std::placeholders::_2),
616 &Config::ext_help_checkpoint_format);
629 void merge_checkpoint_options(
Config& other);
638 int positionalCallback(
int num,
const std::string& arg);
643 std::string run_name;
644 bool first_rank_ =
false;
648 void insertOptions();
650 bool isFileNameOnly(
const std::string& name)
652 bool nameOnly =
true;
654 for (
size_t i = 0; i < name.size(); ++i ) {
655 if (
'/' == name[i] ) {