SST  14.1.0
StructuralSimulationToolkit
rankSyncSerialSkip.h
1 // Copyright 2009-2024 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-2024, 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 <map>
20 
21 namespace SST {
22 
23 class RankSyncQueue;
24 class TimeConverter;
25 
27 {
28 public:
29  /** Create a new Sync object which fires with a specified period */
30  RankSyncSerialSkip(RankInfo num_ranks);
31  RankSyncSerialSkip() {} // For serialization
32  virtual ~RankSyncSerialSkip();
33 
34  /** Register a Link which this Sync Object is responsible for */
36  registerLink(const RankInfo& to_rank, const RankInfo& from_rank, const std::string& name, Link* link) override;
37  void execute(int thread) override;
38 
39  /** Cause an exchange of Untimed Data to occur */
40  void exchangeLinkUntimedData(int thread, std::atomic<int>& msg_count) override;
41  /** Finish link configuration */
42  void finalizeLinkConfigurations() override;
43  /** Prepare for the complete() stage */
44  void prepareForComplete() override;
45 
46  /** Set signals to exchange during sync */
47  void setSignals(int end, int usr, int alrm) override;
48  /** Return exchanged signals after sync */
49  bool getSignals(int& end, int& usr, int& alrm) override;
50 
51  SimTime_t getNextSyncTime() override { return myNextSyncTime; }
52 
53  void setRestartTime(SimTime_t time) override;
54 
55  uint64_t getDataSize() const override;
56 
57 private:
58  static SimTime_t myNextSyncTime;
59 
60  // Function that actually does the exchange during run
61  void exchange();
62 
63  struct comm_pair : public SST::Core::Serialization::serializable
64  {
65  RankSyncQueue* squeue; // RankSyncQueue
66  char* rbuf; // receive buffer
67  uint32_t local_size;
68  uint32_t remote_size;
69 
70  void serialize_order(SST::Core::Serialization::serializer& UNUSED(ser)) override {}
71  ImplementSerializable(comm_pair)
72  };
73 
74  typedef std::map<int, comm_pair> comm_map_t;
75  typedef std::map<std::string, uintptr_t> link_map_t;
76 
77  // TimeConverter* period;
78  comm_map_t comm_map;
79  link_map_t link_map;
80 
81  double mpiWaitTime;
82  double deserializeTime;
83 
85  static int sig_end_;
86  static int sig_usr_;
87  static int sig_alrm_;
88 };
89 
90 } // namespace SST
91 
92 #endif // SST_CORE_SYNC_RANKSYNCSERIALSKIP_H
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:43
Definition: syncManager.h:39
Definition: action.cc:18
void exchangeLinkUntimedData(int thread, std::atomic< int > &msg_count) override
Cause an exchange of Untimed Data to occur.
Definition: rankSyncSerialSkip.cc:273
Definition: serializable.h:24
void prepareForComplete() override
Prepare for the complete() stage.
Definition: rankSyncSerialSkip.cc:108
void finalizeLinkConfigurations() override
Finish link configuration.
Definition: rankSyncSerialSkip.cc:104
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:74
Definition: rankInfo.h:21
Definition: threadsafe.h:121
Definition: syncQueue.h:50
void setSignals(int end, int usr, int alrm) override
Set signals to exchange during sync.
Definition: rankSyncSerialSkip.cc:112
bool getSignals(int &end, int &usr, int &alrm) override
Return exchanged signals after sync.
Definition: rankSyncSerialSkip.cc:120
Base Class for a queue of Activities.
Definition: activityQueue.h:21
Definition: rankSyncSerialSkip.h:26