SST 16.0.0
Structural Simulation Toolkit
SST::Link Class Reference

Link between two components. More...

#include <link.h>

Inheritance diagram for SST::Link:
SST::SelfLink

Data Structures

class  AttachPoint
 Attach point for inspecting, modifying or dropping events sent on the Link. More...

Public Member Functions

void addSendLatency (int cycles, const std::string &timebase)
 Set additional Latency to be added to events being sent out of this Link.
void addSendLatency (SimTime_t cycles, TimeConverter timebase)
 Set additional Latency to be added to events being sent out of this Link.
void addRecvLatency (int cycles, const std::string &timebase)
 Set additional latency to be added on to events coming in on this Link.
void addRecvLatency (SimTime_t cycles, TimeConverter timebase)
 Set additional latency to be added on to events coming in on this Link.
void setFunctor (Event::HandlerBase *functor)
 Set the callback function to be called when a message is delivered.
void replaceFunctor (Event::HandlerBase *functor)
 Replace the callback function to be called when a message is delivered.
Event::HandlerBasegetFunctor ()
 Get the callback function to be called when a message is delivered.
void send (SimTime_t delay, TimeConverter tc, Event *event)
 Sends an Event over a Link with an additional delay specified with a TimeConverter.
void send (SimTime_t delay, Event *event)
 Sends an event over a Link with additional delay specified by the Link's default timebase.
void send (Event *event)
 Send an Event with no additional delay.
Eventrecv ()
 Retrieve a pending Event from the Link.
void setDefaultTimeBase (TimeConverter tc)
 Manually set the default defaultTimeBase.
TimeConverter getDefaultTimeBase ()
 Return the default timebase for this Link.
LinkId_t getId ()
 Return the ID of this Link.
void sendUntimedData (Event *data)
 Send data during the init() or complete() phase.
EventrecvUntimedData ()
 Receive an Event (if any) during the init() or complete() phase.
bool isConfigured ()
 Return whether Link has been configured.

Protected Member Functions

void setAsSyncLink ()
void setDeliveryInfo (uintptr_t info)
 Set the delivery_info for the Link.
void setTag (uint32_t new_tag)
 Set the tag field for event link ordering.
SimTime_t getLatency ()
 Get the latency on the link in units of core atomic time base.
uintptr_t getDeliveryInfo ()
 Get the delivery_info for the link.
Link * getPairLink ()
 Get the pair_link.
void send_impl (SimTime_t delay, Event *event)
 Sends an Event over a Link with an additional delay specified with a TimeConverter.

Static Protected Member Functions

static void updateEventDeliveryInfo (Event *event, uintptr_t delivery_info)
 Updates the delivery info in an event.

Protected Attributes

ActivityQueuesend_queue
 Queue of events to be received by the owning component.
uintptr_t delivery_info
 Holds the delivery information.
SimTime_t defaultTimeBase
 Timebase used if no other timebase is specified.
SimTime_t latency
 Latency of the Link.
Link * pair_link
 Pointer to the opposite side of this Link.

Static Protected Attributes

