SST/macro
multithreaded_event_container.h
Go to the documentation of this file.
1 #ifndef MULTITHREADED_EVENT_CONTAINER_H
2 #define MULTITHREADED_EVENT_CONTAINER_H
3 
5 #if !SSTMAC_INTEGRATED_SST_CORE
6 
10 #include <pthread.h>
11 
12 
13 DeclareDebugSlot(multithread_event_manager);
14 DeclareDebugSlot(cpu_affinity);
15 
16 namespace sstmac {
17 namespace native {
18 
20 {
21  public:
22  std::list<event_queue_entry*>&
23  pending_events(int srcthread, int dstthread);
24 
25  void
26  init(int nthread);
27 
28  protected:
29  int array_index(int srcthread, int dstthread);
30 
31  protected:
32  int nthread_;
33 
34  std::vector<std::list<event_queue_entry*> > events_;
35 
36 };
37 
38 
41 {
42  public:
45 
47 
48  virtual void
49  init_factory_params(sprockit::sim_parameters* params);
50 
51  virtual void
52  finalize_init();
53 
54  virtual void
55  run();
56 
57  virtual void
58  schedule_stop(timestamp until);
59 
60  void
61  multithread_schedule(
62  int srcthread,
63  int dstthread,
64  uint32_t seqnum,
65  event_queue_entry* ev);
66 
67  std::list<event_queue_entry*>&
68  pending_events(int srcthread, int dstthread) {
69  return pending_event_map_.pending_events(srcthread, dstthread);
70  }
71 
72  virtual void
73  set_interconnect(hw::interconnect* interconn);
74 
75  virtual void
76  receive_incoming_events();
77 
78  void
79  schedule_incoming(int thread_id, clock_cycle_event_map* mgr);
80 
81  void
82  send_recv_barrier(int thread_id);
83 
84  timestamp
85  time_vote_barrier(int thread_id, timestamp min_time);
86 
87  virtual timestamp
88  vote_next_round(timestamp my_time);
89 
91  ev_man_for_thread(int thread_id) const;
92 
93  virtual void
94  finish_stats(stat_collector *main, const std::string &name, timestamp end);
95 
96  protected:
98  virtual int64_t
99  execute(int64_t min_time){
100  return parent->do_vote(min_time);
101  }
103  };
105 
107  virtual int64_t
108  execute(int64_t){
109  parent->clock_cycle_event_map::receive_incoming_events();
110  return 0;
111  }
113  };
115 
116  std::vector<multithreaded_subcontainer*> subthreads_;
117 
120 
122 
123  std::vector<int> cpu_affinity_;
124  int me_;
125  int nproc_;
126 
127 };
128 
129 }
130 }
131 
132 
133 #endif // !SSTMAC_INTEGRATED_SST_CORE
134 
135 #endif // MULTITHREADED_EVENT_CONTAINER_H
std::list< event_queue_entry * > & pending_events(int srcthread, int dstthread)
#define main
Definition: sumi.h:12
int thread_id
Definition: thread_id.h:21
std::vector< multithreaded_subcontainer * > subthreads_
A type of logger that collects some kind of statistic and outputs to a file during or at the end of a...
Base type for implementations of an engine that is able to schedule events and advance simulation tim...
Definition: event_manager.h:47
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
int array_index(int srcthread, int dstthread)
std::list< event_queue_entry * > & pending_events(int srcthread, int dstthread)
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
void run(opts &oo, sstmac::parallel_runtime *rt, sprockit::sim_parameters *params, sim_stats &stats)
DeclareDebugSlot(multithread_event_manager)
std::vector< std::list< event_queue_entry * > > events_
Definition: sst_event.h:67