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