SST  12.0.0
StructuralSimulationToolkit
coreTest_PerfComponent.h
1 // Copyright 2009-2022 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2022, NTESS
6 // All rights reserved.
7 //
8 // Portions are copyright of other developers:
9 // See the file CONTRIBUTORS.TXT in the top level directory
10 // the distribution for more information.
11 //
12 // This file is part of the SST software package. For license
13 // information, see the LICENSE file in the top level directory of the
14 // distribution.
15 
16 #ifndef SST_CORE_CORETEST_PERF_COMPONENT_H
17 #define SST_CORE_CORETEST_PERF_COMPONENT_H
18 
19 #include <sst/core/component.h>
20 #include <sst/core/link.h>
21 #include <sst/core/rng/marsaglia.h>
22 
23 namespace SST {
24 namespace CoreTestPerfComponent {
25 
26 // These first two classes are just base classes to test ELI
27 // inheritance. The definition of the ELI items are spread through 2
28 // component base classes to make sure they get inherited in the
29 // actual component that can be instanced.
31 {
32 public:
33  SST_ELI_REGISTER_COMPONENT_BASE(SST::CoreTestPerfComponent::coreTestPerfComponentBase)
34 
35  SST_ELI_DOCUMENT_PARAMS(
36  { "workPerCycle", "Count of busy work to do during a clock tick.", NULL}
37  )
38 
39  SST_ELI_DOCUMENT_STATISTICS(
40  { "N", "events sent on N link", "counts", 1 }
41  )
42 
43  SST_ELI_DOCUMENT_PORTS(
44  {"Nlink", "Link to the coreTestComponent to the North", { "coreTestComponent.coreTestComponentEvent", "" } }
45  )
46 
47  coreTestPerfComponentBase(ComponentId_t id) : SST::Component(id) {}
49 };
50 
52 {
53 public:
54  SST_ELI_REGISTER_COMPONENT_DERIVED_BASE(
56 
57  SST_ELI_DOCUMENT_PARAMS(
58  { "commFreq", "Approximate frequency of sending an event during a clock tick.", NULL},
59  )
60 
61  SST_ELI_DOCUMENT_STATISTICS(
62  { "S", "events sent on S link", "counts", 1 }
63  )
64 
65  SST_ELI_DOCUMENT_PORTS(
66  {"Slink", "Link to the coreTestComponent to the South", { "coreTestComponent.coreTestComponentEvent", "" } }
67  )
68 
69  coreTestPerfComponentBase2(ComponentId_t id) : coreTestPerfComponentBase(id) {}
71 };
72 
74 {
75 public:
76  // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
77  SST_ELI_REGISTER_COMPONENT(
79  "coreTestElement",
80  "coreTestPerfComponent",
81  SST_ELI_ELEMENT_VERSION(1,0,0),
82  "CoreTest Test Perf Component",
83  COMPONENT_CATEGORY_PROCESSOR
84  )
85 
86  SST_ELI_DOCUMENT_PARAMS(
87  { "commSize", "Size of communication to send.", "16"}
88  )
89 
90  SST_ELI_DOCUMENT_STATISTICS(
91  { "E", "events sent on E link", "counts", 1 },
92  { "W", "events sent on W link", "counts", 1 }
93  )
94 
95  SST_ELI_DOCUMENT_PORTS(
96  {"Elink", "Link to the coreTestComponent to the East", { "coreTestComponent.coreTestComponentEvent", "" } },
97  {"Wlink", "Link to the coreTestComponent to the West", { "coreTestComponent.coreTestComponentEvent", "" } }
98  )
99 
100  // Optional since there is nothing to document
101  SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
102  )
103 
104  coreTestPerfComponent(SST::ComponentId_t id, SST::Params& params);
106 
107  void setup() {}
108  void finish() { printf("Perf Test Component Finished.\n"); }
109 
110 private:
111  coreTestPerfComponent(); // for serialization only
112  coreTestPerfComponent(const coreTestPerfComponent&); // do not implement
113  void operator=(const coreTestPerfComponent&); // do not implement
114 
115  void handleEvent(SST::Event* ev);
116  virtual bool clockTic(SST::Cycle_t);
117 
118  int workPerCycle;
119  int commFreq;
120  int commSize;
121  int neighbor;
122 
124  SST::Link* N;
125  SST::Link* S;
126  SST::Link* E;
127  SST::Link* W;
132 };
133 
134 } // namespace CoreTestPerfComponent
135 } // namespace SST
136 
137 #endif // SST_CORE_CORETEST_PERF_COMPONENT_H
Main component object for the simulation.
Definition: component.h:30
Definition: coreTest_PerfComponent.h:51
Definition: coreTest_PerfComponent.h:30
void finish()
Called after complete phase, but before objects are destroyed.
Definition: coreTest_PerfComponent.h:108
Definition: coreTest_PerfComponent.h:73
Implements a random number generator using the Marsaglia method.
Definition: marsaglia.h:40
Parameter store.
Definition: params.h:55
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:34
void setup()
Called after all components have been constructed and initialization has completed, but before simulation time has begun.
Definition: coreTest_PerfComponent.h:107