SST  6.0.0
StructuralSimulationToolkit
element.h
1 // Copyright 2009-2016 Sandia Corporation. Under the terms
2 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2016, Sandia Corporation
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_ELEMENT_H
13 #define SST_CORE_ELEMENT_H
14 
15 #include <sst/core/sst_types.h>
16 
17 //#include <sst/core/component.h>
18 //#include <sst/core/params.h>
19 
20 #include <stdio.h>
21 #include <string>
22 
23 // Component Category Definitions
24 #define COMPONENT_CATEGORY_UNCATEGORIZED 0x00
25 #define COMPONENT_CATEGORY_PROCESSOR 0x01
26 #define COMPONENT_CATEGORY_MEMORY 0x02
27 #define COMPONENT_CATEGORY_NETWORK 0x04
28 #define COMPONENT_CATEGORY_SYSTEM 0x08
29 
30 namespace SST {
31 class Component;
32 class ConfigGraph;
33 class PartitionGraph;
34 class Introspector;
35 class Module;
36 class Params;
37 class SubComponent;
38 namespace Partition {
39  class SSTPartitioner;
40 }
41 class RankInfo;
42 
43 typedef Component* (*componentAllocate)(ComponentId_t, Params&);
44 typedef Introspector* (*introspectorAllocate)(Params&);
45 typedef void (*eventInitialize)(void);
46 typedef Module* (*moduleAllocate)(Params&);
47 typedef Module* (*moduleAllocateWithComponent)(Component*, Params&);
48 typedef SubComponent* (*subcomponentAllocate)(Component*, Params&);
49 typedef SST::Partition::SSTPartitioner* (*partitionFunction)(RankInfo, RankInfo, int);
50 typedef void (*generateFunction)(ConfigGraph*, std::string options, int ranks);
51 typedef void* (*genPythonModuleFunction)(void);
52 
53 /** Describes Statistics used by a Component.
54  */
56  const char* name; /*!< Name of the Statistic to be Enabled */
57  const char* description; /*!< Brief description of the Statistic */
58  const char* units; /*!< Units associated with this Statistic value */
59  const uint8_t enableLevel; /*!< Level to meet to enable statistic 0 = disabled */
60 };
61 
62 /** Describes Parameters to a Component.
63  */
65  const char *name; /*!< Name of the parameter */
66  const char *description; /*!< Brief description of the parameter (ie, what it controls) */
67  const char *defaultValue; /*!< Default value (if any) NULL == required parameter with no default, "" == optional parameter, blank default, "foo" == default value */
68 };
69 
70 /** Describes Ports that the Component can use
71  */
73  const char *name; /*!< Name of the port. Can contain %d for a dynamic port, also %(xxx)d for dynamic port with xxx being the controlling component parameter */
74  const char *description; /*!< Brief description of the port (ie, what it is used for) */
75  const char **validEvents; /*!< List of fully-qualified event types that this Port expects to send or receive */
76 };
77 
78 /** Describes a Component and its associated information
79  */
81  const char *name; /*!< Name of the component */
82  const char *description; /*!< Brief description of what the component does */
83  void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the component. (optional) */
84  componentAllocate alloc; /*!< Pointer to function to allocate a new instance of this component. */
85  const ElementInfoParam *params; /*!< List of parameters for which this component expects to look. */
86  const ElementInfoPort *ports; /*!< List of ports that this component uses. */
87  uint32_t category; /*!< Bit-mask of categories in which this component fits. */
88  const ElementInfoStatistic *stats; /*!< List of statistic Names that this component wants enabled. */
89 };
90 
91 /** Describes an Introspector
92  */
94  const char *name; /*!< Name of the introspector */
95  const char *description; /*!< Brief description of what the introspector does. */
96  void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the introspector. (optional) */
97  introspectorAllocate alloc; /*!< Pointer to a function to allocate a new instance of this introspector. */
98  const ElementInfoParam *params; /*!< List of parameters which this introspector uses. */
99 };
100 
101 /** Describes an Event
102  */
104  const char *name; /*!< Name of the event */
105  const char *description; /*!< Brief description of this event. */
106  void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the event. (optional) */
107  eventInitialize init; /*!< Pointer to a function to initialize the library for use of this event. (optional) */
108 };
109 
110 /** Describes a Module
111  */
113  const char *name; /*!< Name of the module. */
114  const char *description; /*!< Brief description of the module. */
115  void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the module. (optional) */
116  moduleAllocate alloc; /*!< Pointer to a function to do a default initialization of the module. */
117  moduleAllocateWithComponent alloc_with_comp; /*!< Pointer to a function to initialize a module instance, passing a Component as an argument. */
118  const ElementInfoParam *params; /*!< List of parameters which are used by this module. */
119  const char *provides; /*!< Name of SuperClass which for this module can be used. */
120 };
121 
123  const char *name; /*!< Name of the subcomponent. */
124  const char *description; /*!< Brief description of the subcomponent. */
125  void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the subcomponent (optional) */
126  subcomponentAllocate alloc; /*!< Pointer to a function to initialize a subcomponent instance, passing a Component as an argument. */
127  const ElementInfoParam *params; /*!< List of parameters which are used by this subcomponent. */
128  const ElementInfoStatistic *stats; /*!< List of statistics supplied by this subcomponent. */
129  const char *provides; /*!< Name of SuperClass which for this subcomponent can be used. */
130 };
131 
132 /** Describes a Partitioner
133  */
135  const char *name; /*!< Name of the Partitioner */
136  const char *description; /*!< Brief description of the partitioner */
137  void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the partitioner. (optional) */
138  partitionFunction func; /*!< Function to be called to perform the paritioning */
139 };
140 
141 /** Describes a Generator
142  */
144  const char *name; /*!< Name of the Generator */
145  const char *description; /*!< Brief description of the generator */
146  void (*printHelp)(FILE *output); /*!< Pointer to a function that will print additional documentation about the generator. (optional) */
147  generateFunction func; /*!< Function to be called to perform the graph generation */
148 };
149 
150 /** Describes all the parts of the Element Library
151  */
153  const char *name; /*!< Name of the Library. */
154  const char *description; /*!< Brief description of the Library */
155  const struct ElementInfoComponent* components; /*!< List of Components contained in the library. */
156  const struct ElementInfoEvent* events; /*!< List of Events exported by the library. */
157  const struct ElementInfoIntrospector* introspectors; /*!< List of Introspectors provided by the library. */
158  const struct ElementInfoModule* modules; /*!< List of Modules provided by the library. */
159  const struct ElementInfoSubComponent* subcomponents; /*!< List of SubComponents provided by the library. */
160  const struct ElementInfoPartitioner* partitioners; /*!< List of Partitioners provided by the library. */
161  genPythonModuleFunction pythonModuleGenerator; /*!< Pointer to Function to generate a Python Module for use in Configurations */
162  const struct ElementInfoGenerator* generators; /*!< List of Generators provided by the library. */
163 };
164 } //namespace SST
165 
166 #endif // SST_CORE_ELEMENT_H
const ElementInfoStatistic * stats
Definition: element.h:128
Describes an Event.
Definition: element.h:103
void(* printHelp)(FILE *output)
Definition: element.h:125
const char * provides
Definition: element.h:119
Describes a Component and its associated information.
Definition: element.h:80
componentAllocate alloc
Definition: element.h:84
Describes a Partitioner.
Definition: element.h:134
void(* printHelp)(FILE *output)
Definition: element.h:146
const char * description
Definition: element.h:82
const char * defaultValue
Definition: element.h:67
const char * description
Definition: element.h:66
const struct ElementInfoComponent * components
Definition: element.h:155
const char ** validEvents
Definition: element.h:75
uint32_t category
Definition: element.h:87
const char * name
Definition: element.h:81
introspectorAllocate alloc
Definition: element.h:97
Describes all the parts of the Element Library.
Definition: element.h:152
moduleAllocate alloc
Definition: element.h:116
const char * description
Definition: element.h:95
const char * description
Definition: element.h:105
void(* printHelp)(FILE *output)
Definition: element.h:83
Definition: action.cc:17
const char * name
Definition: element.h:153
const ElementInfoStatistic * stats
Definition: element.h:88
void(* printHelp)(FILE *output)
Definition: element.h:106
const struct ElementInfoPartitioner * partitioners
Definition: element.h:160
Describes Statistics used by a Component.
Definition: element.h:55
Describes a Generator.
Definition: element.h:143
const char * name
Definition: element.h:104
Describes an Introspector.
Definition: element.h:93
void(* printHelp)(FILE *output)
Definition: element.h:137
const char * description
Definition: element.h:74
const char * description
Definition: element.h:136
const char * name
Definition: element.h:65
eventInitialize init
Definition: element.h:107
const ElementInfoParam * params
Definition: element.h:98
const char * name
Definition: element.h:94
const char * name
Definition: element.h:56
const struct ElementInfoModule * modules
Definition: element.h:158
const ElementInfoParam * params
Definition: element.h:127
Describes Parameters to a Component.
Definition: element.h:64
partitionFunction func
Definition: element.h:138
const char * description
Definition: element.h:114
subcomponentAllocate alloc
Definition: element.h:126
const char * description
Definition: element.h:57
moduleAllocateWithComponent alloc_with_comp
Definition: element.h:117
Base class for Partitioning graphs.
Definition: sstpart.h:27
const char * name
Definition: element.h:113
const char * provides
Definition: element.h:129
const struct ElementInfoIntrospector * introspectors
Definition: element.h:157
Describes a Module.
Definition: element.h:112
void(* printHelp)(FILE *output)
Definition: element.h:96
const ElementInfoPort * ports
Definition: element.h:86
genPythonModuleFunction pythonModuleGenerator
Definition: element.h:161
const char * name
Definition: element.h:73
const char * description
Definition: element.h:124
const struct ElementInfoEvent * events
Definition: element.h:156
const uint8_t enableLevel
Definition: element.h:59
const ElementInfoParam * params
Definition: element.h:118
const char * description
Definition: element.h:145
void(* printHelp)(FILE *output)
Definition: element.h:115
const struct ElementInfoSubComponent * subcomponents
Definition: element.h:159
const char * description
Definition: element.h:154
const ElementInfoParam * params
Definition: element.h:85
const char * name
Definition: element.h:135
Describes Ports that the Component can use.
Definition: element.h:72
generateFunction func
Definition: element.h:147
const char * name
Definition: element.h:123
Definition: element.h:122
const struct ElementInfoGenerator * generators
Definition: element.h:162
const char * name
Definition: element.h:144
const char * units
Definition: element.h:58