SST/macro
mpi_runtime.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef MPI_RUNTIME_H
13 #define MPI_RUNTIME_H
14 
15 #include <mpi.h>
17 
18 namespace sstmac {
19 namespace mpi {
20 
21 class mpi_runtime :
22  public parallel_runtime
23 {
24 
25  public:
26  std::string
27  to_string() const {
28  return "mpi runtime";
29  }
30 
31  void
32  bcast(void *buffer, int bytes, int root);
33 
34  virtual void
35  init_factory_params(sprockit::sim_parameters* params);
36 
37  int64_t
38  allreduce_min(int64_t mintime);
39 
40  int64_t
41  allreduce_max(int64_t maxtime);
42 
43  void
44  global_sum(long long *data, int nelems, int root);
45 
46  void
47  global_sum(long *data, int nelems, int root);
48 
49  void
50  global_max(long *data, int nelems, int root);
51 
52  void
53  global_max(int *data, int nelems, int root);
54 
55  void
56  send(int dst, void *buffer, int buffer_size);
57 
58  void
59  recv(int src, void *buffer, int buffer_size);
60 
61  void
62  gather(void *send_buffer, int num_bytes, void *recv_buffer, int root);
63 
64  void
65  allgather(void *send_buffer, int num_bytes, void *recv_buffer);
66 
67  void
68  wait_merge_array(int tag);
69 
70  void
71  declare_merge_array(void* buffer, int size, int tag);
72 
73  bool
74  release_merge_array(int tag);
75 
76  void
77  init_runtime_params(sprockit::sim_parameters* params);
78 
79  protected:
80  void
81  do_send_recv_messages(std::vector<void*>& buffers);
82 
83  void
84  do_send_message(int lp, void *buffer, int size);
85 
86  void
87  do_reduce(void* data, int nelems, MPI_Datatype ty, MPI_Op op, int root);
88 
89  virtual void
90  finalize_init();
91 
92  void
93  do_merge_array(int tag);
94 
95  void
96  do_collective_merges(int my_tag);
97 
98  void
100 
101  void finalize();
102 
103  protected:
104  MPI_Request* requests_;
105 
106  struct merge_request {
107  void* buffer;
108  int size;
109  int refcount;
110  bool merged;
111  };
112  typedef std::map<int, merge_request> merge_map;
113  merge_map merge_requests_;
114 
116  int* num_sent_;
119  int epoch_;
120 
121  private:
123 
124 };
125 
126 }
127 }
128 
129 #endif // MPI_RUNTIME_H
void do_merge_array(int tag)
void recv(int src, void *buffer, int buffer_size)
void do_send_message(int lp, void *buffer, int size)
void init_runtime_params(sprockit::sim_parameters *params)
std::map< int, merge_request > merge_map
Definition: mpi_runtime.h:112
void declare_merge_array(void *buffer, int size, int tag)
int64_t allreduce_max(int64_t maxtime)
virtual void finalize_init()
void allgather(void *send_buffer, int num_bytes, void *recv_buffer)
void send(int dst, void *buffer, int buffer_size)
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
std::string to_string() const
Definition: mpi_runtime.h:27
int64_t allreduce_min(int64_t mintime)
MPI_Request * requests_
Definition: mpi_runtime.h:104
void do_send_recv_messages(std::vector< void * > &buffers)
void do_collective_merges(int my_tag)
void gather(void *send_buffer, int num_bytes, void *recv_buffer, int root)
void bcast(void *buffer, int bytes, int root)
void global_sum(long long *data, int nelems, int root)
virtual void init_factory_params(sprockit::sim_parameters *params)
void do_reduce(void *data, int nelems, MPI_Datatype ty, MPI_Op op, int root)
void global_max(long *data, int nelems, int root)
void wait_merge_array(int tag)
bool release_merge_array(int tag)