12#ifndef SST_CORE_EVENT_H
13#define SST_CORE_EVENT_H
15#include "sst/core/activity.h"
16#include "sst/core/sst_types.h"
17#include "sst/core/ssthandler.h"
40class Event :
public Activity
68 template <
typename classT, auto funcT,
typename dataT =
void>
75 template <
typename classT, auto funcT,
typename dataT =
void>
76 using Handler2 [[deprecated(
77 "The name Handler2 has been deprecated and will be removed in SST 17. Please rename Handler2 to Handler.")]]
94 bool operator()(
const Event* lhs,
const Event* rhs)
const
96 if ( lhs->delivery_info != rhs->delivery_info )
return lhs->delivery_info < rhs->delivery_info;
112#if __SST_DEBUG_EVENT_TRACKING__
117 ~Event()
override =
default;
123#ifdef __SST_DEBUG_EVENT_TRACKING__
125 virtual void printTrackingInfo(
const std::string& header,
Output& out)
const override
127 out.
output(
"%s Event first sent from: %s:%s (type: %s) and last received by %s:%s (type: %s)\n", header.c_str(),
128 first_comp.c_str(), first_port.c_str(), first_type.c_str(), last_comp.c_str(), last_port.c_str(),
132 const std::string& getFirstComponentName() {
return first_comp; }
133 const std::string& getFirstComponentType() {
return first_type; }
134 const std::string& getFirstPort() {
return first_port; }
135 const std::string& getLastComponentName() {
return last_comp; }
136 const std::string& getLastComponentType() {
return last_type; }
137 const std::string& getLastPort() {
return last_port; }
139 void addSendComponent(
const std::string& comp,
const std::string& type,
const std::string& port)
141 if ( first_comp ==
"" ) {
147 void addRecvComponent(
const std::string& comp,
const std::string& type,
const std::string& port)
156 bool isEvent() const override final {
return true; }
157 bool isAction() const override final {
return false; }
159 void copyAllDeliveryInfo(
const Activity* act)
override final
161 Activity::copyAllDeliveryInfo(act);
162 const Event* ev =
static_cast<const Event*
>(act);
163 delivery_info = ev->delivery_info;
167 void serialize_order(SST::Core::Serialization::serializer& ser)
override
169 Activity::serialize_order(ser);
170 SST_SER(delivery_info);
171#ifdef __SST_DEBUG_EVENT_TRACKING__
190 friend class NullEvent;
191 friend class RankSync;
192 friend class ThreadSync;
193 friend class TimeVortex;
194 friend class Simulation;
213 inline void setDeliveryInfo(uint32_t order_tag, uintptr_t delivery_info)
216 this->delivery_info = delivery_info;
225 void updateDeliveryInfo(uintptr_t dinfo) { delivery_info = dinfo; }
229 inline Link* getDeliveryLink() {
return reinterpret_cast<Link*
>(delivery_info); }
240 uintptr_t delivery_info;
243 static std::atomic<uint64_t> id_counter;
245#ifdef __SST_DEBUG_EVENT_TRACKING__
246 std::string first_comp;
247 std::string first_type;
248 std::string first_port;
249 std::string last_comp;
250 std::string last_type;
251 std::string last_port;
254 ImplementVirtualSerializable(SST::Event)
260class EmptyEvent :
public Event
272class EventHandlerMetaData :
public AttachPointMetaData
275 const ComponentId_t comp_id;
276 const std::string comp_name;
277 const std::string comp_type;
278 const std::string port_name;
280 EventHandlerMetaData(
281 ComponentId_t
id,
const std::string& cname,
const std::string& ctype,
const std::string& pname) :
288 ~EventHandlerMetaData() {}
297class DeliveryInfoCompEvent :
public Event
300 static uintptr_t getDeliveryInfo(Event* ev) {
return ev->delivery_info; }
302 DeliveryInfoCompEvent(uintptr_t delivery_info) { setDeliveryInfo(0, delivery_info); }
Class to use as the less than operator for STL functions or sorting algorithms.
Definition activity.h:66
void setPriority(uint64_t priority)
Set the priority of the Activity.
Definition activity.h:200
void setOrderTag(uint32_t tag)
Sets the order tag.
Definition activity.h:156
virtual void execute()=0
Function which will be called when the time for this Activity comes to pass.
Empty Event.
Definition event.h:261
Class used to sort events during checkpointing.
Definition event.h:92
Base class for Events - Items sent across links to communicate between components.
Definition event.h:41
std::pair< uint64_t, int > id_type
Type definition of unique identifiers.
Definition event.h:103
SSTHandler< void, Event *, classT, dataT, funcT > Handler
Used to create handlers for event delivery.
Definition event.h:69
static const id_type NO_ID
Constant, default value for id_types.
Definition event.h:105
id_type generateUniqueId()
Generates an ID that is unique across ranks, components and events.
Definition event.cc:43
SSTHandlerBase< void, Event * > HandlerBase
Base handler for event delivery.
Definition event.h:48
virtual Event * clone()
Clones the event in for the case of a broadcast.
Definition event.cc:34
Link between two components.
Definition link.h:57
Null Event.
Definition link.cc:440
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition output.h:58
void output(uint32_t line, const char *file, const char *func, const char *format,...) const
Output the message with formatting as specified by the format parameter.
Definition output.h:189
Definition syncManager.h:46
Base template for handlers which take a class defined argument.
Definition ssthandler.h:79
Base template for the class.
Definition ssthandler.h:1102
Definition syncManager.h:121
Class used with std::lower_bound to find the start of events in a sorted list with the specified deli...
Definition event.h:298