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"
28DISABLE_WARN_DEPRECATED_REGISTER
43 SST_ELI_REGISTER_MODEL_DESCRIPTION(
47 SST_ELI_ELEMENT_VERSION(1,0,0),
48 "Python model for building SST simulation graphs",
51 SST_ELI_DOCUMENT_MODEL_SUPPORTED_EXTENSIONS(
".py")
62 void initModel(
const std::string& script_file,
int verbosity,
Config* config,
int argc,
char** argv);
63 std::string scriptName;
69 std::vector<size_t> nameStack;
70 std::map<std::string, ComponentId_t> compNameMap;
71 ComponentId_t nextComponentId;
73 bool callPythonFinalize;
74#if PY_MINOR_VERSION >= 9
75 bool enablePythonCoverage =
false;
79 Config* getConfig()
const {
return config; }
81 bool setConfigEntryFromModel(
const std::string& entryName,
const std::string& value)
88 Output* getOutput()
const {
return output; }
90 ComponentId_t getNextComponentId() {
return nextComponentId++; }
92 ComponentId_t addComponent(
const char* name,
const char* type)
94 auto id = graph->addComponent(name, type);
100 return graph->findComponentByName(std::string(name));
103 ConfigComponentMap_t& components() {
return graph->getComponentMap(); }
105 void addLink(ComponentId_t
id,
const char* link_name,
const char* port,
const char* latency,
bool no_cut)
const
107 graph->addLink(
id, link_name, port, latency, no_cut);
109 void setLinkNoCut(
const char* link_name)
const { graph->setLinkNoCut(link_name); }
111 void pushNamePrefix(
const char* name);
112 void popNamePrefix();
113 char* addNamePrefix(
const char* name)
const;
115 void setStatisticOutput(
const char* Name) { graph->setStatisticOutput(Name); }
116 void addStatisticOutputParameter(
const std::string& param,
const std::string& value)
118 graph->addStatisticOutputParameter(param, value);
120 void setStatisticLoadLevel(uint8_t loadLevel) { graph->setStatisticLoadLevel(loadLevel); }
122 void addGlobalParameter(
const char* set,
const char* key,
const char* value,
bool overwrite)
130 void setCallPythonFinalize(
bool state) { callPythonFinalize = state; }
139 SST_ELI_REGISTER_MODEL_DESCRIPTION(
143 SST_ELI_ELEMENT_VERSION(1,0,0),
144 "XML model for building SST simulation graphs",
147 SST_ELI_DOCUMENT_MODEL_SUPPORTED_EXTENSIONS(
".xml",
".sdl")
151 SSTModelDescription(config)
167 SSTPythonModelDefinition* actual_model_;
170std::map<std::string, std::string> generateStatisticParameters(PyObject* statParamDict);
171SST::Params pythonToCppParams(PyObject* statParamDict);
172PyObject* buildStatisticObject(StatisticId_t
id);
173PyObject* buildEnabledStatistic(
174 ConfigComponent* cc,
const char* statName, PyObject* statParamDict,
bool apply_to_children);
175PyObject* buildEnabledStatistics(
ConfigComponent* cc, PyObject* statList, PyObject* paramDict,
bool apply_to_children);
Represents the configuration of a generic component.
Definition configGraph.h:263
A Configuration Graph A graph representing Components and Links.
Definition configGraph.h:450
Class to contain SST Simulation Configuration variables.
Definition config.h:41
ConfigGraph * createConfigGraph() override
Create the ConfigGraph.
Definition pymodel.cc:1271
ConfigGraph * createConfigGraph() override
Create the ConfigGraph.
Definition pymodel.h:162
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition output.h:54
Parameter store.
Definition params.h:58
void setModelOptions(const std::string &options)
Sets the model options field of the Config object.
Definition sstmodel.cc:35
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
bool setOptionFromModel(const std::string &entryName, const std::string &value)
Set a configuration string to update configuration values.
Definition sstmodel.cc:29
Performs Unit math in full precision.
Definition unitAlgebra.h:107