OpenMPI  0.1.1
coll_ftbasic.h
1 /*
2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2006 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  * All rights reserved.
12  * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
13  * Copyright (c) 2010-2012 Oak Ridge National Labs. All rights reserved.
14  * $COPYRIGHT$
15  *
16  * Additional copyrights may follow
17  *
18  * $HEADER$
19  */
20 
21 #ifndef MCA_COLL_FTBASIC_EXPORT_H
22 #define MCA_COLL_FTBASIC_EXPORT_H
23 
24 #include "ompi_config.h"
25 
26 #include "mpi.h"
27 #include "opal/mca/mca.h"
28 
29 #include "opal/class/opal_bitmap.h"
30 #include "ompi/class/ompi_free_list.h"
31 
32 #include "ompi/mca/coll/coll.h"
33 #include "ompi/mca/coll/base/coll_tags.h"
34 #include "ompi/request/request.h"
35 #include "ompi/group/group.h"
36 #include "ompi/communicator/communicator.h"
37 #include "ompi/runtime/params.h"
38 
40 
41 BEGIN_C_DECLS
42 
43 /*
44  * TAGS for agreement collectives
45  */
46 #define MCA_COLL_FTBASIC_TAG_AGREEMENT(module) (module->mccb_coll_tag_agreement)
47 #define MCA_COLL_FTBASIC_TAG_AGREEMENT_CATCH_UP (MCA_COLL_BASE_TAG_AGREEMENT_CATCH_UP)
48 #define MCA_COLL_FTBASIC_TAG_AGREEMENT_CATCH_UP_REQ (MCA_COLL_BASE_TAG_AGREEMENT_CATCH_UP_REQ)
49 #define MCA_COLL_FTBASIC_TAG_AGREEMENT_UR_ELECTED (MCA_COLL_BASE_TAG_AGREEMENT_UR_ELECTED)
50 /* WBLAND 7/9/12 - This was causing hangs becuase leader was not incrementing
51  * while paritipants were.
52  #define MCA_COLL_FTBASIC_TAG_STEP (MCA_COLL_BASE_TAG_AGREEMENT_UR_ELECTED - MCA_COLL_BASE_TAG_AGREEMENT)*/
53 #define MCA_COLL_FTBASIC_TAG_STEP 0
54 
55 
56 /* Globally exported variables */
57 
58 OMPI_MODULE_DECLSPEC extern const mca_coll_base_component_2_0_0_t
59 mca_coll_ftbasic_component;
60 extern int mca_coll_ftbasic_priority;
61 extern int mca_coll_ftbasic_crossover;
62 
63 enum mca_coll_ftbasic_agreement_method_t {
64  COLL_FTBASIC_ALLREDUCE = 0,
65  COLL_FTBASIC_TWO_PHASE = 1,
66  COLL_FTBASIC_LOG_TWO_PHASE = 2,
67  COLL_FTBASIC_EARLY_TERMINATION = 3
68 };
69 typedef enum mca_coll_ftbasic_agreement_method_t mca_coll_ftbasic_agreement_method_t;
70 
71 extern mca_coll_ftbasic_agreement_method_t mca_coll_ftbasic_cur_agreement_method;
72 extern bool mca_coll_ftbasic_use_agreement_timer;
73 extern bool mca_coll_ftbasic_agreement_use_progress;
74 extern int mca_coll_ftbasic_agreement_log_max_len;
75 extern int mca_coll_ftbasic_agreement_help_wait_cycles_inc;
76 
78 
79 /*
80  * Base agreement structure
81  * Individual agreement algorithms will extend this struct as needed
82  */
84  /* This is a general object */
85  opal_object_t super;
86 
87  /* Agreement Sequence Number */
88  int agreement_seq_num;
89 
90  /* Bitmap of the last globally agreed upon set of failures
91  * JJH TODO:
92  * This could be pulled from the logs (Last successful commit).
93  */
94  opal_bitmap_t *fail_bitmap;
95 
96  /* Agreement list */
97  opal_list_t *agreement_log;
98 
99  /* Remote Bitmap */
100  opal_list_t remote_bitmaps;
101  opal_list_item_t *last_used;
102 
103  /* Current non-blocking Agreement Request */
104  struct mca_coll_ftbasic_request_t *cur_request;
105 };
108 
111 
112  /* Communicator Type */
113  bool is_intercomm;
114 
115  /* Array of requests */
116  ompi_request_t **mccb_reqs;
117  int mccb_num_reqs;
118 
119  /* Array of statuses */
120  ompi_status_public_t *mccb_statuses;
121  int mccb_num_statuses;
122 
123  /* Tag start number
124  * This allows for us to change context within a communicator without
125  * flushing the PML stack.
126  */
127  int mccb_coll_tag_agreement;
128 
129  /* Pointer to the agreement structure */
130  mca_coll_ftbasic_agreement_t *agreement_info;
131 };
134 
135 /*
136  * API functions
137  */
138 int mca_coll_ftbasic_init_query(bool enable_progress_threads,
139  bool enable_mpi_threads);
141 *mca_coll_ftbasic_comm_query(struct ompi_communicator_t *comm,
142  int *priority);
143 
144 int mca_coll_ftbasic_module_enable(mca_coll_base_module_t *module,
145  struct ompi_communicator_t *comm);
146 
147 int mca_coll_ftbasic_ft_event(int status);
148 
149 /*
150  * Agreement protocols
151  */
152 /* 2-Phase Commit */
153 int mca_coll_ftbasic_agreement_two_phase(ompi_communicator_t* comm,
154  ompi_group_t **group,
155  int *flag,
156  mca_coll_base_module_t *module);
157 int mca_coll_ftbasic_iagreement_two_phase(ompi_communicator_t* comm,
158  ompi_group_t **group,
159  int *flag,
160  mca_coll_base_module_t *module,
162 
163 /* Log scaling 2-Phase Commit */
164 int mca_coll_ftbasic_agreement_log_two_phase(ompi_communicator_t* comm,
165  ompi_group_t **group,
166  int *flag,
167  mca_coll_base_module_t *module);
168 int mca_coll_ftbasic_iagreement_log_two_phase(ompi_communicator_t* comm,
169  ompi_group_t **group,
170  int *flag,
171  mca_coll_base_module_t *module,
173 
174 /* Allreduce (baseline) */
175 int mca_coll_ftbasic_agreement_allreduce(ompi_communicator_t* comm,
176  ompi_group_t **group,
177  int *flag,
178  mca_coll_base_module_t *module);
179 int mca_coll_ftbasic_iagreement_allreduce(ompi_communicator_t* comm,
180  ompi_group_t **group,
181  int *flag,
182  mca_coll_base_module_t *module,
184 
185 /* Early termination algorithm */
186 int
187 mca_coll_ftbasic_agreement_eta_intra(ompi_communicator_t* comm,
188  ompi_group_t **group,
189  int *flag,
190  mca_coll_base_module_t *module);
191 
192 /*
193  * Utility functions
194  */
195 static inline void mca_coll_ftbasic_free_reqs(ompi_request_t ** reqs,
196  int count)
197 {
198  int i;
199  for (i = 0; i < count; ++i) {
200  if( OMPI_REQUEST_INVALID != reqs[i]->req_state ) {
201  ompi_request_free(&reqs[i]);
202  }
203  }
204 }
205 
206 END_C_DECLS
207 
208 #endif /* MCA_COLL_FTBASIC_EXPORT_H */
Definition: opal_bitmap.h:53
Definition: coll_ftbasic_agreement.h:263
Collective module interface.
Definition: coll.h:316
Collective component interface.
Definition: coll.h:283
A bitmap implementation.
Definition: coll_ftbasic.h:83
Top-level interface for all MCA components.
Definition: opal_list.h:98
Collective Communication Interface.
Top-level description of requests.
Definition: coll_ftbasic.h:109
Group structure Currently we have four formats for storing the process pointers that are members of t...
Definition: group.h:79
Base object.
Definition: opal_object.h:182
Definition: opal_list.h:147
Global params for OpenRTE.
Definition: mpi.h:337
static int ompi_request_free(ompi_request_t **request)
Free a request.
Definition: request.h:371
Infrastructure for MPI group support.
Definition: evdns.c:158
Definition: communicator.h:118
Main top-level request struct definition.
Definition: request.h:100
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236