SST/macro
sumi_api.h
Go to the documentation of this file.
1 #ifndef SSTMAC_SIMPMSG_API_H
2 #define SSTMAC_SIMPMSG_API_H
3 
10 #include <sumi/message_fwd.h>
11 
12 /**
13  * SUMI = Simulator unified messagine interface
14  * It is also the name for a solid ink in Japanese -
15  * i.e. the substrate for sending messages!
16  */
17 
18 namespace sstmac {
19 
21 {
22 
23  public:
24  std::string
25  to_string() const {
26  return "SUMI message queue";
27  }
28 
30 
31  sumi_queue();
32 
33  ~sumi_queue();
34 
37 
40 
41  void
43 
44  bool
45  blocked() const {
46  return !blocked_keys_.empty();
47  }
48 
49  private:
50  std::list<transport_message*> pending_messages_;
51 
52  std::list<sstmac::sw::key*> blocked_keys_;
53 
55 
56 };
57 
58 class sumi_api :
59  public sstmac::sw::api,
61 {
62  public:
63  sumi_api(const char* name, sstmac::sw::software_id sid);
64 
65  virtual void
66  init();
67 
68  virtual void
69  finalize();
70 
71  virtual ~sumi_api();
72 
73  virtual void
74  init_os(sstmac::sw::operating_system* os);
75 
76  virtual void
77  init_factory_params(sprockit::sim_parameters* params);
78 
79  sumi::message_ptr
80  poll_until_notification();
81 
82  sumi::message_ptr
83  poll_until_notification(timestamp timeout);
84 
85  virtual sumi::message_ptr
86  handle(transport_message* msg) = 0;
87 
88  void
89  incoming_message(transport_message* msg);
90 
91  void
92  transport_send(
93  long byte_length,
94  const sumi::message_ptr& msg,
95  int ty,
96  int dst,
97  bool needs_ack);
98 
99  bool
100  blocked() const {
101  return queue_->blocked();
102  }
103 
104  private:
105  std::string server_libname_;
106 
108 
109  /**
110  * @brief queue_
111  * Manages incoming/outgoing messages
112  */
114 
115  protected:
117 
118  int rank_;
119 
120  int nproc_;
121 
122 };
123 
124 
125 class sumi_server :
126  public sstmac::sw::service
127 {
128 
129  public:
130  sumi_server(const std::string& libname, int appid);
131 
132  void
133  register_proc(int rank, sumi_api* proc);
134 
135  void
136  incoming_event(event *ev);
137 
138  private:
139  int appid_;
140 
141  spkt_unordered_map<int, sumi_api*> procs_;
142 
143  sumi_api*
144  get_proc(int rank) const;
145 
146 };
147 
148 }
149 
150 #endif // SSTMAC_SIMPMSG_API_H
sstmac::sw::operating_system * os_
Definition: sumi_api.h:54
A class describing an event.
Definition: sst_message.h:42
sstmac::sw::app_launch * rank_mapper_
Definition: sumi_api.h:107
long byte_length(const char *value, bool &errorflag, bool print_errors=false)
bool blocked() const
Definition: sumi_api.h:100
spkt_unordered_map< int, sumi_api * > procs_
Definition: sumi_api.h:141
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
void put_message(transport_message *message)
parallel_runtime * init()
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
void finalize(parallel_runtime *rt)
std::list< sstmac::sw::key * > blocked_keys_
Definition: sumi_api.h:52
sumi_queue * queue_
queue_ Manages incoming/outgoing messages
Definition: sumi_api.h:113
std::string to_string() const
Definition: sumi_api.h:25
event_loc_id loc_
Definition: sumi_api.h:116
std::list< transport_message * > pending_messages_
Definition: sumi_api.h:50
std::string server_libname_
Definition: sumi_api.h:105
transport * sumi_api()
bool blocked() const
Definition: sumi_api.h:45
A wrapper for an appid, taskid pair.
Definition: software_id.h:28
transport_message * poll_until_message()