SST  14.1.0
StructuralSimulationToolkit
threadSyncDirectSkip.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_THREADSYNCDIRECTSKIP_H
13 #define SST_CORE_SYNC_THREADSYNCDIRECTSKIP_H
14 
15 #include "sst/core/action.h"
16 #include "sst/core/sst_types.h"
17 #include "sst/core/sync/syncManager.h"
18 #include "sst/core/sync/syncQueue.h"
19 
20 #include <unordered_map>
21 
22 namespace SST {
23 
24 class ActivityQueue;
25 class Link;
26 class TimeConverter;
27 class Exit;
28 class Event;
29 class Simulation_impl;
30 class ThreadSyncQueue;
31 
33 {
34 public:
35  /** Create a new ThreadSync object */
36  ThreadSyncDirectSkip(int num_threads, int thread, Simulation_impl* sim);
37  ThreadSyncDirectSkip() {} // For serialization only
39 
40  void setMaxPeriod(TimeConverter* period);
41 
42  void before() override {}
43  void after() override;
44  void execute(void) override;
45 
46  /** Cause an exchange of Untimed Data to occur */
47  void processLinkUntimedData() override {}
48  /** Finish link configuration */
49  void finalizeLinkConfigurations() override {}
50  void prepareForComplete() override {}
51 
52  /** Set signals to exchange during sync */
53  void setSignals(int end, int usr, int alrm) override;
54  /** Return exchanged signals after sync */
55  bool getSignals(int& end, int& usr, int& alrm) override;
56 
57  SimTime_t getNextSyncTime() override { return nextSyncTime - 1; }
58 
59  /** Register a Link which this Sync Object is responsible for */
60  void registerLink(const std::string& UNUSED(name), Link* UNUSED(link)) override {}
61  ActivityQueue* registerRemoteLink(int UNUSED(id), const std::string& UNUSED(name), Link* UNUSED(link)) override
62  {
63  return nullptr;
64  }
65 
66  uint64_t getDataSize() const;
67 
68 private:
69  SimTime_t my_max_period;
70  int num_threads;
71  int thread;
72  static SimTime_t localMinimumNextActivityTime;
73  Simulation_impl* sim;
74  static Core::ThreadSafe::Barrier barrier[3];
75  double totalWaitTime;
76  bool single_rank;
77  static int sig_end_;
78  static int sig_usr_;
79  static int sig_alrm_;
80 };
81 
82 
83 } // namespace SST
84 
85 #endif // SST_CORE_SYNC_THREADSYNCDIRECTSKIP_H
void setSignals(int end, int usr, int alrm) override
Set signals to exchange during sync.
Definition: threadSyncDirectSkip.cc:88
A class to convert between a component&#39;s view of time and the core&#39;s view of time.
Definition: timeConverter.h:27
Definition: action.cc:18
void processLinkUntimedData() override
Cause an exchange of Untimed Data to occur.
Definition: threadSyncDirectSkip.h:47
Definition: syncManager.h:87
Main control class for a SST Simulation.
Definition: simulation_impl.h:76
Definition: threadSyncDirectSkip.h:32
bool getSignals(int &end, int &usr, int &alrm) override
Return exchanged signals after sync.
Definition: threadSyncDirectSkip.cc:96
void registerLink(const std::string &UNUSED(name), Link *UNUSED(link)) override
Register a Link which this Sync Object is responsible for.
Definition: threadSyncDirectSkip.h:60
void finalizeLinkConfigurations() override
Finish link configuration.
Definition: threadSyncDirectSkip.h:49
Base Class for a queue of Activities.
Definition: activityQueue.h:21