static bool is_restart_same_parallelism = false
 Variable used by Link restarts to know whether stored rank data for remote links is still valid (i.e.

Friends

class SST::Core::Serialization::serialize_impl< Link * >
class LinkPair
class RankSync
class ThreadSync
class Simulation
class SyncManager
class ComponentInfo
class BaseComponent

Detailed Description

Link between two components.

Carries events

Member Function Documentation

◆ addRecvLatency() [1/2]

void SST::Link::addRecvLatency ( int cycles,
const std::string & timebase )

Set additional latency to be added on to events coming in on this Link.

Parameters
cyclesNumber of cycles to be added
timebaseBase units of cycles

References SST::TimeLord::getSimCycles(), SST::Simulation::getSimulation(), SST::Simulation::getTimeLord(), and pair_link.

◆ addRecvLatency() [2/2]

void SST::Link::addRecvLatency ( SimTime_t cycles,
TimeConverter timebase )

Set additional latency to be added on to events coming in on this Link.

Parameters
cyclesNumber of cycles to be added
timebaseBase units of cycles

References SST::TimeConverter::convertToCoreTime(), and pair_link.

◆ addSendLatency() [1/2]

void SST::Link::addSendLatency ( int cycles,
const std::string & timebase )

Set additional Latency to be added to events being sent out of this Link.

Parameters
cyclesNumber of cycles to be added
timebaseBase units of cycles

References SST::TimeLord::getSimCycles(), SST::Simulation::getSimulation(), SST::Simulation::getTimeLord(), and latency.

◆ addSendLatency() [2/2]

void SST::Link::addSendLatency ( SimTime_t cycles,
TimeConverter timebase )

Set additional Latency to be added to events being sent out of this Link.

Parameters
cyclesNumber of cycles to be added
timebaseBase units of cycles

References SST::TimeConverter::convertToCoreTime(), and latency.

◆ getDefaultTimeBase()

TimeConverter SST::Link::getDefaultTimeBase ( )

Return the default timebase for this Link.

Returns
the default timebase for this Link

References defaultTimeBase, SST::Simulation::getSimulation(), SST::TimeLord::getTimeConverter(), and SST::Simulation::getTimeLord().

◆ getFunctor()

Event::HandlerBase * SST::Link::getFunctor ( )

Get the callback function to be called when a message is delivered.

Polling Links will return nullptr.

Returns
Functor used for event delivery

References pair_link.

◆ getId()

LinkId_t SST::Link::getId ( )
inline

Return the ID of this Link.

Returns
the unique ID for this Link

References attached_tools, and id.

Referenced by SST::RankSyncParallelSkip::registerLink(), SST::RankSyncSerialSkip::registerLink(), and SST::ThreadSyncSimpleSkip::registerLink().

◆ getLatency()

SimTime_t SST::Link::getLatency ( )
inlineprotected

Get the latency on the link in units of core atomic time base.

NOTE: This is a core only API and not part of the public stable API

References latency.

◆ isConfigured()

bool SST::Link::isConfigured ( )
inline

Return whether Link has been configured.

Returns
True if Link has been configured, false otherwise

◆ recv()

Event * SST::Link::recv ( )

Retrieve a pending Event from the Link.

For Links which do not have a set event handler, they can be polled with this function. Returns nullptr if there is no pending Event. Not available for HANDLER-type Links.

Returns
Event if one is available, nullptr if no Event is available

References SST::Output::fatal(), SST::Simulation::getCurrentSimCycle(), SST::Activity::getDeliveryTime(), SST::Simulation::getSimulation(), SST::Simulation::getSimulationOutput(), and pair_link.

◆ recvUntimedData()

Event * SST::Link::recvUntimedData ( )

Receive an Event (if any) during the init() or complete() phase.

Returns
Event if one is available, nullptr if no Event is available

References SST::Activity::getDeliveryTime(), SST::Simulation::getSimulation(), and pair_link.

◆ replaceFunctor()

void SST::Link::replaceFunctor ( Event::HandlerBase * functor)

Replace the callback function to be called when a message is delivered.

Any previous handler will be deleted. Not available for Polling Links.

Parameters
functorFunctor to call when message is delivered

References SST::Output::fatal(), SST::Simulation::getSimulation(), SST::Simulation::getSimulationOutput(), pair_link, and SST::SSTHandlerBase< returnT, argT >::transferAttachedToolInfo().

◆ send() [1/3]

void SST::Link::send ( Event * event)
inline

Send an Event with no additional delay.

Parameters
eventEvent to send

References send_impl().

◆ send() [2/3]

void SST::Link::send ( SimTime_t delay,
Event * event )
inline

Sends an event over a Link with additional delay specified by the Link's default timebase.

Parameters
delayThe additional delay, in units of the Link's default timebase
eventEvent to send

References defaultTimeBase, and send_impl().

◆ send() [3/3]

void SST::Link::send ( SimTime_t delay,
TimeConverter tc,
Event * event )
inline

Sends an Event over a Link with an additional delay specified with a TimeConverter.

I.e. the total delay is the Link's delay + the additional specified delay.

Parameters
delayAdditional delay
tcTimeConverter to specify timebase for the additional delay
eventEvent to send

References SST::TimeConverter::convertToCoreTime(), and send_impl().

◆ send_impl()

void SST::Link::send_impl ( SimTime_t delay,
Event * event )
protected

Sends an Event over a Link with an additional delay specified with a TimeConverter.

I.e. the total delay is the Link's delay + the additional specified delay.

Parameters
delayAdditional total delay to add in units of the core timebase
eventEvent to send

References attached_tools, delivery_info, SST::Output::fatal(), SST::Simulation::getSimulation(), SST::Simulation::getSimulationOutput(), latency, pair_link, and send_queue.

Referenced by send(), send(), and send().

◆ sendUntimedData()

void SST::Link::sendUntimedData ( Event * data)

Send data during the init() or complete() phase.

Parameters
Dataevent to send

References delivery_info, SST::Output::fatal(), SST::Simulation::getSimulation(), SST::Simulation::getSimulationOutput(), pair_link, send_queue, and SST::Activity::setDeliveryTime().

◆ setDefaultTimeBase()

void SST::Link::setDefaultTimeBase ( TimeConverter tc)

Manually set the default defaultTimeBase.

Parameters
tcTimeConverter object for the timebase

References defaultTimeBase, and SST::TimeConverter::getFactor().

◆ setFunctor()

void SST::Link::setFunctor ( Event::HandlerBase * functor)

Set the callback function to be called when a message is delivered.

Not available for Polling Links.

Parameters
functorFunctor to call when message is delivered

References SST::Output::fatal(), SST::Simulation::getSimulation(), SST::Simulation::getSimulationOutput(), and pair_link.

◆ setTag()

void SST::Link::setTag ( uint32_t new_tag)
inlineprotected

Set the tag field for event link ordering.

Parameters
new_tagNew order tag to use for the Link

References pair_link.

◆ updateEventDeliveryInfo()

void SST::Link::updateEventDeliveryInfo ( Event * event,
uintptr_t delivery_info )
inlinestaticprotected

Updates the delivery info in an event.

This is used during a restart and is implemented here because Link is a friend of Event.

Parameters
eventEvent to update
delivery_infoNew delivery info (pointer to handler cast as uintptr_t)

References delivery_info.

Field Documentation

◆ attached_tools

ToolList* SST::Link::attached_tools

This stores any tools connected to the Link::AttachPoint.

The first entry in the list will always contain the Link id since the pointer to the attached_tools list is now using that memory location.

Referenced by getId(), and send_impl().

◆ defaultTimeBase

SimTime_t SST::Link::defaultTimeBase
protected

Timebase used if no other timebase is specified.

Used to specify the units for added delays when sending, such as in Link::send(). Often set by the Component::registerClock() function if the regAll argument is true.

Referenced by getDefaultTimeBase(), send(), and setDefaultTimeBase().

◆ delivery_info

uintptr_t SST::Link::delivery_info
protected

Holds the delivery information.

This is stored as a uintptr_t, but is actually a pointer converted using reinterpret_cast. For Links connected to a Component/SubComponent, this holds a pointer to the delivery functor. For Links connected to a Sync object, this holds a pointer to the remote Link to send the event on after synchronization.

Referenced by getDeliveryInfo(), SST::ThreadSync::getDeliveryInfo(), send_impl(), sendUntimedData(), setDeliveryInfo(), and updateEventDeliveryInfo().

◆ id

LinkId_t SST::Link::id

The Link id is a globally unique id.

For serial loads, the ids start at 1 and increment for each new Link.

On a parallel load, the top 32-bits is filled with the MPI rank and the bottom 32-bits start at 1 and increment for each new rank. The ids for links that cross a rank boundary need to be reconciled so that the Link objects on both ranks agree on the ID. This is done by having the "lower" rank send the Link name and it's id for the Link to the "higher" rank, which will then use that id for the Link. "Higher" and "lower" are determined in a way that hopefully spreads out the MPI traffic across all the ranks and isn't just a direct greater/less than comparison. It is determined as follows:

1 - A rank is lower than the N/2 ranks after it, wrapping around to 0 when needed.

2 - A rank is higher than the N/2 ranks before it, wrapping around to N-1 when needed.

The id is used in several places:

  • When exchanging Link pointers to put in the delivery_info field
  • As the global name for connecting links on a restart from checkpoint

Referenced by getId().

◆ is_restart_same_parallelism

bool SST::Link::is_restart_same_parallelism = false
staticprotected

Variable used by Link restarts to know whether stored rank data for remote links is still valid (i.e.

did we restart with the exact same rank/thread count or not).

◆ latency

SimTime_t SST::Link::latency
protected

Latency of the Link.

It is used by the partitioner as the weight. This latency is added to the delay put on the event by the component.

Referenced by addSendLatency(), addSendLatency(), getLatency(), SST::ThreadSync::getLatency(), and send_impl().


The documentation for this class was generated from the following files:
  • src/sst/core/link.h
  • src/sst/core/link.cc