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