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/statoutput.h"
27 #include "sst/core/rankInfo.h"
29 #include <sst/core/serialization/serializable.h>
43 typedef SparseVectorMap<ComponentId_t> ComponentIdMap_t;
44 typedef std::vector<LinkId_t> LinkIdMap_t;
53 ComponentId_t component[2];
56 std::string latency_str[2];
61 inline LinkId_t key()
const {
return id; }
65 if ( latency[0] < latency[1] )
return latency[0];
70 void print(std::ostream &os)
const {
71 os <<
"Link " << name <<
" (id = " <<
id <<
")" << std::endl;
72 os <<
" component[0] = " << component[0] << std::endl;
73 os <<
" port[0] = " << port[0] << std::endl;
74 os <<
" latency[0] = " << latency[0] << std::endl;
75 os <<
" component[1] = " << component[1] << std::endl;
76 os <<
" port[1] = " << port[1] << std::endl;
77 os <<
" latency[1] = " << latency[1] << std::endl;
98 friend class ConfigGraph;
99 ConfigLink(LinkId_t
id) :
106 component[0] = ULONG_MAX;
107 component[1] = ULONG_MAX;
110 ConfigLink(LinkId_t
id,
const std::string &n) :
118 component[0] = ULONG_MAX;
119 component[1] = ULONG_MAX;
122 void updateLatencies(TimeLord*);
127 typedef SparseVectorMap<LinkId_t,ConfigLink> ConfigLinkMap_t;
143 inline const ComponentId_t& key()
const {
return id; }
146 void print(std::ostream &os)
const;
163 ser & isIntrospector;
164 ser & enabledStatistics;
165 ser & enabledStatParams;
172 friend class ConfigGraph;
180 isIntrospector(isIntrospector)
191 typedef SparseVectorMap<ComponentId_t,ConfigComponent> ConfigComponentMap_t;
193 typedef std::map<std::string,Params*> ParamsMap_t;
195 typedef std::map<std::string,std::string> VariableMap_t;
197 class PartitionGraph;
205 void print(std::ostream &os)
const {
206 os <<
"Printing graph" << std::endl;
207 for (ConfigComponentMap_t::const_iterator i = comps.begin() ; i != comps.end() ; ++i) {
217 statOutputName = STATISTICSDEFAULTOUTPUTNAME;
218 statLoadLevel = STATISTICSDEFAULTLOADLEVEL;
221 size_t getNumComponents() {
return comps.data.size(); }
224 void setComponentRanks(RankInfo rank);
226 bool containsComponentInRank(RankInfo rank);
228 bool checkRanks(RankInfo ranks);
233 ComponentId_t addComponent(std::string name, std::string type,
float weight, RankInfo rank);
235 ComponentId_t addComponent(std::string name, std::string type);
238 void setComponentRank(ComponentId_t comp_id, RankInfo rank);
240 void setComponentWeight(ComponentId_t comp_id,
float weight);
243 void addParams(ComponentId_t comp_id, Params& p);
245 void addParameter(ComponentId_t comp_id, std::string key, std::string value,
bool overwrite =
false);
248 void setStatisticOutput(
const char* name);
251 void addStatisticOutputParameter(
const char* param,
const char* value);
254 void setStatisticOutputParams(
const Params& p);
257 void setStatisticLoadLevel(uint8_t loadLevel);
260 void enableComponentStatistic(ComponentId_t comp_id, std::string statisticName);
261 void enableStatisticForComponentName(std::string ComponentName, std::string statisticName);
262 void enableStatisticForComponentType(std::string ComponentType, std::string statisticName);
265 void addComponentStatisticParameter(ComponentId_t comp_id, std::string statisticName,
const char* param,
const char* value);
266 void addStatisticParameterForComponentName(std::string ComponentName, std::string statisticName,
const char* param,
const char* value);
267 void addStatisticParameterForComponentType(std::string ComponentType, std::string statisticName,
const char* param,
const char* value);
269 const std::string& getStatOutput()
const {
return statOutputName;}
270 const Params& getStatOutputParams()
const {
return statOutputParams;}
271 long getStatLoadLevel()
const {
return statLoadLevel;}
274 void addLink(ComponentId_t comp_id, std::string link_name, std::string port, std::string latency_str,
bool no_cut =
false);
277 ComponentId_t addIntrospector(std::string name, std::string type);
280 void postCreationCleanup();
283 bool checkForStructuralErrors();
295 ConfigGraph* getSubGraph(uint32_t start_rank, uint32_t end_rank);
296 ConfigGraph* getSubGraph(
const std::set<uint32_t>& rank_set);
301 void getConnectedNoCutComps(ComponentId_t start, ComponentIdMap_t& group);
307 ser & statOutputName;
308 ser & statOutputParams;
313 friend class Simulation;
314 friend class SSTSDLModelDefinition;
316 ConfigLinkMap_t links;
317 ConfigComponentMap_t comps;
320 std::map<std::string,LinkId_t> link_names;
322 ComponentId_t nextCompID;
324 std::string statOutputName;
325 Params statOutputParams;
326 uint8_t statLoadLevel;
340 ComponentIdMap_t group;
351 rank(
RankInfo(RankInfo::UNASSIGNED, 0))
357 inline const ComponentId_t key()
const {
return id; }
364 ComponentId_t component[2];
365 SimTime_t latency[2];
377 inline const LinkId_t key()
const {
return id; }
381 if ( latency[0] < latency[1] )
return latency[0];
385 void print(std::ostream &os)
const {
386 os <<
" Link " <<
id << std::endl;
387 os <<
" component[0] = " << component[0] << std::endl;
388 os <<
" latency[0] = " << latency[0] << std::endl;
389 os <<
" component[1] = " << component[1] << std::endl;
390 os <<
" latency[1] = " << latency[1] << std::endl;
394 typedef SparseVectorMap<ComponentId_t,PartitionComponent> PartitionComponentMap_t;
395 typedef SparseVectorMap<LinkId_t,PartitionLink> PartitionLinkMap_t;
399 PartitionComponentMap_t comps;
400 PartitionLinkMap_t links;
404 void print(std::ostream &os)
const {
405 os <<
"Printing graph" << std::endl;
406 for (PartitionComponentMap_t::const_iterator i = comps.begin() ; i != comps.end() ; ++i) {
411 PartitionComponentMap_t& getComponentMap() {
414 PartitionLinkMap_t& getLinkMap() {
418 const PartitionLink& getLink(LinkId_t
id)
const {
422 size_t getNumComponents() {
return comps.size(); }
428 #endif // SST_CORE_CONFIGGRAPH_H
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
bool isIntrospector
Definition: configGraph.h:139
float weight
Definition: configGraph.h:135
ConfigComponentMap_t & getComponentMap()
Return the map of components.
Definition: configGraph.h:287
std::vector< Params > enabledStatParams
Definition: configGraph.h:141
void print(std::ostream &os) const
Print the Link information.
Definition: configGraph.h:385
Represents the configuration of a generic component.
Definition: configGraph.h:130
Definition: configGraph.h:397
std::string type
Definition: configGraph.h:134
A Configuration Graph A graph representing Components and Links.
Definition: configGraph.h:202
LinkId_t id
Definition: configGraph.h:51
Definition: configGraph.h:361
void print(std::ostream &os) const
Print the configuration graph.
Definition: configGraph.h:404
bool no_cut
Definition: configGraph.h:58
Definition: configGraph.h:333
SimTime_t getMinLatency() const
Return the minimum latency of this link (from both sides)
Definition: configGraph.h:380
RankInfo rank
Definition: configGraph.h:136
Definition: serializable.h:108
void print(std::ostream &os) const
Print the Link information.
Definition: configGraph.h:70
Represents the configuration of a generic Link.
Definition: configGraph.h:49
std::string name
Definition: configGraph.h:52
ConfigLinkMap_t & getLinkMap()
Return the map of links.
Definition: configGraph.h:291
ComponentId_t id
Definition: configGraph.h:132
Definition: rankInfo.h:21
SimTime_t getMinLatency() const
Return the minimum latency of this link (from both sides)
Definition: configGraph.h:64
SimTime_t latency[2]
Definition: configGraph.h:55
Params params
Definition: configGraph.h:138
std::vector< std::string > enabledStatistics
Definition: configGraph.h:140
void print(std::ostream &os) const
Print the configuration graph.
Definition: configGraph.h:205
std::vector< LinkId_t > links
Definition: configGraph.h:137
Parameter store.
Definition: params.h:44
std::string name
Definition: configGraph.h:133
int current_ref
Definition: configGraph.h:57
Definition: simulation.h:62
ComponentId_t component[2]
Definition: configGraph.h:53