SST 12.1.0
Structural Simulation Toolkit
coreTest_Component.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_COMPONENT_H
17#define SST_CORE_CORETEST_COMPONENT_H
18
19#include "sst/core/component.h"
20#include "sst/core/link.h"
21#include "sst/core/rng/marsaglia.h"
22
23namespace SST {
24namespace CoreTestComponent {
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{
32public:
33 SST_ELI_REGISTER_COMPONENT_BASE(SST::CoreTestComponent::coreTestComponentBase)
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 SST_ELI_DOCUMENT_ATTRIBUTES(
48 { "test_element", "true" }
49 )
50
51 coreTestComponentBase(ComponentId_t id) : SST::Component(id) {}
53};
54
56{
57public:
58 SST_ELI_REGISTER_COMPONENT_DERIVED_BASE(
60
61 SST_ELI_DOCUMENT_PARAMS(
62 { "commFreq", "Approximate frequency of sending an event during a clock tick.", NULL},
63 )
64
65 SST_ELI_DOCUMENT_STATISTICS(
66 { "S", "events sent on S link", "counts", 1 }
67 )
68
69 SST_ELI_DOCUMENT_PORTS(
70 {"Slink", "Link to the coreTestComponent to the South", { "coreTestComponent.coreTestComponentEvent", "" } }
71 )
72
73 coreTestComponentBase2(ComponentId_t id) : coreTestComponentBase(id) {}
75};
76
78{
79public:
80 // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
81 SST_ELI_REGISTER_COMPONENT(
83 "coreTestElement",
84 "coreTestComponent",
85 SST_ELI_ELEMENT_VERSION(1,0,0),
86 "CoreTest Test Component",
87 COMPONENT_CATEGORY_PROCESSOR
88 )
89
90 SST_ELI_DOCUMENT_PARAMS(
91 { "commSize", "Size of communication to send.", "16"}
92 )
93
94 SST_ELI_DOCUMENT_STATISTICS(
95 { "E", "events sent on E link", "counts", 1 },
96 { "W", "events sent on W link", "counts", 1 }
97 )
98
99 SST_ELI_DOCUMENT_PORTS(
100 {"Elink", "Link to the coreTestComponent to the East", { "coreTestComponent.coreTestComponentEvent", "" } },
101 {"Wlink", "Link to the coreTestComponent to the West", { "coreTestComponent.coreTestComponentEvent", "" } }
102 )
103
104 // Optional since there is nothing to document
105 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
106 )
107
108 coreTestComponent(SST::ComponentId_t id, SST::Params& params);
110
111 void setup() {}
112 void finish() { printf("Component Finished.\n"); }
113
114private:
115 coreTestComponent(); // for serialization only
116 coreTestComponent(const coreTestComponent&); // do not implement
117 void operator=(const coreTestComponent&); // do not implement
118
119 void handleEvent(SST::Event* ev);
120 virtual bool clockTic(SST::Cycle_t);
121
122 int workPerCycle;
123 int commFreq;
124 int commSize;
125 int neighbor;
126
128 SST::Link* N;
129 SST::Link* S;
130 SST::Link* E;
131 SST::Link* W;
136};
137
138} // namespace CoreTestComponent
139} // namespace SST
140
141#endif // SST_CORE_CORETEST_COMPONENT_H
Main component object for the simulation.
Definition: component.h:31
Definition: coreTest_Component.h:56
Definition: coreTest_Component.h:31
Definition: coreTest_Component.h:78
void setup()
Called after all components have been constructed and initialization has completed,...
Definition: coreTest_Component.h:111
void finish()
Called after complete phase, but before objects are destroyed.
Definition: coreTest_Component.h:112
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:35
Parameter store.
Definition: params.h:56
Implements a random number generator using the Marsaglia method.
Definition: marsaglia.h:41
Forms the template defined base class for statistics gathering within SST.
Definition: statbase.h:361