12 #ifndef SST_CORE_CORETEST_MESSAGEMESH_ENCLOSINGCOMPONENT_H 13 #define SST_CORE_CORETEST_MESSAGEMESH_ENCLOSINGCOMPONENT_H 15 #include "sst/core/testElements/message_mesh/messageEvent.h" 17 #include "sst/core/component.h" 18 #include "sst/core/event.h" 19 #include "sst/core/link.h" 20 #include "sst/core/rng/rng.h" 21 #include "sst/core/ssthandler.h" 22 #include "sst/core/subcomponent.h" 65 template <
typename classT,
typename dataT =
void>
87 template <
typename classT, auto funcT,
typename dataT =
void>
90 virtual void setNotifyOnReceive(
HandlerBase* functor) { functor_ = functor; }
94 virtual size_t getPortCount() = 0;
98 SubComponent::serialize_order(ser);
118 virtual void send(
MessageEvent* ev,
int incoming_port) = 0;
120 virtual void sendInitialEvents(
int mod) = 0;
130 SST_ELI_REGISTER_COMPONENT(
133 "message_mesh.enclosing_component",
134 SST_ELI_ELEMENT_VERSION(1,0,0),
135 "Base element that encloses the SubComponents that actually provide the functionality",
136 COMPONENT_CATEGORY_NETWORK
139 SST_ELI_DOCUMENT_PARAMS(
140 {
"id",
"Id for this component",
""},
141 {
"mod",
"Port modulus to restrict number of initial events",
"1"},
142 {
"verbose",
"Print message count at end of simulation",
"True"},
143 {
"stats",
"Statistics per component",
"0"}
146 SST_ELI_DOCUMENT_STATISTICS(
147 {
"stat",
"Test statistic",
"count", 1},
150 SST_ELI_DOCUMENT_PORTS(
153 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
154 {
"ports",
"Slot that the ports objects go in",
"SST::CoreTest::MessageMesh::PortInterface" },
155 {
"route",
"Slot that the route object goes in",
"SST::CoreTest::MessageMesh::RouteInterface" }
158 SST_ELI_IS_CHECKPOINTABLE()
164 void setup()
override;
173 std::vector<PortInterface*> ports_;
177 std::vector<Statistic<uint64_t>*> stats_;
180 int message_count_ = 0;
182 bool verbose_ =
true;
191 SST_ELI_REGISTER_SUBCOMPONENT(
194 "message_mesh.port_slot",
195 SST_ELI_ELEMENT_VERSION(1,0,0),
196 "SubComponent implementing PortInterface that simply defers to another loaded PortInterface",
200 SST_ELI_DOCUMENT_PARAMS(
203 SST_ELI_DOCUMENT_STATISTICS(
206 SST_ELI_DOCUMENT_PORTS(
209 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
210 {
"port",
"Slot to load the real PortInterface object",
"SST::CoreTest::MessageMesh::PortInterface" }
213 SST_ELI_IS_CHECKPOINTABLE()
219 void send(
MessageEvent* ev,
size_t index)
override { port_->send(ev, index); }
220 void setNotifyOnReceive(
HandlerBase* functor)
override { port_->setNotifyOnReceive(functor); }
221 size_t getPortCount()
override {
return port_->getPortCount(); }
236 SST_ELI_REGISTER_SUBCOMPONENT(
239 "message_mesh.message_port",
240 SST_ELI_ELEMENT_VERSION(1,0,0),
241 "SubComponent implementing PortInterface for sending and receiving messages",
245 SST_ELI_DOCUMENT_PARAMS(
248 SST_ELI_DOCUMENT_STATISTICS(
251 SST_ELI_DOCUMENT_PORTS(
252 {
"port%d",
"Port to send or receive on", {
"" } },
255 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
263 void handleEvent(
Event* ev);
264 size_t getPortCount()
override {
return links_.size(); }
270 std::vector<Link*> links_;
277 SST_ELI_REGISTER_SUBCOMPONENT(
280 "message_mesh.route_message",
281 SST_ELI_ELEMENT_VERSION(1,0,0),
282 "SubComponent implementing message routing",
286 SST_ELI_DOCUMENT_PARAMS(
289 SST_ELI_DOCUMENT_STATISTICS(
290 {
"msg_count",
"Message counter",
"count", 1},
293 SST_ELI_DOCUMENT_PORTS(
296 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
299 SST_ELI_IS_CHECKPOINTABLE()
301 RouteMessage(ComponentId_t
id,
Params& params, std::vector<PortInterface*>& ports,
int my_id);
305 void send(
MessageEvent* ev,
int incoming_port)
override;
307 void sendInitialEvents(
int mod)
override;
313 std::vector<PortInterface*> ports_;
314 std::vector<size_t> counts_;
323 #endif // SST_CORE_CORETEST_MESSAGEMESH_ENCLOSINGCOMPONENT_H Implements the base class for random number generators for the SST core.
Definition: rng.h:29
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:42
Definition: enclosingComponent.h:28
Base template for handlers which take a class defined argument.
Definition: ssthandler.h:109
Definition: enclosingComponent.h:126
SSTHandlerBase< void, Event * > HandlerBase
Base handler for event delivery.
Definition: enclosingComponent.h:44
Base template for the class.
Definition: ssthandler.h:1273
Handler class with user-data argument.
Definition: ssthandler.h:1136
Main component object for the simulation.
Definition: component.h:30
Definition: messageEvent.h:19
Definition: enclosingComponent.h:232
Definition: enclosingComponent.h:30
void setup() override
Called after all components have been constructed and initialization has completed, but before simulation time has begun.
Definition: enclosingComponent.cc:72
Definition: enclosingComponent.h:187
Definition: enclosingComponent.h:273
Parameter store.
Definition: params.h:63
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:40
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition: subcomponent.h:28
void finish() override
Called after complete phase, but before objects are destroyed.
Definition: enclosingComponent.cc:84
Definition: enclosingComponent.h:107