SST 15.0
Structural Simulation Toolkit
threadSyncSimpleSkip.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_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/syncQueue.h"
19#include "sst/core/threadsafe.h"
20
21#include <cstdint>
22#include <string>
23#include <unordered_map>
24#include <vector>
25
26namespace SST {
27
28class ActivityQueue;
29class Link;
30class TimeConverter;
31class Exit;
32class Event;
33class Simulation_impl;
34class ThreadSyncQueue;
35
36class ThreadSyncSimpleSkip : public ThreadSync
37{
38public:
39 /** Create a new ThreadSync object */
40 ThreadSyncSimpleSkip(int num_threads, int thread, Simulation_impl* sim);
41 ThreadSyncSimpleSkip() {} // For serialization only
43
44 void setMaxPeriod(TimeConverter* period);
45
46 void before() override;
47 void after() override;
48 void execute() override;
49
50 /** Set signals to exchange during sync */
51 void setSignals(int end, int usr, int alrm) override;
52 /** Return exchanged signals after sync */
53 bool getSignals(int& end, int& usr, int& alrm) override;
54
55 /** Cause an exchange of Untimed Data to occur */
56 void processLinkUntimedData() override;
57 /** Finish link configuration */
58 void finalizeLinkConfigurations() override;
59 void prepareForComplete() override;
60
61 /** Register a Link which this Sync Object is responsible for */
62 void registerLink(const std::string& name, Link* link) override;
63 ActivityQueue* registerRemoteLink(int tid, const std::string& name, Link* link) override;
64
65 uint64_t getDataSize() const;
66
67
68 // static void disable() { disabled = true; barrier.disable(); }
69
70private:
71 // Stores the links until they can be intialized with the right
72 // remote data. It will hold whichever thread registers the link
73 // first and will be removed after the second thread registers and
74 // the link is properly initialized with the remote data.
75 std::unordered_map<std::string, Link*> link_map;
76
77 std::vector<ThreadSyncQueue*> queues;
78 SimTime_t my_max_period;
79 int num_threads;
80 int thread;
81 static SimTime_t localMinimumNextActivityTime;
82 Simulation_impl* sim;
83 static Core::ThreadSafe::Barrier barrier[3];
84 double totalWaitTime;
85 bool single_rank;
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_THREADSYNCSIMPLESKIP_H
Base Class for a queue of Activities.
Definition activityQueue.h:22
Definition threadsafe.h:46
Definition threadsafe.h:132
Base class for Events - Items sent across links to communicate between components.
Definition event.h:35
Exit Event Action.
Definition exit.h:36
Main control class for a SST Simulation.
Definition simulation_impl.h:87
Definition syncQueue.h:91
void registerLink(const std::string &name, Link *link) override
Register a Link which this Sync Object is responsible for.
Definition threadSyncSimpleSkip.cc:66
void processLinkUntimedData() override
Cause an exchange of Untimed Data to occur.
Definition threadSyncSimpleSkip.cc:143
void setSignals(int end, int usr, int alrm) override
Set signals to exchange during sync.
Definition threadSyncSimpleSkip.cc:182
ThreadSyncSimpleSkip(int num_threads, int thread, Simulation_impl *sim)
Create a new ThreadSync object.
Definition threadSyncSimpleSkip.cc:27
bool getSignals(int &end, int &usr, int &alrm) override
Return exchanged signals after sync.
Definition threadSyncSimpleSkip.cc:190
void finalizeLinkConfigurations() override
Finish link configuration.
Definition threadSyncSimpleSkip.cc:159
A class to convert between a component's view of time and the core's view of time.
Definition timeConverter.h:28