SST/macro
runtime.h
Go to the documentation of this file.
1 #ifndef RUNTIME_H
2 #define RUNTIME_H
3 
11 #include <sprockit/unordered.h>
12 #include <list>
13 
14 namespace sstmac {
15 
17  public:
18  virtual void run() = 0;
19 
20  virtual ~deadlock_check(){}
21 
22 };
23 
24 template <class T, class Fxn> class deadlock_check_impl : public deadlock_check
25 {
26  public:
27  deadlock_check_impl(T* t , Fxn f) : t_(t), f_(f) {}
28 
29  void run(){
30  (t_->*f_)();
31  }
32 
34 
35  private:
36  T* t_;
37  Fxn f_;
38 };
39 
40 template <class T, class Fxn>
42 new_deadlock_check(T* t, Fxn f){
43  return new deadlock_check_impl<T,Fxn>(t,f);
44 }
45 
46 class runtime
47 {
48  protected:
49  typedef spkt_unordered_map<sw::task_id, node_id> task_to_nodeid_map;
50  typedef spkt_unordered_map<sw::app_id, task_to_nodeid_map> app_to_task_map;
51 
52  public:
53  static node_id
54  node_for_task(sw::app_id aid, sw::task_id tid);
55 
56  static hw::topology*
58  return topology_;
59  }
60 
61  static void
62  set_topology(hw::topology* top) {
63  topology_ = top;
64  }
65 
66  static void
67  delete_statics();
68 
69  static node_id
70  current_node();
71 
72  static sw::job_launcher*
74  return launcher_;
75  }
76 
77  static void
78  finish();
79 
80  static void enter_deadlock_region(){
81  do_deadlock_check_ = true;
82  }
83 
84  static void exit_deadlock_region(){
85  do_deadlock_check_ = false;
86  }
87 
88  static void check_deadlock();
89 
91  deadlock_checks_.push_back(c);
92  }
93 
94  static void
96  launcher_ = launcher;
97  }
98 
99  protected:
100  static bool do_deadlock_check_;
101 
102  static hw::topology* topology_;
103 
105 
106  static std::list<deadlock_check*> deadlock_checks_;
107 
108 };
109 
110 }
111 
112 #endif // RUNTIME_H
113 
The job_launcher class performs the combined operations a queue scheduler like PBS or MOAB and a job ...
Definition: job_launcher.h:26
static sw::job_launcher * launcher_
Definition: runtime.h:104
spkt_unordered_map< sw::task_id, node_id > task_to_nodeid_map
Definition: runtime.h:49
deadlock_check_impl(T *t, Fxn f)
Definition: runtime.h:27
virtual ~deadlock_check_impl()
Definition: runtime.h:33
deadlock_check * new_deadlock_check(T *t, Fxn f)
Definition: runtime.h:42
static void set_topology(hw::topology *top)
Definition: runtime.h:62
static sw::job_launcher * launcher()
Definition: runtime.h:73
int task_id
Definition: task_id.h:20
static hw::topology * topology_
Definition: runtime.h:102
static std::list< deadlock_check * > deadlock_checks_
Definition: runtime.h:106
static bool do_deadlock_check_
Definition: runtime.h:100
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
static void add_deadlock_check(deadlock_check *c)
Definition: runtime.h:90
virtual void run()=0
static void enter_deadlock_region()
Definition: runtime.h:80
virtual ~deadlock_check()
Definition: runtime.h:20
static void set_job_launcher(sw::job_launcher *launcher)
Definition: runtime.h:95
endpoint_id node_id
Definition: node_address.h:20
static void exit_deadlock_region()
Definition: runtime.h:84
int app_id
Definition: app_id.h:20
static hw::topology * current_topology()
Definition: runtime.h:57
spkt_unordered_map< sw::app_id, task_to_nodeid_map > app_to_task_map
Definition: runtime.h:50