SST  14.1.0
StructuralSimulationToolkit
coreTest_PerfComponent.h
1 // Copyright 2009-2024 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-2024, NTESS
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_CORETEST_PERF_COMPONENT_H
13 #define SST_CORE_CORETEST_PERF_COMPONENT_H
14 
15 #include <sst/core/component.h>
16 #include <sst/core/link.h>
17 #include <sst/core/rng/marsaglia.h>
18 
19 namespace SST {
20 namespace CoreTestPerfComponent {
21 
22 // These first two classes are just base classes to test ELI
23 // inheritance. The definition of the ELI items are spread through 2
24 // component base classes to make sure they get inherited in the
25 // actual component that can be instanced.
27 {
28 public:
29  SST_ELI_REGISTER_COMPONENT_BASE(SST::CoreTestPerfComponent::coreTestPerfComponentBase)
30 
31  SST_ELI_DOCUMENT_PARAMS(
32  { "workPerCycle", "Count of busy work to do during a clock tick.", NULL}
33  )
34 
35  SST_ELI_DOCUMENT_STATISTICS(
36  { "N", "events sent on N link", "counts", 1 }
37  )
38 
39  SST_ELI_DOCUMENT_PORTS(
40  {"Nlink", "Link to the coreTestComponent to the North", { "coreTestComponent.coreTestComponentEvent", "" } }
41  )
42 
43  coreTestPerfComponentBase(ComponentId_t id) : SST::Component(id) {}
45 };
46 
48 {
49 public:
50  SST_ELI_REGISTER_COMPONENT_DERIVED_BASE(
52 
53  SST_ELI_DOCUMENT_PARAMS(
54  { "commFreq", "Approximate frequency of sending an event during a clock tick.", NULL},
55  )
56 
57  SST_ELI_DOCUMENT_STATISTICS(
58  { "S", "events sent on S link", "counts", 1 }
59  )
60 
61  SST_ELI_DOCUMENT_PORTS(
62  {"Slink", "Link to the coreTestComponent to the South", { "coreTestComponent.coreTestComponentEvent", "" } }
63  )
64 
65  coreTestPerfComponentBase2(ComponentId_t id) : coreTestPerfComponentBase(id) {}
67 };
68 
70 {
71 public:
72  // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
73  SST_ELI_REGISTER_COMPONENT(
75  "coreTestElement",
76  "coreTestPerfComponent",
77  SST_ELI_ELEMENT_VERSION(1,0,0),
78  "CoreTest Test Perf Component",
79  COMPONENT_CATEGORY_PROCESSOR
80  )
81 
82  SST_ELI_DOCUMENT_PARAMS(
83  { "commSize", "Size of communication to send.", "16"}
84  )
85 
86  SST_ELI_DOCUMENT_STATISTICS(
87  { "E", "events sent on E link", "counts", 1 },
88  { "W", "events sent on W link", "counts", 1 }
89  )
90 
91  SST_ELI_DOCUMENT_PORTS(
92  {"Elink", "Link to the coreTestComponent to the East", { "coreTestComponent.coreTestComponentEvent", "" } },
93  {"Wlink", "Link to the coreTestComponent to the West", { "coreTestComponent.coreTestComponentEvent", "" } }
94  )
95 
96  // Optional since there is nothing to document
97  SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
98  )
99 
100  coreTestPerfComponent(SST::ComponentId_t id, SST::Params& params);
102 
103  void setup() {}
104  void finish() { printf("Perf Test Component Finished.\n"); }
105 
106 private:
107  coreTestPerfComponent(); // for serialization only
108  coreTestPerfComponent(const coreTestPerfComponent&); // do not implement
109  void operator=(const coreTestPerfComponent&); // do not implement
110 
111  void handleEvent(SST::Event* ev);
112  virtual bool clockTic(SST::Cycle_t);
113 
114  int workPerCycle;
115  int commFreq;
116  int commSize;
117  int neighbor;
118 
120  SST::Link* N;
121  SST::Link* S;
122  SST::Link* E;
123  SST::Link* W;
128 };
129 
130 } // namespace CoreTestPerfComponent
131 } // namespace SST
132 
133 #endif // SST_CORE_CORETEST_PERF_COMPONENT_H
Main component object for the simulation.
Definition: component.h:30
Definition: action.cc:18
Definition: coreTest_PerfComponent.h:47
Definition: coreTest_PerfComponent.h:26
void finish()
Called after complete phase, but before objects are destroyed.
Definition: coreTest_PerfComponent.h:104
Definition: coreTest_PerfComponent.h:69
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:103