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;
76 Config* getConfig(
void)
const {
return config; }
78 bool setConfigEntryFromModel(
const std::string& entryName,
const std::string& value)
80 return setOptionFromModel(entryName, value);
85 Output* getOutput()
const {
return output; }
87 ComponentId_t getNextComponentId() {
return nextComponentId++; }
89 ComponentId_t addComponent(
const char* name,
const char* type)
91 auto id = graph->addComponent(name, type);
97 return graph->findComponentByName(std::string(name));
102 void addLink(ComponentId_t
id,
const char* link_name,
const char* port,
const char* latency,
bool no_cut)
const
104 graph->addLink(
id, link_name, port, latency, no_cut);
106 void setLinkNoCut(
const char* link_name)
const { graph->setLinkNoCut(link_name); }
108 void pushNamePrefix(
const char* name);
109 void popNamePrefix(
void);
110 char* addNamePrefix(
const char* name)
const;
112 void setStatisticOutput(
const char* Name) { graph->setStatisticOutput(Name); }
113 void addStatisticOutputParameter(
const std::string& param,
const std::string& value)
115 graph->addStatisticOutputParameter(param, value);
117 void setStatisticLoadLevel(uint8_t loadLevel) { graph->setStatisticLoadLevel(loadLevel); }
119 void addGlobalParameter(
const char* set,
const char* key,
const char* value,
bool overwrite)
121 insertGlobalParameter(set, key, value, overwrite);
134 SST_ELI_REGISTER_MODEL_DESCRIPTION(
138 SST_ELI_ELEMENT_VERSION(1,0,0),
139 "XML model for building SST simulation graphs",
142 SST_ELI_DOCUMENT_MODEL_SUPPORTED_EXTENSIONS(
".xml",
".sdl")
151 setModelOptions(script_file);
162 SSTPythonModelDefinition* actual_model_;
165 std::map<std::string, std::string> generateStatisticParameters(PyObject* statParamDict);
166 SST::Params pythonToCppParams(PyObject* statParamDict);
167 PyObject* buildStatisticObject(StatisticId_t
id);
169 buildEnabledStatistic(
ConfigComponent* cc,
const char* statName, PyObject* statParamDict,
bool apply_to_children);
170 PyObject* buildEnabledStatistics(
ConfigComponent* cc, PyObject* statList, PyObject* paramDict,
bool apply_to_children);
175 #endif // SST_CORE_MODEL_PYTHON_PYMODEL_H
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:51
Class to contain SST Simulation Configuration variables.
Definition: config.h:29
Represents the configuration of a generic component.
Definition: configGraph.h:217
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:389
Definition: pymodel.h:131
ConfigGraph * createConfigGraph() override
Create the ConfigGraph.
Definition: pymodel.h:157
Parameter store.
Definition: params.h:55
Base class for Model Generation.
Definition: sstmodel.h:25
Performs Unit math in full precision.
Definition: unitAlgebra.h:106