14 #ifndef SST_CORE_INTERFACES_SIMPLENETWORK_H
15 #define SST_CORE_INTERFACES_SIMPLENETWORK_H
17 #include "sst/core/params.h"
18 #include "sst/core/serialization/serializable.h"
19 #include "sst/core/sst_types.h"
20 #include "sst/core/ssthandler.h"
21 #include "sst/core/subcomponent.h"
22 #include "sst/core/warnmacros.h"
25 #include <unordered_map>
33 namespace Interfaces {
47 static const nid_t INIT_BROADCAST_ADDR;
112 allow_adaptive(true),
118 Request(nid_t dest, nid_t src,
size_t size_in_bits,
bool head,
bool tail,
Event* payload =
nullptr) :
121 size_in_bits(size_in_bits),
124 allow_adaptive(true),
132 if ( payload !=
nullptr )
delete payload;
135 inline Request* clone()
137 Request* req =
new Request(*
this);
140 if ( payload !=
nullptr ) req->payload = payload->
clone();
144 void setTraceID(
int id) { traceID = id; }
145 void setTraceType(TraceType type) { trace = type; }
146 int getTraceID() {
return traceID; }
147 TraceType getTraceType() {
return trace; }
183 virtual void inspectNetworkData(Request* req) = 0;
215 template <
typename classT,
typename dataT =
void>
271 virtual bool send(Request* req,
int vn) = 0;
283 virtual Request*
recv(
int vn) = 0;
286 virtual void init(
unsigned int UNUSED(phase))
override {}
287 virtual void complete(
unsigned int UNUSED(phase))
override {}
298 virtual bool spaceToSend(
int vn,
int num_bits) = 0;
353 #endif // SST_CORE_INTERFACES_SIMPLENETWORK_H
virtual bool isNetworkInitialized() const =0
Check to see if network is initialized.
Definition: simpleNetwork.h:101
nid_t src
Definition: simpleNetwork.h:57
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:34
Definition: ssthandler.h:100
Event * inspectPayload()
Returns the payload for the request for inspection.
Definition: simpleNetwork.h:94
bool allow_adaptive
Definition: simpleNetwork.h:62
void givePayload(Event *event)
Sets the payload field for this request.
Definition: simpleNetwork.h:72
virtual Request * recv(int vn)=0
Receive a Request from the network.
Event Handler class with user-data argument.
Definition: ssthandler.h:115
virtual void sendInitData(Request *req)=0
Sends a network request during the init() phase.
virtual Request * recvUntimedData()
Receive any data during untimed phases (init() and complete()).
Definition: simpleNetwork.h:261
virtual void sendUntimedData(Request *req)
Sends a network request during untimed phases (init() and complete()).
Definition: simpleNetwork.h:247
bool tail
Definition: simpleNetwork.h:61
virtual void setup() override
Called after all components have been constructed and initialization has completed, but before simulation time has begun.
Definition: simpleNetwork.h:285
virtual void setNotifyOnReceive(HandlerBase *functor)=0
Registers a functor which will fire when a new request is received from the network.
Request()
Constructor.
Definition: simpleNetwork.h:106
nid_t dest
Definition: simpleNetwork.h:56
virtual nid_t getEndpointID() const =0
Returns the endpoint ID.
Definition: serializable.h:118
virtual Request * recvInitData()=0
Receive any data during the init() phase.
virtual void init(unsigned int UNUSED(phase)) override
Used during the init phase.
Definition: simpleNetwork.h:286
SimpleNetwork(SST::ComponentId_t id)
Constructor, designed to be used via 'loadUserSubComponent or loadAnonymousSubComponent'.
Definition: simpleNetwork.h:221
Definition: simpleNetwork.h:100
Represents both network sends and receives.
Definition: simpleNetwork.h:52
virtual void finish() override
Called after simulation completes, but before objects are destroyed.
Definition: simpleNetwork.h:288
virtual bool send(Request *req, int vn)=0
Returns a handle to the underlying SST::Link.
virtual const UnitAlgebra & getLinkBW() const =0
Returns the final BW of the link managed by the simpleNetwork instance.
bool head
Definition: simpleNetwork.h:60
SSTHandlerBase< bool, int, false > HandlerBase
Base handler for event delivery.
Definition: simpleNetwork.h:189
virtual bool requestToReceive(int vn)=0
Checks if there is a waiting network request request pending in the specified virtual network...
virtual bool spaceToSend(int vn, int num_bits)=0
Checks if there is sufficient space to send on the specified virtual network.
size_t size_in_bits
Definition: simpleNetwork.h:59
Event * takePayload()
Returns the payload for the request.
Definition: simpleNetwork.h:80
int64_t nid_t
All Addresses can be 64-bit.
Definition: simpleNetwork.h:45
Generic network interface.
Definition: simpleNetwork.h:38
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:31
Performs Unit math in full precision.
Definition: unitAlgebra.h:106
virtual void setNotifyOnSend(HandlerBase *functor)=0
Registers a functor which will fire when a request is sent to the network.
Class used to inspect network requests going through the network.
Definition: simpleNetwork.h:173
virtual void complete(unsigned int UNUSED(phase)) override
Used during the init phase.
Definition: simpleNetwork.h:287
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition: subcomponent.h:28
virtual Event * clone()
Clones the event in for the case of a broadcast.
Definition: event.cc:33
int vn
Definition: simpleNetwork.h:58
Definition: serializable.h:138