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)
49 SST_FRIEND_SERIALIZE();
56 enum Type_t : uint16_t { POLL, HANDLER, SYNC, UNINITIALIZED };
57 enum Mode_t : uint16_t { INIT, RUN, COMPLETE };
122 friend class LinkPair;
123 friend class RankSync;
124 friend class ThreadSync;
125 friend class Simulation_impl;
126 friend class SyncManager;
127 friend class ComponentInfo;
141 [[deprecated(
"Use of shared TimeConverter objects is deprecated. Use 'addSendLatency(SimTime_t cycles, "
142 "TimeConverter timebase)' (i.e., no pointer) instead.")]]
156 [[deprecated(
"Use of shared TimeConverter objects is deprecated. Use 'addRecvLatency(SimTime_t cycles, "
157 "TimeConverter timebase)' (i.e., no pointer) instead.")]]
188 "Use of shared TimeConverter objects is deprecated. Use 'send(SimTime_t delay, const TimeConverter& tc, "
189 "Event* event)' instead.")]]
192 send(delay, *tc, event);
232 [[deprecated(
"Use of shared TimeConverter objects is deprecated. Use 'setDefaultTimeBase(TimeConverter tc)', "
233 "(i.e., no pointer) instead.")]]
272#ifdef __SST_DEBUG_EVENT_TRACKING__
273 void setSendingComponentInfo(
const std::string& comp_in,
const std::string& type_in,
const std::string& port_in)
280 const std::string& getSendingComponentName() {
return comp; }
281 const std::string& getSendingComponentType() {
return ctype; }
282 const std::string& getSendingPort() {
return port; }
289 void setAsSyncLink() { type = SYNC; }
343 friend class BaseComponent;
345 SimTime_t& current_time;
362 explicit Link(LinkId_t tag);
373 void setLatency(Cycle_t lat);
375 void sendUntimedData_sync(
Event* data);
376 void finalizeConfiguration();
377 void prepareForComplete();
379 std::string createUniqueGlobalLinkName(
380 RankInfo local_rank, uintptr_t local_ptr,
RankInfo remote_rank, uintptr_t remote_ptr);
384 void detachTool(AttachPoint* tool);
387 using ToolList = std::vector<std::pair<AttachPoint*, uintptr_t>>;
388 ToolList* attached_tools;
399#ifdef __SST_DEBUG_EVENT_TRACKING__
407class SelfLink :
public Link
Base Class for a queue of Activities.
Definition activityQueue.h:22
Main component object for the simulation.
Definition baseComponent.h:62
Base serialize class.
Definition serialize.h:110
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:45
Base class for Events - Items sent across links to communicate between components.
Definition event.h:35
SSTHandlerBase< void, Event * > HandlerBase
Base handler for event delivery.
Definition event.h:40
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:72
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:976
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:55
Event::HandlerBase * getFunctor()
Get the callback function to be called when a message is delivered.
Definition link.cc:765
void send(SimTime_t delay, Event *event)
Send an event with additional delay.
Definition link.h:212
void sendUntimedData(Event *data)
Send data during the init() or complete() phase.
Definition link.cc:834
uintptr_t delivery_info
Holds the delivery information.
Definition link.h:324
void replaceFunctor(Event::HandlerBase *functor)
Replace the callback function to be called when a message is delivered.
Definition link.cc:748
void setDeliveryInfo(uintptr_t info)
Set the delivery_info for the link.
Definition link.h:294
SimTime_t latency
Latency of the link.
Definition link.h:337
SimTime_t defaultTimeBase
Timebase used if no other timebase is specified.
Definition link.h:331
TimeConverter * getDefaultTimeBase()
Return the default Time Base for this link.
Definition link.cc:898
void setFunctor(Event::HandlerBase *functor)
Set the callback function to be called when a message is delivered.
Definition link.cc:736
void send(SimTime_t delay, TimeConverter *tc, Event *event)
Send an event over the link with additional delay.
Definition link.h:190
void send_impl(SimTime_t delay, Event *event)
Send an event over the link with additional delay.
Definition link.cc:774
void setDefaultTimeBase(TimeConverter *tc)
Manually set the default defaultTimeBase.
Definition link.cc:883
ActivityQueue * send_queue
Queue of events to be received by the owning component.
Definition link.h:314
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:698
void send(SimTime_t delay, TimeConverter tc, Event *event)
Send an event over the link with additional delay.
Definition link.h:203
Event * recv()
Retrieve a pending event from the Link.
Definition link.cc:812
bool isConfigured()
Return whether link has been configured.
Definition link.h:270
void send(Event *event)
Send an event with the Link's default delay.
Definition link.h:217
Link * pair_link
Pointer to the opposite side of this link.
Definition link.h:340
LinkId_t getId()
Return the ID of this link.
Definition link.h:254
Event * recvUntimedData()
Receive an event (if any) during the init() or complete() phase.
Definition link.cc:867
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:717
Main control class for a SST Simulation.
Definition simulation_impl.h:87
A class to convert between a component's view of time and the core's view of time.
Definition timeConverter.h:28
SimTime_t convertToCoreTime(SimTime_t time) const
Converts from the component's view to the core's view of time.
Definition timeConverter.h:62
Performs Unit math in full precision.
Definition unitAlgebra.h:107