12#ifndef SST_CORE_CORETEST_SUBCOMPONENT_H
13#define SST_CORE_CORETEST_SUBCOMPONENT_H
15#include "sst/core/component.h"
16#include "sst/core/link.h"
17#include "sst/core/subcomponent.h"
22namespace SST::CoreTestSubComponent {
40 SubCompEvent(
bool last) :
45 SubCompEvent() =
default;
51 Event::serialize_order(ser);
55 ImplementSerializable(SubCompEvent);
63 explicit SubCompInterface(ComponentId_t
id) :
66 SubCompInterface(ComponentId_t
id,
Params& UNUSED(params)) :
72 virtual ~SubCompInterface() {}
73 virtual void clock(SST::Cycle_t) {}
77 SST::SubComponent::serialize_order(ser);
82class SubCompSlotInterface :
public SubCompInterface
88 SST_ELI_DOCUMENT_PARAMS(
89 {
"num_subcomps",
"Number of anonymous SubComponents to load. Ignored if using name SubComponents.",
"1"}
92 SST_ELI_DOCUMENT_PORTS(
93 {
"test",
"Just a test port", {
"coreTestMessageGeneratorComponent.coreTestMessage",
"" } },
96 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
99 explicit SubCompSlotInterface(ComponentId_t
id) :
102 SubCompSlotInterface(ComponentId_t
id,
Params& UNUSED(params)) :
105 virtual ~SubCompSlotInterface() {}
107 SubCompSlotInterface() {}
113class SubComponentLoader :
public Component
117 SST_ELI_REGISTER_COMPONENT(
120 "SubComponentLoader",
121 SST_ELI_ELEMENT_VERSION(1,0,0),
122 "Demonstrates subcomponents",
123 COMPONENT_CATEGORY_UNCATEGORIZED
126 SST_ELI_DOCUMENT_PARAMS(
127 {
"clock",
"Clock Rate",
"1GHz"},
128 {
"unnamed_subcomponent",
"Unnamed SubComponent to load. If empty, then a named subcomponent is loaded",
""},
129 {
"num_subcomps",
"Number of anonymous SubComponents to load. Ignored if using name SubComponents.",
"1"},
130 {
"verbose",
"Verbosity level",
"0"},
133 SST_ELI_DOCUMENT_STATISTICS(
134 {
"totalSent",
"# of total messages sent",
"", 1},
138 SST_ELI_DOCUMENT_PORTS(
139 {
"port%d",
"Sending or Receiving Port(s)", {
"coreTestMessageGeneratorComponent.coreTestMessage",
"" } },
142 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
143 {
"mySubComp",
"Test slot",
"SST::CoreTestSubComponent::SubCompInterface" }
146 SST_ELI_IS_CHECKPOINTABLE()
148 SubComponentLoader(ComponentId_t
id,
SST::Params& params);
150 SubComponentLoader() {}
153 SST::Component::serialize_order(ser);
161 bool tick(SST::Cycle_t);
162 std::vector<SubCompInterface*> subComps;
166class SubCompSlot :
public SubCompSlotInterface
169 SST_ELI_REGISTER_SUBCOMPONENT(
173 SST_ELI_ELEMENT_VERSION(1,0,0),
174 "Subcomponent which is just a wrapper for the actual SubComponent to be used",
178 SST_ELI_DOCUMENT_PARAMS(
179 {
"unnamed_subcomponent",
"Unnamed SubComponent to load. If empty, then a named subcomponent is loaded",
""},
180 {
"verbose",
"Verbosity level",
"0"},
184 SST_ELI_DOCUMENT_PORTS(
185 {
"slot_port%d",
"Port(s) to send or receive on", {
"coreTestMessageGeneratorComponent.coreTestMessage",
"" } },
188 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
189 {
"mySubCompSlot",
"Test slot",
"SST::CoreTestSubComponent::SubCompInterface" }
192 SST_ELI_IS_CHECKPOINTABLE()
197 SubCompSlotInterface::serialize_order(ser);
203 std::vector<SubCompInterface*> subComps;
206 SubCompSlot(ComponentId_t
id,
Params& params);
208 SubCompSlot(ComponentId_t
id, std::string unnamed_sub);
211 void clock(Cycle_t)
override;
215class SubCompSendRecvInterface :
public SubCompInterface
222 SST_ELI_REGISTER_SUBCOMPONENT(
223 SubCompSendRecvInterface,
226 SST_ELI_ELEMENT_VERSION(1,0,0),
227 "Default Subcomponent for ELI testing only",
231 SST_ELI_DOCUMENT_PARAMS(
232 {
"port_name",
"Name of port to connect to",
""},
233 {
"sendCount",
"Number of Messages to Send",
"10"},
234 {
"verbose",
"Verbosity level",
"0"}
237 SST_ELI_DOCUMENT_PORTS(
238 {
"sendPort",
"Sending Port", {
"coreTestMessageGeneratorComponent.coreTestMessage",
"" } },
242 {
"slot_port%d",
"This is just a test port that duplicates a port from the SubComponent that will instance it", {
"",
"" } },
245 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
248 SST_ELI_DOCUMENT_STATISTICS(
249 {
"numRecv",
"# of msgs recv",
"", 1},
252 SST_ELI_IS_CHECKPOINTABLE()
254 explicit SubCompSendRecvInterface(ComponentId_t
id) :
257 SubCompSendRecvInterface(ComponentId_t
id,
Params& UNUSED(params)) :
260 virtual ~SubCompSendRecvInterface() {}
262 SubCompSendRecvInterface() {}
267class SubCompSender :
public SubCompSendRecvInterface
271 SST_ELI_REGISTER_SUBCOMPONENT(
275 SST_ELI_ELEMENT_VERSION(1,0,0),
276 "Sending Subcomponent",
280 SST_ELI_REGISTER_ALIAS(
"SubCompSender_alias")
282 SST_ELI_DOCUMENT_PARAMS(
285 SST_ELI_DOCUMENT_STATISTICS(
286 SST_ELI_DELETE_STAT(
"numRecv"),
287 {
"numSent",
"# of msgs sent",
"", 1},
290 SST_ELI_DOCUMENT_PORTS(
291 {
"sendPort",
"Sending Port", {
"coreTestMessageGeneratorComponent.coreTestMessage",
"" } },
294 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
295 {
"test_slot",
"Test slot",
"" }
298 SST_ELI_IS_CHECKPOINTABLE()
303 SubCompSendRecvInterface::serialize_order(ser);
307 SST_SER(totalMsgSent);
320 SubCompSender(ComponentId_t
id,
Params& params);
322 SubCompSender(ComponentId_t
id, uint32_t nToSend,
const std::string& port_name);
324 void clock(Cycle_t)
override;
327class SubCompReceiver :
public SubCompSendRecvInterface
332 SST_ELI_REGISTER_SUBCOMPONENT(
336 SST_ELI_ELEMENT_VERSION(1,0,0),
337 "Receiving Subcomponent",
341 SST_ELI_DOCUMENT_PARAMS(
342 SST_ELI_DELETE_PARAM(
"sendCount")
345 SST_ELI_DOCUMENT_STATISTICS(
348 SST_ELI_DOCUMENT_PORTS(
349 SST_ELI_DELETE_PORT(
"sendPort"),
350 {
"recvPort",
"Receiving Port", {
"coreTestMessageGeneratorComponent.coreTestMessage",
"" } },
353 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
354 SST_ELI_DELETE_SUBCOMPONENT_SLOT(
"test_slot")
357 SST_ELI_IS_CHECKPOINTABLE()
362 SubCompSendRecvInterface::serialize_order(ser);
364 SST_SER(nMsgReceived);
374 uint32_t numRecv = 0;
379 SubCompReceiver(ComponentId_t
id,
Params& params);
380 SubCompReceiver(ComponentId_t
id, std::string port);
381 ~SubCompReceiver() {}
382 void clock(Cycle_t)
override;
Definition coreTest_SubComponent.h:59
Definition coreTest_SubComponent.h:328
Definition coreTest_SubComponent.h:216
Definition coreTest_SubComponent.h:268
Definition coreTest_SubComponent.h:83
Definition coreTest_SubComponent.h:167
Definition coreTest_SubComponent.h:114
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:43
Base class for Events - Items sent across links to communicate between components.
Definition event.h:41
Link between two components.
Definition link.h:57
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition output.h:58
Parameter store.
Definition params.h:65
Forms the template defined base class for statistics gathering within SST.
Definition statbase.h:369
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition subcomponent.h:29