SST 12.1.0
Structural Simulation Toolkit
threadSyncSimpleSkip.h
1// Copyright 2009-2022 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-2022, 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
20#include <unordered_map>
21
22namespace SST {
23
24class ActivityQueue;
25class Link;
26class TimeConverter;
27class Exit;
28class Event;
29class Simulation_impl;
30class ThreadSyncQueue;
31
33{
34public:
35 /** Create a new ThreadSync object */
36 ThreadSyncSimpleSkip(int num_threads, int thread, Simulation_impl* sim);
38
39 void setMaxPeriod(TimeConverter* period);
40
41 void before() override;
42 void after() override;
43 void execute(void) override;
44
45 /** Cause an exchange of Untimed Data to occur */
46 void processLinkUntimedData() override;
47 /** Finish link configuration */
48 void finalizeLinkConfigurations() override;
49 void prepareForComplete() override;
50
51 /** Register a Link which this Sync Object is responsible for */
52 void registerLink(const std::string& name, Link* link) override;
53 ActivityQueue* registerRemoteLink(int tid, const std::string& name, Link* link) override;
54
55 uint64_t getDataSize() const;
56
57 // static void disable() { disabled = true; barrier.disable(); }
58
59private:
60 // Stores the links until they can be intialized with the right
61 // remote data. It will hold whichever thread registers the link
62 // first and will be removed after the second thread registers and
63 // the link is properly initialized with the remote data.
64 std::unordered_map<std::string, Link*> link_map;
65
66 std::vector<ThreadSyncQueue*> queues;
67 SimTime_t my_max_period;
68 int num_threads;
69 int thread;
70 static SimTime_t localMinimumNextActivityTime;
71 Simulation_impl* sim;
72 static Core::ThreadSafe::Barrier barrier[3];
73 double totalWaitTime;
74 bool single_rank;
75};
76
77} // namespace SST
78
79#endif // SST_CORE_SYNC_THREADSYNCSIMPLESKIP_H
Base Class for a queue of Activities.
Definition: activityQueue.h:22
Definition: threadsafe.h:48
Main control class for a SST Simulation.
Definition: simulation_impl.h:77
Definition: threadSyncSimpleSkip.h:33
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:140
void finalizeLinkConfigurations() override
Finish link configuration.
Definition: threadSyncSimpleSkip.cc:156
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