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"
34class Event :
public Activity
60 template <
typename classT,
typename dataT =
void>
62 [[deprecated(
"Handler has been deprecated. Please use Handler2 instead as it supports checkpointing.")]] =
69 template <
typename classT, auto funcT,
typename dataT =
void>
82#if __SST_DEBUG_EVENT_TRACKING__
87 ~Event()
override =
default;
93#ifdef __SST_DEBUG_EVENT_TRACKING__
95 virtual void printTrackingInfo(
const std::string& header,
Output& out)
const override
97 out.
output(
"%s Event first sent from: %s:%s (type: %s) and last received by %s:%s (type: %s)\n", header.c_str(),
98 first_comp.c_str(), first_port.c_str(), first_type.c_str(), last_comp.c_str(), last_port.c_str(),
102 const std::string& getFirstComponentName() {
return first_comp; }
103 const std::string& getFirstComponentType() {
return first_type; }
104 const std::string& getFirstPort() {
return first_port; }
105 const std::string& getLastComponentName() {
return last_comp; }
106 const std::string& getLastComponentType() {
return last_type; }
107 const std::string& getLastPort() {
return last_port; }
109 void addSendComponent(
const std::string& comp,
const std::string& type,
const std::string& port)
111 if ( first_comp ==
"" ) {
117 void addRecvComponent(
const std::string& comp,
const std::string& type,
const std::string& port)
126 bool isEvent() override final {
return true; }
128 void copyAllDeliveryInfo(
const Activity* act)
override final
130 Activity::copyAllDeliveryInfo(act);
131 const Event* ev =
static_cast<const Event*
>(act);
132 delivery_info = ev->delivery_info;
136 void serialize_order(SST::Core::Serialization::serializer& ser)
override
138 Activity::serialize_order(ser);
139 SST_SER(delivery_info);
140#ifdef __SST_DEBUG_EVENT_TRACKING__
159 friend class NullEvent;
160 friend class RankSync;
161 friend class ThreadSync;
162 friend class TimeVortex;
166 void execute()
override;
181 inline void setDeliveryInfo(LinkId_t tag, uintptr_t delivery_info)
184 this->delivery_info = delivery_info;
188 inline Link* getDeliveryLink() {
return reinterpret_cast<Link*
>(delivery_info); }
191 inline LinkId_t getTag()
const {
return getOrderTag(); }
202 uintptr_t delivery_info;
205 static std::atomic<uint64_t> id_counter;
207#ifdef __SST_DEBUG_EVENT_TRACKING__
208 std::string first_comp;
209 std::string first_type;
210 std::string first_port;
211 std::string last_comp;
212 std::string last_type;
213 std::string last_port;
216 ImplementVirtualSerializable(SST::Event)
222class EmptyEvent :
public Event
234class EventHandlerMetaData :
public AttachPointMetaData
237 const ComponentId_t comp_id;
238 const std::string comp_name;
239 const std::string comp_type;
240 const std::string port_name;
242 EventHandlerMetaData(
243 ComponentId_t
id,
const std::string& cname,
const std::string& ctype,
const std::string& pname) :
250 ~EventHandlerMetaData() {}
void setPriority(uint64_t priority)
Set the priority of the Activity.
Definition activity.h:198
void setOrderTag(uint32_t tag)
Sets the order tag.
Definition activity.h:154
uint32_t getOrderTag() const
Return the order tag associated with this activity.
Definition activity.h:157
Empty Event.
Definition event.h:223
Base class for Events - Items sent across links to communicate between components.
Definition event.h:35
std::pair< uint64_t, int > id_type
Type definition of unique identifiers.
Definition event.h:73
id_type generateUniqueId()
Generates an ID that is unique across ranks, components and events.
Definition event.cc:42
virtual Event * clone()
Clones the event in for the case of a broadcast.
Definition event.cc:33
static const id_type NO_ID
Constant, default value for id_types.
Definition event.h:75
SSTHandler2< void, Event *, classT, dataT, funcT > Handler2
New style (checkpointable) SSTHandler.
Definition event.h:70
SSTHandlerBase< void, Event * > HandlerBase
Base handler for event delivery.
Definition event.h:40
Link between two components.
Definition link.h:55
Null Event.
Definition link.cc:576
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition output.h:54
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:185
Definition syncManager.h:43
Base template for the class.
Definition ssthandler.h:1274
Base template for handlers which take a class defined argument.
Definition ssthandler.h:110
Handler class with user-data argument.
Definition ssthandler.h:1137
Definition syncManager.h:95