12#ifndef SST_CORE_LINK_H
13#define SST_CORE_LINK_H
15#include "sst/core/event.h"
16#include "sst/core/rankInfo.h"
17#include "sst/core/serialization/serialize_impl_fwd.h"
18#include "sst/core/sst_types.h"
19#include "sst/core/timeConverter.h"
27#define _LINK_DBG(fmt, args...) __DBG(DBG_LINK, Link, fmt, ##args)
48 void serialize_events(
51 SST_FRIEND_SERIALIZE();
58 enum Type_t : uint16_t { POLL, HANDLER, SYNC, UNINITIALIZED };
59 enum Mode_t : uint8_t { INIT, RUN, COMPLETE };
124 friend class LinkPair;
125 friend class RankSync;
126 friend class ThreadSync;
127 friend class Simulation;
128 friend class SyncManager;
129 friend class ComponentInfo;
130 friend class BaseComponent;
280#ifdef __SST_DEBUG_EVENT_TRACKING__
281 void setSendingComponentInfo(
const std::string& comp_in,
const std::string& type_in,
const std::string& port_in)
288 const std::string& getSendingComponentName() {
return comp; }
289 const std::string& getSendingComponentType() {
return ctype; }
290 const std::string& getSendingPort() {
return port; }
297 void setAsSyncLink() { type = SYNC; }
311 if ( tag != bit_util::type_max<uint32_t> )
pair_link->tag = new_tag;
406 friend class BaseComponent;
408 SimTime_t& current_time;
411 bool has_tool_list =
false;
425 explicit Link(LinkId_t
id);
435 void setLatency(Cycle_t lat);
437 void sendUntimedData_sync(
Event* data);
438 void finalizeConfiguration();
439 void prepareForComplete();
441 std::string createUniqueGlobalLinkName(
442 RankInfo local_rank, uintptr_t local_ptr,
RankInfo remote_rank, uintptr_t remote_ptr);
449 using ToolList = std::vector<std::pair<AttachPoint*, uintptr_t>>;
502#ifdef __SST_DEBUG_EVENT_TRACKING__
512class SelfLink :
public Link
Base Class for a queue of Activities.
Definition activityQueue.h:22
Main component object for the simulation.
Definition baseComponent.h:67
Base serialize class.
Definition serialize.h:132
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
SSTHandlerBase< void, Event * > HandlerBase
Base handler for event delivery.
Definition event.h:48
Defines a pair of links (to define a connected link).
Definition linkPair.h:24
Attach point for inspecting, modifying or dropping events sent on the Link.
Definition link.h:74
virtual void serializeEventAttachPointKey(SST::Core::Serialization::serializer &ser, uintptr_t &key)
Function that will be called to handle the key returned from registerLinkAttachTool,...
Definition link.cc:816
virtual uintptr_t registerLinkAttachTool(const AttachPointMetaData &mdata)=0
Function that will be called when an attach point is registered with the tool implementing the attach...
virtual void eventSent(uintptr_t key, Event *&ev)=0
Function that will be called when an event is sent on a Link with registered attach points.
Link between two components.
Definition link.h:57
Event::HandlerBase * getFunctor()
Get the callback function to be called when a message is delivered.
Definition link.cc:614
void send(SimTime_t delay, Event *event)
Sends an event over a Link with additional delay specified by the Link's default timebase.
Definition link.h:213
TimeConverter getDefaultTimeBase()
Return the default timebase for this Link.
Definition link.cc:739
void sendUntimedData(Event *data)
Send data during the init() or complete() phase.
Definition link.cc:684
uintptr_t delivery_info
Holds the delivery information.
Definition link.h:386
void replaceFunctor(Event::HandlerBase *functor)
Replace the callback function to be called when a message is delivered.
Definition link.cc:597
void setDeliveryInfo(uintptr_t info)
Set the delivery_info for the Link.
Definition link.h:302
SimTime_t latency
Latency of the Link.
Definition link.h:398
SimTime_t defaultTimeBase
Timebase used if no other timebase is specified.
Definition link.h:392
void setFunctor(Event::HandlerBase *functor)
Set the callback function to be called when a message is delivered.
Definition link.cc:585
void setTag(uint32_t new_tag)
Set the tag field for event link ordering.
Definition link.h:309
void send_impl(SimTime_t delay, Event *event)
Sends an Event over a Link with an additional delay specified with a TimeConverter.
Definition link.cc:623
SimTime_t getLatency()
Get the latency on the link in units of core atomic time base.
Definition link.h:326
ActivityQueue * send_queue
Queue of events to be received by the owning component.
Definition link.h:378
void addSendLatency(int cycles, const std::string &timebase)
Set additional Latency to be added to events being sent out of this Link.
Definition link.cc:559
ToolList * attached_tools
This stores any tools connected to the Link::AttachPoint.
Definition link.h:485
void send(SimTime_t delay, TimeConverter tc, Event *event)
Sends an Event over a Link with an additional delay specified with a TimeConverter.
Definition link.h:202
Event * recv()
Retrieve a pending Event from the Link.
Definition link.cc:662
Link * getPairLink()
Get the pair_link.
Definition link.h:336
bool isConfigured()
Return whether Link has been configured.
Definition link.h:277
void send(Event *event)
Send an Event with no additional delay.
Definition link.h:220
void setDefaultTimeBase(TimeConverter tc)
Manually set the default defaultTimeBase.
Definition link.cc:733
Link * pair_link
Pointer to the opposite side of this Link.
Definition link.h:403
uintptr_t getDeliveryInfo()
Get the delivery_info for the link.
Definition link.h:331
static void updateEventDeliveryInfo(Event *event, uintptr_t delivery_info)
Updates the delivery info in an event.
Definition link.h:356
LinkId_t getId()
Return the ID of this Link.
Definition link.h:250
Event * recvUntimedData()
Receive an Event (if any) during the init() or complete() phase.
Definition link.cc:717
LinkId_t id
The Link id is a globally unique id.
Definition link.h:479
static bool is_restart_same_parallelism
Variable used by Link restarts to know whether stored rank data for remote links is still valid (i....
Definition link.h:365
void addRecvLatency(int cycles, const std::string &timebase)
Set additional latency to be added on to events coming in on this Link.
Definition link.cc:572
Main control class for a SST Simulation.
Definition simulation.h:121
A class to convert between a component's view of time and the core's view of time.
Definition timeConverter.h:31
SimTime_t convertToCoreTime(SimTime_t time) const
Converts from the component's view to the core's view of time.
Definition timeConverter.h:79
Performs Unit math in full precision.
Definition unitAlgebra.h:107