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) {
250 std::vector<double> coords;
252 inline const ComponentId_t& key()
const {
return id; }
255 void print(std::ostream &os)
const;
264 void setWeight(
double w);
265 void setCoordinates(
const std::vector<double> &c);
266 void addParameter(
const std::string &key,
const std::string &value,
bool overwrite);
267 ConfigComponent* addSubComponent(ComponentId_t,
const std::string &name,
const std::string &type,
int slot);
270 void enableStatistic(
const std::string &statisticName);
271 void addStatisticParameter(
const std::string &statisticName,
const std::string ¶m,
const std::string &value);
272 void setStatisticParameters(
const std::string &statisticName,
const Params ¶ms);
274 std::vector<LinkId_t> allLinks()
const;
286 ser & enabledStatistics;
303 coords.resize(3, 0.0);
306 ConfigComponent(ComponentId_t
id, std::string name,
int slot_num, std::string type,
float weight,
RankInfo rank) :
314 coords.resize(3, 0.0);
328 typedef std::map<std::string,Params*> ParamsMap_t;
330 typedef std::map<std::string,std::string> VariableMap_t;
340 void print(std::ostream &os)
const {
341 os <<
"Printing graph" << std::endl;
342 for (ConfigComponentMap_t::const_iterator i = comps.begin() ; i != comps.end() ; ++i) {
351 statLoadLevel = STATISTICSDEFAULTLOADLEVEL;
352 statOutputs.emplace_back(STATISTICSDEFAULTOUTPUTNAME);
355 size_t getNumComponents() {
return comps.data.size(); }
358 void setComponentRanks(
RankInfo rank);
360 bool containsComponentInRank(
RankInfo rank);
367 ComponentId_t addComponent(ComponentId_t
id, std::string name, std::string type,
float weight,
RankInfo rank);
369 ComponentId_t addComponent(ComponentId_t
id, std::string name, std::string type);
373 void setStatisticOutput(
const std::string &name);
376 void addStatisticOutputParameter(
const std::string ¶m,
const std::string &value);
379 void setStatisticOutputParams(
const Params& p);
382 void setStatisticLoadLevel(uint8_t loadLevel);
385 void enableStatisticForComponentName(std::string ComponentName, std::string statisticName);
386 void enableStatisticForComponentType(std::string ComponentType, std::string statisticName);
389 void addStatisticParameterForComponentName(
const std::string &ComponentName,
const std::string &statisticName,
const std::string ¶m,
const std::string &value);
390 void addStatisticParameterForComponentType(
const std::string &ComponentType,
const std::string &statisticName,
const std::string ¶m,
const std::string &value);
392 std::vector<ConfigStatOutput>& getStatOutputs() {
return statOutputs;}
393 const ConfigStatOutput& getStatOutput(
size_t index = 0)
const {
return statOutputs[index];}
394 long getStatLoadLevel()
const {
return statLoadLevel;}
397 void addLink(ComponentId_t comp_id, std::string link_name, std::string port, std::string latency_str,
bool no_cut =
false);
400 void postCreationCleanup();
403 bool checkForStructuralErrors();
411 const std::map<std::string, ConfigStatGroup>& getStatGroups()
const {
return statGroups; }
413 auto found = statGroups.find(name);
414 if ( found == statGroups.end() ) {
416 std::tie(found, ok) = statGroups.emplace(name, name);
418 return &(found->second);
421 bool containsComponent(ComponentId_t
id)
const;
430 ConfigGraph* getSubGraph(uint32_t start_rank, uint32_t end_rank);
431 ConfigGraph* getSubGraph(
const std::set<uint32_t>& rank_set);
436 void getConnectedNoCutComps(ComponentId_t start, ComponentIdMap_t& group);
449 friend class SSTSDLModelDefinition;
451 ConfigLinkMap_t links;
452 ConfigComponentMap_t comps;
453 std::map<std::string, ConfigStatGroup> statGroups;
456 std::map<std::string,LinkId_t> link_names;
458 std::vector<ConfigStatOutput> statOutputs;
459 uint8_t statLoadLevel;
473 ComponentIdMap_t group;
484 rank(
RankInfo(RankInfo::UNASSIGNED, 0))
490 inline ComponentId_t key()
const {
return id; }
497 ComponentId_t component[2];
498 SimTime_t latency[2];
510 inline LinkId_t key()
const {
return id; }
514 if ( latency[0] < latency[1] )
return latency[0];
518 void print(std::ostream &os)
const {
519 os <<
" Link " <<
id << std::endl;
520 os <<
" component[0] = " << component[0] << std::endl;
521 os <<
" latency[0] = " << latency[0] << std::endl;
522 os <<
" component[1] = " << component[1] << std::endl;
523 os <<
" latency[1] = " << latency[1] << std::endl;
532 PartitionComponentMap_t comps;
533 PartitionLinkMap_t links;
537 void print(std::ostream &os)
const {
538 os <<
"Printing graph" << std::endl;
539 for (PartitionComponentMap_t::const_iterator i = comps.begin() ; i != comps.end() ; ++i) {
544 PartitionComponentMap_t& getComponentMap() {
547 PartitionLinkMap_t& getLinkMap() {
555 size_t getNumComponents() {
return comps.size(); }
561 #endif // SST_CORE_CONFIGGRAPH_H int slot_num
Definition: configGraph.h:242
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:244
ConfigComponentMap_t & getComponentMap()
Return the map of components.
Definition: configGraph.h:407
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:513
Represents the configuration of a generic component.
Definition: configGraph.h:238
Definition: configGraph.h:530
void print(std::ostream &os) const
Print the Link information.
Definition: configGraph.h:72
std::string type
Definition: configGraph.h:243
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:337
void insert(std::string key, std::string value, bool overwrite=true)
Add a key value pair into the param object.
Definition: params.h:339
LinkId_t id
Definition: configGraph.h:53
Definition: configGraph.h:494
bool no_cut
Definition: configGraph.h:60
std::vector< Statistics::StatisticInfo > enabledStatistics
Definition: configGraph.h:248
Definition: configGraph.h:466
RankInfo rank
Definition: configGraph.h:245
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:426
ComponentId_t id
Definition: configGraph.h:240
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:340
Params params
Definition: configGraph.h:247
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:296
std::vector< LinkId_t > links
Definition: configGraph.h:246
Parameter store.
Definition: params.h:45
Definition: configGraph.h:170
std::string name
Definition: configGraph.h:241
Class for creating and managing TimeConverter objects.
Definition: timeLord.h:36
void print(std::ostream &os) const
Print the Link information.
Definition: configGraph.h:518
void print(std::ostream &os) const
Print the configuration graph.
Definition: configGraph.h:537
Definition: configGraph.h:131
int current_ref
Definition: configGraph.h:59
Definition: componentInfo.h:30
std::vector< ConfigComponent > subComponents
Definition: configGraph.h:249
ComponentId_t component[2]
Definition: configGraph.h:55
Performs Unit math in full precision.
Definition: unitAlgebra.h:104