14 #ifndef SST_CORE_CONFIGGRAPH_H 15 #define SST_CORE_CONFIGGRAPH_H 17 #include "sst/core/sst_types.h" 24 #include <sst/core/sparseVectorMap.h> 25 #include <sst/core/params.h> 26 #include <sst/core/statapi/statbase.h> 27 #include <sst/core/statapi/statoutput.h> 28 #include <sst/core/rankInfo.h> 29 #include <sst/core/unitAlgebra.h> 31 #include <sst/core/serialization/serializable.h> 46 typedef SparseVectorMap<ComponentId_t> ComponentIdMap_t;
47 typedef std::vector<LinkId_t> LinkIdMap_t;
55 ComponentId_t component[2];
58 std::string latency_str[2];
63 inline LinkId_t key()
const {
return id; }
67 if ( latency[0] < latency[1] )
return latency[0];
72 void print(std::ostream &os)
const {
73 os <<
"Link " << name <<
" (id = " <<
id <<
")" << std::endl;
74 os <<
" component[0] = " << component[0] << std::endl;
75 os <<
" port[0] = " << port[0] << std::endl;
76 os <<
" latency[0] = " << latency[0] << std::endl;
77 os <<
" component[1] = " << component[1] << std::endl;
78 os <<
" port[1] = " << port[1] << std::endl;
79 os <<
" latency[1] = " << latency[1] << std::endl;
108 component[0] = ULONG_MAX;
109 component[1] = ULONG_MAX;
112 ConfigLink(LinkId_t
id,
const std::string &n) :
120 component[0] = ULONG_MAX;
121 component[1] = ULONG_MAX;
134 std::map<std::string, Params> statMap;
135 std::vector<ComponentId_t> components;
143 bool addComponent(ComponentId_t
id);
144 bool addStatistic(
const std::string &name,
Params &p);
145 bool setOutput(
size_t id);
146 bool setFrequency(
const std::string &freq);
153 std::pair<bool, std::string> verifyStatsAndComponents(
const ConfigGraph* graph);
162 ser & outputFrequency;
179 void addParameter(
const std::string &key,
const std::string &val) {
207 std::vector<double> coords;
209 inline const ComponentId_t& key()
const {
return id; }
212 void print(std::ostream &os)
const;
221 void setWeight(
double w);
222 void setCoordinates(
const std::vector<double> &c);
223 void addParameter(
const std::string &key,
const std::string &value,
bool overwrite);
224 ConfigComponent* addSubComponent(ComponentId_t,
const std::string &name,
const std::string &type,
int slot);
227 void enableStatistic(
const std::string &statisticName,
bool recursively =
false);
228 void addStatisticParameter(
const std::string &statisticName,
const std::string ¶m,
const std::string &value,
bool recursively =
false);
229 void setStatisticParameters(
const std::string &statisticName,
const Params ¶ms,
bool recursively =
false);
231 std::vector<LinkId_t> allLinks()
const;
243 ser & enabledStatistics;
260 coords.resize(3, 0.0);
263 ConfigComponent(ComponentId_t
id, std::string name,
int slot_num, std::string type,
float weight,
RankInfo rank) :
271 coords.resize(3, 0.0);
285 typedef std::map<std::string,Params*> ParamsMap_t;
287 typedef std::map<std::string,std::string> VariableMap_t;
297 void print(std::ostream &os)
const {
298 os <<
"Printing graph" << std::endl;
299 for (ConfigComponentMap_t::const_iterator i = comps.begin() ; i != comps.end() ; ++i) {
308 statLoadLevel = STATISTICSDEFAULTLOADLEVEL;
309 statOutputs.emplace_back(STATISTICSDEFAULTOUTPUTNAME);
312 size_t getNumComponents() {
return comps.data.size(); }
315 void setComponentRanks(
RankInfo rank);
317 bool containsComponentInRank(
RankInfo rank);
324 ComponentId_t addComponent(ComponentId_t
id, std::string name, std::string type,
float weight,
RankInfo rank);
326 ComponentId_t addComponent(ComponentId_t
id, std::string name, std::string type);
330 void setStatisticOutput(
const std::string &name);
333 void addStatisticOutputParameter(
const std::string ¶m,
const std::string &value);
336 void setStatisticOutputParams(
const Params& p);
339 void setStatisticLoadLevel(uint8_t loadLevel);
342 void enableStatisticForComponentName(std::string ComponentName, std::string statisticName);
343 void enableStatisticForComponentType(std::string ComponentType, std::string statisticName);
346 void addStatisticParameterForComponentName(
const std::string &ComponentName,
const std::string &statisticName,
const std::string ¶m,
const std::string &value);
347 void addStatisticParameterForComponentType(
const std::string &ComponentType,
const std::string &statisticName,
const std::string ¶m,
const std::string &value);
349 std::vector<ConfigStatOutput>& getStatOutputs() {
return statOutputs;}
350 const ConfigStatOutput& getStatOutput(
size_t index = 0)
const {
return statOutputs[index];}
351 long getStatLoadLevel()
const {
return statLoadLevel;}
354 void addLink(ComponentId_t comp_id, std::string link_name, std::string port, std::string latency_str,
bool no_cut =
false);
357 void setLinkNoCut(std::string link_name);
360 void postCreationCleanup();
363 bool checkForStructuralErrors();
371 const std::map<std::string, ConfigStatGroup>& getStatGroups()
const {
return statGroups; }
373 auto found = statGroups.find(name);
374 if ( found == statGroups.end() ) {
376 std::tie(found, ok) = statGroups.emplace(name, name);
378 return &(found->second);
381 bool containsComponent(ComponentId_t
id)
const;
390 ConfigGraph* getSubGraph(uint32_t start_rank, uint32_t end_rank);
391 ConfigGraph* getSubGraph(
const std::set<uint32_t>& rank_set);
396 void getConnectedNoCutComps(ComponentId_t start, ComponentIdMap_t& group);
409 friend class SSTSDLModelDefinition;
411 ConfigLinkMap_t links;
412 ConfigComponentMap_t comps;
413 std::map<std::string, ConfigStatGroup> statGroups;
416 std::map<std::string,LinkId_t> link_names;
418 std::vector<ConfigStatOutput> statOutputs;
419 uint8_t statLoadLevel;
433 ComponentIdMap_t group;
444 rank(
RankInfo(RankInfo::UNASSIGNED, 0))
450 inline ComponentId_t key()
const {
return id; }
457 ComponentId_t component[2];
458 SimTime_t latency[2];
470 inline LinkId_t key()
const {
return id; }
474 if ( latency[0] < latency[1] )
return latency[0];
478 void print(std::ostream &os)
const {
479 os <<
" Link " <<
id << std::endl;
480 os <<
" component[0] = " << component[0] << std::endl;
481 os <<
" latency[0] = " << latency[0] << std::endl;
482 os <<
" component[1] = " << component[1] << std::endl;
483 os <<
" latency[1] = " << latency[1] << std::endl;
492 PartitionComponentMap_t comps;
493 PartitionLinkMap_t links;
497 void print(std::ostream &os)
const {
498 os <<
"Printing graph" << std::endl;
499 for (PartitionComponentMap_t::const_iterator i = comps.begin() ; i != comps.end() ; ++i) {
504 PartitionComponentMap_t& getComponentMap() {
507 PartitionLinkMap_t& getLinkMap() {
515 size_t getNumComponents() {
return comps.size(); }
521 #endif // SST_CORE_CONFIGGRAPH_H int slot_num
Definition: configGraph.h:199
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
float weight
Definition: configGraph.h:201
ConfigComponentMap_t & getComponentMap()
Return the map of components.
Definition: configGraph.h:367
Main control class for a SST Simulation.
Definition: simulation.h:72
SimTime_t getMinLatency() const
Return the minimum latency of this link (from both sides)
Definition: configGraph.h:473
Represents the configuration of a generic component.
Definition: configGraph.h:195
Definition: configGraph.h:490
void print(std::ostream &os) const
Print the Link information.
Definition: configGraph.h:72
std::string type
Definition: configGraph.h:200
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:294
void insert(std::string key, std::string value, bool overwrite=true)
Add a key value pair into the param object.
Definition: params.h:347
LinkId_t id
Definition: configGraph.h:53
Definition: configGraph.h:454
bool no_cut
Definition: configGraph.h:60
std::vector< Statistics::StatisticInfo > enabledStatistics
Definition: configGraph.h:205
Definition: configGraph.h:426
RankInfo rank
Definition: configGraph.h:202
Definition: serializable.h:109
Represents the configuration of a generic Link.
Definition: configGraph.h:51
std::string name
Definition: configGraph.h:54
ConfigLinkMap_t & getLinkMap()
Return the map of links.
Definition: configGraph.h:386
ComponentId_t id
Definition: configGraph.h:197
Definition: rankInfo.h:21
SimTime_t latency[2]
Definition: configGraph.h:57
SimTime_t getMinLatency() const
Return the minimum latency of this link (from both sides)
Definition: configGraph.h:66
void print(std::ostream &os) const
Print the configuration graph.
Definition: configGraph.h:297
Params params
Definition: configGraph.h:204
ImplementSerializable(SST::ConfigComponent) private ConfigComponent(ComponentId_t id, std::string name, std::string type, float weight, RankInfo rank)
Create a new Component.
Definition: configGraph.h:253
std::vector< LinkId_t > links
Definition: configGraph.h:203
Parameter store.
Definition: params.h:45
Definition: configGraph.h:170
std::string name
Definition: configGraph.h:198
Class for creating and managing TimeConverter objects.
Definition: timeLord.h:36
void print(std::ostream &os) const
Print the Link information.
Definition: configGraph.h:478
void print(std::ostream &os) const
Print the configuration graph.
Definition: configGraph.h:497
Definition: configGraph.h:131
int current_ref
Definition: configGraph.h:59
Definition: componentInfo.h:30
std::vector< ConfigComponent > subComponents
Definition: configGraph.h:206
ComponentId_t component[2]
Definition: configGraph.h:55
Performs Unit math in full precision.
Definition: unitAlgebra.h:104