SST  13.1.0
Structural Simulation Toolkit
threadSyncSimpleSkip.h
1 // Copyright 2009-2023 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-2023, 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);
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  /** Register a Link which this Sync Object is responsible for */
53  void registerLink(const std::string& name, Link* link) override;
54  ActivityQueue* registerRemoteLink(int tid, const std::string& name, Link* link) override;
55 
56  uint64_t getDataSize() const;
57 
58  // static void disable() { disabled = true; barrier.disable(); }
59 
60 private:
61  // Stores the links until they can be intialized with the right
62  // remote data. It will hold whichever thread registers the link
63  // first and will be removed after the second thread registers and
64  // the link is properly initialized with the remote data.
65  std::unordered_map<std::string, Link*> link_map;
66 
67  std::vector<ThreadSyncQueue*> queues;
68  SimTime_t my_max_period;
69  int num_threads;
70  int thread;
71  static SimTime_t localMinimumNextActivityTime;
72  Simulation_impl* sim;
73  static Core::ThreadSafe::Barrier barrier[3];
74  double totalWaitTime;
75  bool single_rank;
77 };
78 
79 } // namespace SST
80 
81 #endif // SST_CORE_SYNC_THREADSYNCSIMPLESKIP_H
Base Class for a queue of Activities.
Definition: activityQueue.h:22
Definition: threadsafe.h:48
Definition: threadsafe.h:122
Main control class for a SST Simulation.
Definition: simulation_impl.h:74
Definition: threadSyncSimpleSkip.h:34
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
ThreadSyncSimpleSkip(int num_threads, int thread, Simulation_impl *sim)
Create a new ThreadSync object.
Definition: threadSyncSimpleSkip.cc:27
void finalizeLinkConfigurations() override
Finish link configuration.
Definition: threadSyncSimpleSkip.cc:158
Definition: syncManager.h:81
A class to convert between a component's view of time and the core's view of time.
Definition: timeConverter.h:27