15 #ifndef SST_CORE_MODEL_PYTHON
16 #define SST_CORE_MODEL_PYTHON
20 #ifdef SST_CONFIG_HAVE_PYTHON
27 #include <sst/core/model/sstmodel.h>
28 #include <sst/core/config.h>
29 #include <sst/core/rankInfo.h>
30 #include <sst/core/output.h>
39 SSTPythonModelDefinition(
const std::string script_file,
int verbosity,
Config* config,
int argc,
char **argv);
40 SSTPythonModelDefinition(
const std::string script_file,
int verbosity,
Config* config);
41 virtual ~SSTPythonModelDefinition();
46 void initModel(
const std::string script_file,
int verbosity,
Config* config,
int argc,
char** argv);
47 std::string scriptName;
51 std::map<std::string, std::string> cfgParams;
54 std::vector<size_t> nameStack;
55 std::map<std::string, ComponentId_t> compNameMap;
58 std::vector<std::string> statParamKeyArray;
59 std::vector<std::string> statParamValueArray;
62 Config* getConfig(
void)
const {
return config; }
63 std::map<std::string, std::string>& getParams(
void) {
return cfgParams; }
65 std::string getConfigString(
void)
const;
66 Output* getOutput()
const {
return output; }
67 ComponentId_t addComponent(
const char *name,
const char *type) {
69 compNameMap[std::string(name)] = id;
72 ComponentId_t findComponentByName(
const char *name)
const {
73 auto itr = compNameMap.find(name);
74 return ( itr != compNameMap.end() ) ? itr->second : UNSET_COMPONENT_ID;
76 void addParameter(ComponentId_t
id,
const char *name,
const char *value)
const { graph->
addParameter(
id, name, value,
true); }
78 void setComponentRank(ComponentId_t
id, uint32_t rank, uint32_t thread)
const { graph->
setComponentRank(
id,
RankInfo(rank, thread)); }
79 void setComponentWeight(ComponentId_t
id,
float weight)
const { graph->
setComponentWeight(
id, weight); }
80 void addLink(ComponentId_t
id,
const char *name,
const char *port,
const char *latency,
bool no_cut)
const {graph->
addLink(
id, name, port, latency, no_cut); }
82 void pushNamePrefix(
const char *name);
83 void popNamePrefix(
void);
84 char* addNamePrefix(
const char *name)
const;
90 void enableComponentStatistic(ComponentId_t compid,
const char* statname)
const { graph->
enableComponentStatistic(compid, statname); }
91 void enableStatisticForComponentName(
const char* compname,
const char* statname)
const { graph->enableStatisticForComponentName(compname, statname); }
92 void enableStatisticForComponentType(
const char* comptype,
const char* statname)
const { graph->enableStatisticForComponentType(comptype, statname); }
94 void addComponentStatisticParameter(ComponentId_t compid,
const char* statname,
const char* param,
const char* value) { graph->
addComponentStatisticParameter(compid, statname, param, value); }
95 void addStatisticParameterForComponentName(
const char* compname,
const char* statname,
const char* param,
const char* value) { graph->addStatisticParameterForComponentName(compname, statname, param, value); }
96 void addStatisticParameterForComponentType(
const char* comptype,
const char* statname,
const char* param,
const char* value) { graph->addStatisticParameterForComponentType(comptype, statname, param, value); }
Output object provides consistant method for outputing data to stdout, stderr and/or sst debug file...
Definition: output.h:54
void setStatisticLoadLevel(uint8_t loadLevel)
Set the statistic system load level.
Definition: configGraph.cc:312
Class to contain SST Simulation Configuration variables.
Definition: config.h:39
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:202
void setStatisticOutput(const char *name)
Set the statistic ouput module.
Definition: configGraph.cc:293
void addParameter(ComponentId_t comp_id, std::string key, std::string value, bool overwrite=false)
Add a single parameter to a component.
Definition: configGraph.cc:279
void addComponentStatisticParameter(ComponentId_t comp_id, std::string statisticName, const char *param, const char *value)
Add Parameters for a Statistic.
Definition: configGraph.cc:388
void addLink(ComponentId_t comp_id, std::string link_name, std::string port, std::string latency_str, bool no_cut=false)
Add a Link to a Component on a given Port.
Definition: configGraph.cc:436
ComponentId_t addComponent(std::string name, std::string type, float weight, RankInfo rank)
Create a new component with weight and rank.
Definition: configGraph.cc:244
Definition: rankInfo.h:21
void setComponentWeight(ComponentId_t comp_id, float weight)
Set the weight of a Component (partitioning)
Definition: configGraph.cc:264
void addStatisticOutputParameter(const char *param, const char *value)
Add parameter to the statistic output module.
Definition: configGraph.cc:305
void enableComponentStatistic(ComponentId_t comp_id, std::string statisticName)
Enable a Statistics assigned to a component.
Definition: configGraph.cc:318
Base class for Model Generation.
Definition: sstmodel.h:22
void setComponentRank(ComponentId_t comp_id, RankInfo rank)
Set on which rank a Component will exist (partitioning)
Definition: configGraph.cc:258