14 #ifndef SST_CORE_MODEL_PYTHON_PYMODEL_H
15 #define SST_CORE_MODEL_PYTHON_PYMODEL_H
21 #include "sst/core/config.h"
22 #include "sst/core/configGraph.h"
23 #include "sst/core/model/sstmodel.h"
24 #include "sst/core/output.h"
25 #include "sst/core/rankInfo.h"
26 #include "sst/core/warnmacros.h"
28 DISABLE_WARN_DEPRECATED_REGISTER
44 SST_ELI_REGISTER_MODEL_DESCRIPTION(
48 SST_ELI_ELEMENT_VERSION(1,0,0),
49 "Python model for building SST simulation graphs",
52 SST_ELI_DOCUMENT_MODEL_SUPPORTED_EXTENSIONS(
".py")
63 void initModel(
const std::string& script_file,
int verbosity,
Config* config,
int argc,
char** argv);
64 std::string scriptName;
70 std::vector<size_t> nameStack;
71 std::map<std::string, ComponentId_t> compNameMap;
72 ComponentId_t nextComponentId;
74 bool callPythonFinalize;
77 Config* getConfig(
void)
const {
return config; }
79 bool setConfigEntryFromModel(
const std::string& entryName,
const std::string& value)
86 Output* getOutput()
const {
return output; }
88 ComponentId_t getNextComponentId() {
return nextComponentId++; }
90 ComponentId_t addComponent(
const char* name,
const char* type)
98 return graph->findComponentByName(std::string(name));
103 void addLink(ComponentId_t
id,
const char* link_name,
const char* port,
const char* latency,
bool no_cut)
const
105 graph->
addLink(
id, link_name, port, latency, no_cut);
107 void setLinkNoCut(
const char* link_name)
const { graph->
setLinkNoCut(link_name); }
109 void pushNamePrefix(
const char* name);
110 void popNamePrefix(
void);
111 char* addNamePrefix(
const char* name)
const;
114 void addStatisticOutputParameter(
const std::string& param,
const std::string& value)
120 void addGlobalParameter(
const char* set,
const char* key,
const char* value,
bool overwrite)
128 void setCallPythonFinalize(
bool state) { callPythonFinalize = state; }
137 SST_ELI_REGISTER_MODEL_DESCRIPTION(
141 SST_ELI_ELEMENT_VERSION(1,0,0),
142 "XML model for building SST simulation graphs",
145 SST_ELI_DOCUMENT_MODEL_SUPPORTED_EXTENSIONS(
".xml",
".sdl")
165 SSTPythonModelDefinition* actual_model_;
168 std::map<std::string, std::string> generateStatisticParameters(PyObject* statParamDict);
169 SST::Params pythonToCppParams(PyObject* statParamDict);
170 PyObject* buildStatisticObject(StatisticId_t
id);
172 buildEnabledStatistic(
ConfigComponent* cc,
const char* statName, PyObject* statParamDict,
bool apply_to_children);
173 PyObject* buildEnabledStatistics(
ConfigComponent* cc, PyObject* statList, PyObject* paramDict,
bool apply_to_children);
Represents the configuration of a generic component.
Definition: configGraph.h:218
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:390
void setStatisticLoadLevel(uint8_t loadLevel)
Set the statistic system load level.
Definition: configGraph.cc:815
ComponentId_t addComponent(const std::string &name, const std::string &type)
Create a new component.
Definition: configGraph.cc:776
void setLinkNoCut(const std::string &link_name)
Set a Link to be no-cut.
Definition: configGraph.cc:866
void addStatisticOutputParameter(const std::string ¶m, const std::string &value)
Add parameter to the statistic output module.
Definition: configGraph.cc:809
void addLink(ComponentId_t comp_id, const std::string &link_name, const std::string &port, const std::string &latency_str, bool no_cut=false)
Add a Link to a Component on a given Port.
Definition: configGraph.cc:821
ConfigComponentMap_t & getComponentMap()
Return the map of components.
Definition: configGraph.h:465
void setStatisticOutput(const std::string &name)
Set the statistic output module.
Definition: configGraph.cc:797
Class to contain SST Simulation Configuration variables.
Definition: config.h:39
ConfigGraph * createConfigGraph() override
Create the ConfigGraph.
Definition: pymodel.cc:1180
Definition: pymodel.h:135
ConfigGraph * createConfigGraph() override
Create the ConfigGraph.
Definition: pymodel.h:160
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition: output.h:52
Parameter store.
Definition: params.h:56
Base class for Model Generation.
Definition: sstmodel.h:26
void setModelOptions(const std::string &options)
Sets the model options field of the Config object.
Definition: sstmodel.cc:33
void insertGlobalParameter(const std::string &set, const Params::key_type &key, const Params::key_type &value, bool overwrite=true)
Allows ModelDefinition to set global parameters.
Definition: sstmodel.cc:39
bool setOptionFromModel(const std::string &entryName, const std::string &value)
Set a configuration string to update configuration values.
Definition: sstmodel.cc:27
Performs Unit math in full precision.
Definition: unitAlgebra.h:109