SST 15.0
Structural Simulation Toolkit
rankSyncSerialSkip.h
1// Copyright 2009-2025 NTESS. Under the terms
2// of Contract DE-NA0003525 with NTESS, the U.S.
3// Government retains certain rights in this software.
4//
5// Copyright (c) 2009-2025, NTESS
6// All rights reserved.
7//
8// This file is part of the SST software package. For license
9// information, see the LICENSE file in the top level directory of the
10// distribution.
11
12#ifndef SST_CORE_SYNC_RANKSYNCSERIALSKIP_H
13#define SST_CORE_SYNC_RANKSYNCSERIALSKIP_H
14
15#include "sst/core/sst_types.h"
16#include "sst/core/sync/syncManager.h"
17#include "sst/core/threadsafe.h"
18
19#include <cstdint>
20#include <map>
21#include <string>
22
23namespace SST {
24
25class RankSyncQueue;
26class TimeConverter;
27
28class RankSyncSerialSkip : public RankSync
29{
30public:
31 /** Create a new Sync object which fires with a specified period */
32 explicit RankSyncSerialSkip(RankInfo num_ranks);
33 RankSyncSerialSkip() {} // For serialization
34 virtual ~RankSyncSerialSkip();
35
36 /** Register a Link which this Sync Object is responsible for */
38 const RankInfo& to_rank, const RankInfo& from_rank, const std::string& name, Link* link) override;
39 void execute(int thread) override;
40
41 /** Cause an exchange of Untimed Data to occur */
42 void exchangeLinkUntimedData(int thread, std::atomic<int>& msg_count) override;
43 /** Finish link configuration */
44 void finalizeLinkConfigurations() override;
45 /** Prepare for the complete() stage */
46 void prepareForComplete() override;
47
48 /** Set signals to exchange during sync */
49 void setSignals(int end, int usr, int alrm) override;
50 /** Return exchanged signals after sync */
51 bool getSignals(int& end, int& usr, int& alrm) override;
52
53 SimTime_t getNextSyncTime() override { return myNextSyncTime; }
54
55 void setRestartTime(SimTime_t time) override;
56
57 uint64_t getDataSize() const override;
58
59private:
60 static SimTime_t myNextSyncTime;
61
62 // Function that actually does the exchange during run
63 void exchange();
64
65 struct comm_pair : public SST::Core::Serialization::serializable
66 {
67 RankSyncQueue* squeue; // RankSyncQueue
68 char* rbuf; // receive buffer
69 uint32_t local_size;
70 uint32_t remote_size;
71
72 void serialize_order(SST::Core::Serialization::serializer& UNUSED(ser)) override {}
73 ImplementSerializable(comm_pair)
74 };
75
76 using comm_map_t = std::map<int, comm_pair>;
77 using link_map_t = std::map<std::string, uintptr_t>;
78
79 // TimeConverter* period;
80 comm_map_t comm_map;
81 link_map_t link_map;
82
83 double mpiWaitTime;
84 double deserializeTime;
85
87 static int sig_end_;
88 static int sig_usr_;
89 static int sig_alrm_;
90};
91
92} // namespace SST
93
94#endif // SST_CORE_SYNC_RANKSYNCSERIALSKIP_H
Base Class for a queue of Activities.
Definition activityQueue.h:22
Definition serializable.h:24
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:45
Definition threadsafe.h:132
Definition rankInfo.h:24
Definition syncQueue.h:56
void setSignals(int end, int usr, int alrm) override
Set signals to exchange during sync.
Definition rankSyncSerialSkip.cc:107
ActivityQueue * registerLink(const RankInfo &to_rank, const RankInfo &from_rank, const std::string &name, Link *link) override
Register a Link which this Sync Object is responsible for.
Definition rankSyncSerialSkip.cc:67
void prepareForComplete() override
Prepare for the complete() stage.
Definition rankSyncSerialSkip.cc:103
bool getSignals(int &end, int &usr, int &alrm) override
Return exchanged signals after sync.
Definition rankSyncSerialSkip.cc:115
void finalizeLinkConfigurations() override
Finish link configuration.
Definition rankSyncSerialSkip.cc:99
void exchangeLinkUntimedData(int thread, std::atomic< int > &msg_count) override
Cause an exchange of Untimed Data to occur.
Definition rankSyncSerialSkip.cc:269
RankSyncSerialSkip(RankInfo num_ranks)
Create a new Sync object which fires with a specified period.
Definition rankSyncSerialSkip.cc:45
A class to convert between a component's view of time and the core's view of time.
Definition timeConverter.h:28