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;
75 #if PY_MINOR_VERSION >= 9 76 bool enablePythonCoverage =
false;
80 Config* getConfig()
const {
return config; }
82 bool setConfigEntryFromModel(
const std::string& entryName,
const std::string& value)
89 Output* getOutput()
const {
return output; }
91 ComponentId_t getNextComponentId() {
return nextComponentId++; }
93 ComponentId_t addComponent(
const char* name,
const char* type)
101 return graph->findComponentByName(std::string(name));
106 LinkId_t createLink(
const char* link_name,
const char* latency) {
return graph->
createLink(link_name, latency); }
108 void addLink(ComponentId_t
id, LinkId_t link_id,
const char* port,
const char* latency)
const 110 graph->
addLink(
id, link_id, port, latency);
113 void addNonLocalLink(LinkId_t link_id,
int rank,
int thread)
const 118 void setLinkNoCut(LinkId_t link_id)
const { graph->
setLinkNoCut(link_id); }
120 void pushNamePrefix(
const char* name);
121 void popNamePrefix();
122 char* addNamePrefix(
const char* name)
const;
125 void addStatisticOutputParameter(
const std::string& param,
const std::string& value)
131 void addGlobalParameter(
const char*
set,
const char* key,
const char* value,
bool overwrite)
139 void setCallPythonFinalize(
bool state) { callPythonFinalize = state; }
148 SST_ELI_REGISTER_MODEL_DESCRIPTION(
152 SST_ELI_ELEMENT_VERSION(1,0,0),
153 "XML model for building SST simulation graphs",
156 SST_ELI_DOCUMENT_MODEL_SUPPORTED_EXTENSIONS(
".xml",
".sdl")
176 SSTPythonModelDefinition* actual_model_;
179 std::map<std::string, std::string> generateStatisticParameters(PyObject* statParamDict);
180 SST::Params pythonToCppParams(PyObject* statParamDict);
181 PyObject* buildStatisticObject(StatisticId_t
id);
182 PyObject* buildEnabledStatistic(
183 ConfigComponent* cc,
const char* statName, PyObject* statParamDict,
bool apply_to_children);
184 PyObject* buildEnabledStatistics(
ConfigComponent* cc, PyObject* statList, PyObject* paramDict,
bool apply_to_children);
188 #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:57
ConfigComponentMap_t & getComponentMap()
Return the map of components.
Definition: configGraph.h:689
ConfigGraph * createConfigGraph() override
Create the ConfigGraph.
Definition: pymodel.cc:1329
void setStatisticLoadLevel(uint8_t loadLevel)
Set the statistic system load level.
Definition: configGraph.cc:954
Class to contain SST Simulation Configuration variables.
Definition: config.h:51
Represents the configuration of a generic component.
Definition: configGraph.h:381
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:41
void addNonLocalLink(LinkId_t link_id, int rank, int thread)
Adds the remote rank info for nonlocal links.
Definition: configGraph.cc:1010
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:585
Definition: pymodel.h:145
void setModelOptions(const std::string &options)
Sets the model options field of the Config object.
Definition: sstmodel.cc:35
bool setOptionFromModel(const std::string &entryName, const std::string &value)
Set a configuration string to update configuration values.
Definition: sstmodel.cc:29
void addStatisticOutputParameter(const std::string ¶m, const std::string &value)
Add parameter to the statistic output module.
Definition: configGraph.cc:948
void addLink(ComponentId_t comp_id, LinkId_t link_id, const char *port, const char *latency_str)
Add a Link to a Component on a given Port.
Definition: configGraph.cc:960
LinkId_t createLink(const char *name, const char *latency=nullptr)
Create link and return it's ID.
Definition: configGraph.cc:1030
ConfigGraph * createConfigGraph() override
Create the ConfigGraph.
Definition: pymodel.h:171
Parameter store.
Definition: params.h:63
Base class for Model Generation.
Definition: sstmodel.h:29
void setLinkNoCut(LinkId_t link_name)
Set a Link to be no-cut.
Definition: configGraph.cc:1045
ComponentId_t addComponent(const std::string &name, const std::string &type)
Create a new component.
Definition: configGraph.cc:915
void setStatisticOutput(const std::string &name)
Set the statistic output module.
Definition: configGraph.cc:936
Class that stores data in a vector, but can access the data similar to a map.
Definition: sparseVectorMap.h:46
Performs Unit math in full precision.
Definition: unitAlgebra.h:105