SST  14.0.0
StructuralSimulationToolkit
threadSyncSimpleSkip.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_THREADSYNCSIMPLESKIP_H
13 #define SST_CORE_SYNC_THREADSYNCSIMPLESKIP_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/threadSyncQueue.h"
19 #include "sst/core/threadsafe.h"
20 
21 #include <unordered_map>
22 
23 namespace SST {
24 
25 class ActivityQueue;
26 class Link;
27 class TimeConverter;
28 class Exit;
29 class Event;
30 class Simulation_impl;
31 class ThreadSyncQueue;
32 
34 {
35 public:
36  /** Create a new ThreadSync object */
37  ThreadSyncSimpleSkip(int num_threads, int thread, Simulation_impl* sim);
38  ThreadSyncSimpleSkip() {} // For serialization only
40 
41  void setMaxPeriod(TimeConverter* period);
42 
43  void before() override;
44  void after() override;
45  void execute(void) override;
46 
47  /** Cause an exchange of Untimed Data to occur */
48  void processLinkUntimedData() override;
49  /** Finish link configuration */
50  void finalizeLinkConfigurations() override;
51  void prepareForComplete() override;
52 
53  /** Register a Link which this Sync Object is responsible for */
54  void registerLink(const std::string& name, Link* link) override;
55  ActivityQueue* registerRemoteLink(int tid, const std::string& name, Link* link) override;
56 
57  uint64_t getDataSize() const;
58 
59  // static void disable() { disabled = true; barrier.disable(); }
60 
61  void serialize_order(SST::Core::Serialization::serializer& ser) override;
62  ImplementSerializable(SST::ThreadSyncSimpleSkip)
63 
64 private:
65  // Stores the links until they can be intialized with the right
66  // remote data. It will hold whichever thread registers the link
67  // first and will be removed after the second thread registers and
68  // the link is properly initialized with the remote data.
69  std::unordered_map<std::string, Link*> link_map;
70 
71  std::vector<ThreadSyncQueue*> queues;
72  SimTime_t my_max_period;
73  int num_threads;
74  int thread;
75  static SimTime_t localMinimumNextActivityTime;
76  Simulation_impl* sim;
77  static Core::ThreadSafe::Barrier barrier[3];
78  double totalWaitTime;
79  bool single_rank;
81 };
82 
83 } // namespace SST
84 
85 #endif // SST_CORE_SYNC_THREADSYNCSIMPLESKIP_H
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
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
Definition: threadSyncSimpleSkip.h:33
Definition: syncManager.h:87
void registerLink(const std::string &name, Link *link) override
Register a Link which this Sync Object is responsible for.
Definition: threadSyncSimpleSkip.cc:65
void processLinkUntimedData() override
Cause an exchange of Untimed Data to occur.
Definition: threadSyncSimpleSkip.cc:142
Main control class for a SST Simulation.
Definition: simulation_impl.h:70
void finalizeLinkConfigurations() override
Finish link configuration.
Definition: threadSyncSimpleSkip.cc:158
Definition: threadsafe.h:121
Base Class for a queue of Activities.
Definition: activityQueue.h:21
Definition: threadsafe.h:47