14 #ifndef CORE_INTERFACES_SIMPLENETWORK_H_
15 #define CORE_INTERFACES_SIMPLENETWORK_H_
18 #include <unordered_map>
20 #include <sst/core/sst_types.h>
21 #include <sst/core/warnmacros.h>
22 #include <sst/core/subcomponent.h>
23 #include <sst/core/params.h>
25 #include <sst/core/serialization/serializable.h>
33 namespace Interfaces {
45 static const nid_t INIT_BROADCAST_ADDR;
109 trace(
NONE), traceID(0)
114 dest(dest), src(src), size_in_bits(size_in_bits), head(head), tail(tail), payload(payload),
115 trace(
NONE), traceID(0)
121 if ( payload != NULL )
delete payload;
128 if ( payload != NULL ) req->payload = payload->
clone();
132 void setTraceID(
int id) {traceID = id;}
133 void setTraceType(
TraceType type) {trace = type;}
134 int getTraceID() {
return traceID;}
169 virtual void inspectNetworkData(
Request* req) = 0;
185 virtual bool operator()(
int) = 0;
194 template <
typename classT,
typename argT =
void>
197 typedef bool (classT::*PtrMember)(int, argT);
199 const PtrMember member;
208 Handler( classT*
const object, PtrMember member, argT data ) :
214 bool operator()(
int vn) {
215 return (object->*member)(vn,data);
222 template <
typename classT>
225 typedef bool (classT::*PtrMember)(int);
227 const PtrMember member;
234 Handler( classT*
const object, PtrMember member ) :
239 bool operator()(
int vn) {
240 return (object->*member)(vn);
316 virtual bool send(Request *req,
int vn) = 0;
328 virtual Request*
recv(
int vn) = 0;
331 virtual void init(
unsigned int UNUSED(phase))
override {}
332 virtual void complete(
unsigned int UNUSED(phase))
override {}
343 virtual bool spaceToSend(
int vn,
int num_bits) = 0;
virtual bool isNetworkInitialized() const =0
Check to see if network is initialized.
Definition: simpleNetwork.h:101
nid_t src
Definition: simpleNetwork.h:54
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
Event * inspectPayload()
Returns the payload for the request for inspection.
Definition: simpleNetwork.h:92
Definition: simpleNetwork.h:102
void givePayload(Event *event)
Sets the payload field for this request.
Definition: simpleNetwork.h:69
virtual Request * recv(int vn)=0
Receive a Request from the network.
virtual bool initialize(const std::string &portName, const UnitAlgebra &link_bw, int vns, const UnitAlgebra &in_buf_size, const UnitAlgebra &out_buf_size)=0
Second half of building the interface.
virtual void sendInitData(Request *req)=0
Sends a network request during the init() phase.
Main component object for the simulation.
Definition: component.h:32
Handler(classT *const object, PtrMember member, argT data)
Constructor.
Definition: simpleNetwork.h:208
virtual Request * recvUntimedData()
Receive any data during untimed phases (init() and complete()).
Definition: simpleNetwork.h:304
virtual void sendUntimedData(Request *req)
Sends a network request during untimed phases (init() and complete()).
Definition: simpleNetwork.h:288
bool tail
Definition: simpleNetwork.h:58
virtual void setup() override
Called after all components have been constructed and initialization has completed, but before simulation time has begun.
Definition: simpleNetwork.h:330
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:107
nid_t dest
Definition: simpleNetwork.h:53
virtual nid_t getEndpointID() const =0
Returns the endpoint ID.
Functor classes for handling of callbacks.
Definition: simpleNetwork.h:183
Definition: serializable.h:109
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:331
SimpleNetwork(SST::Component *comp)
Constructor, designed to be used via 'loadSubComponent'.
Definition: simpleNetwork.h:247
Handler(classT *const object, PtrMember member)
Constructor.
Definition: simpleNetwork.h:234
Definition: simpleNetwork.h:100
Represents both network sends and receives.
Definition: simpleNetwork.h:50
virtual void finish() override
Called after simulation completes, but before objects are destroyed.
Definition: simpleNetwork.h:333
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.
TraceType
Trace types.
Definition: simpleNetwork.h:99
Event Handler class with user-data argument.
Definition: simpleNetwork.h:195
bool head
Definition: simpleNetwork.h:57
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:56
Event * takePayload()
Returns the payload for the request.
Definition: simpleNetwork.h:79
int64_t nid_t
All Addresses can be 64-bit.
Definition: simpleNetwork.h:43
virtual void initialize(std::string id)=0
The ID uniquely identifies the component in which this subcomponent is instantiated.
Generic network interface.
Definition: simpleNetwork.h:39
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:104
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:160
virtual void complete(unsigned int UNUSED(phase)) override
Used during the init phase.
Definition: simpleNetwork.h:332
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition: subcomponent.h:29
virtual Event * clone()
Clones the event in for the case of a broadcast.
Definition: event.cc:33
int vn
Definition: simpleNetwork.h:55
Definition: serializable.h:130