10 #ifndef MCA_COLL_FTBASIC_AGREEMENT_EXPORT_H
11 #define MCA_COLL_FTBASIC_AGREEMENT_EXPORT_H
13 #include "coll_ftbasic.h"
18 #define SIZE_OF_CHAR ((int) (sizeof(char) * 8))
24 #define FTBASIC_AGREEMENT_EXTRA_BITS (1 + SIZE_OF_CHAR)
26 #define FTBASIC_AGREEMENT_FLAG_BIT_LOC(bm) ( ( (bm->array_size - 1)*SIZE_OF_CHAR + 1) )
31 extern int mca_coll_ftbasic_agreement_num_active_nonblocking;
32 extern int mca_coll_ftbasic_agreement_help_num_asking;
33 extern int mca_coll_ftbasic_agreement_help_wait_cycles;
83 extern int mca_coll_ftbasic_agreement_two_phase_progress(
void);
84 extern int mca_coll_ftbasic_agreement_two_phase_term_progress(
void);
92 extern int mca_coll_ftbasic_agreement_log_two_phase_progress(
void);
93 extern int mca_coll_ftbasic_agreement_log_two_phase_term_progress(
void);
94 int mca_coll_ftbasic_agreement_log_two_phase_refresh_tree(
opal_bitmap_t *local_bitmap,
105 AGREEMENT_STATE_NONE = 0,
109 AGREEMENT_STATE_VOTE_REQ = 1,
113 AGREEMENT_STATE_VOTED = 2,
121 AGREEMENT_STATE_UNCERTAIN = 3,
125 AGREEMENT_STATE_COMMIT = 4,
129 AGREEMENT_STATE_COMMITTED = 5,
133 AGREEMENT_STATE_ABORT = 6,
137 AGREEMENT_STATE_ABORTED = 7
140 #define AGREEMENT_STATE_STR(loc_state) \
141 (AGREEMENT_STATE_COMMIT == loc_state ? "Commit" : \
142 (AGREEMENT_STATE_COMMITTED == loc_state ? "Committed" : \
143 (AGREEMENT_STATE_ABORT == loc_state ? "Abort" : \
144 (AGREEMENT_STATE_ABORTED == loc_state ? "Aborted" : \
145 (AGREEMENT_STATE_UNCERTAIN == loc_state ? "Uncertian" : \
146 (AGREEMENT_STATE_VOTED == loc_state ? "Voted" : \
147 (AGREEMENT_STATE_VOTE_REQ == loc_state ? "Voted Req." : \
148 (AGREEMENT_STATE_NONE == loc_state ? "None" : "Unknown") \
195 extern int mca_coll_ftbasic_remote_bitmap_num_modules;
200 #define REMOTE_BITMAP_ALLOC(rbm, size) \
202 ompi_free_list_item_t* item; \
205 OMPI_FREE_LIST_GET(&mca_coll_ftbasic_remote_bitmap_free_list, \
207 rbm = (mca_coll_ftbasic_remote_bitmap_t*)item; \
208 opal_bitmap_init(rbm->bitmap, size + FTBASIC_AGREEMENT_EXTRA_BITS); \
211 #define REMOTE_BITMAP_RETURN(rbm) \
213 OMPI_FREE_LIST_RETURN(&mca_coll_ftbasic_remote_bitmap_free_list, \
214 (ompi_free_list_item_t*)rbm); \
217 #define REMOTE_BITMAP_GET_NEXT(ftmodule, rbm, size) \
220 if( 0 < opal_list_get_size(&(ftmodule->agreement_info->remote_bitmaps)) ) { \
221 if( NULL == ftmodule->agreement_info->last_used ) { \
222 ftmodule->agreement_info->last_used = opal_list_get_first(&(ftmodule->agreement_info->remote_bitmaps)); \
224 else if( ftmodule->agreement_info->last_used != opal_list_get_last(&(ftmodule->agreement_info->remote_bitmaps)) ) { \
225 ftmodule->agreement_info->last_used = opal_list_get_next(ftmodule->agreement_info->last_used); \
228 REMOTE_BITMAP_ALLOC(rbm, size); \
229 opal_list_append(&(ftmodule->agreement_info->remote_bitmaps), \
230 (opal_list_item_t*)rbm); \
231 ftmodule->agreement_info->last_used = opal_list_get_last(&(ftmodule->agreement_info->remote_bitmaps)); \
233 rbm = (mca_coll_ftbasic_remote_bitmap_t*)ftmodule->agreement_info->last_used; \
237 REMOTE_BITMAP_ALLOC(rbm, size); \
238 opal_list_append(&(ftmodule->agreement_info->remote_bitmaps), \
239 (opal_list_item_t*)rbm); \
240 ftmodule->agreement_info->last_used = opal_list_get_last(&(ftmodule->agreement_info->remote_bitmaps)); \
244 #define REMOTE_BITMAP_RESET_NEXT(ftmodule) \
245 if( ftmodule->agreement_info ) { \
246 opal_list_item_t* item = NULL; \
247 mca_coll_ftbasic_remote_bitmap_t *rbm = NULL; \
249 for( item = opal_list_get_first(&(ftmodule->agreement_info->remote_bitmaps)); \
250 item != opal_list_get_end(&(ftmodule->agreement_info->remote_bitmaps)); \
251 item = opal_list_get_next(item) ) { \
252 rbm = (mca_coll_ftbasic_remote_bitmap_t*)item; \
255 ftmodule->agreement_info->last_used = NULL; \
296 #define MCA_COLL_FTBASIC_REQUEST_ALLOC(collreq, comm) \
298 collreq = OBJ_NEW(mca_coll_ftbasic_request_t); \
300 OMPI_REQUEST_INIT(&(collreq)->req_ompi, false); \
301 collreq->req_ompi.req_mpi_object.comm = comm; \
302 collreq->req_ompi.req_complete = false; \
303 collreq->req_ompi.req_state = OMPI_REQUEST_ACTIVE; \
306 #define MCA_COLL_FTBASIC_REQUEST_FREE(collreq) \
308 OMPI_REQUEST_FINI(collreq->req_ompi); \
311 #define MCA_COLL_FTBASIC_REQUEST_COMPLETE(collreq) \
313 OPAL_THREAD_LOCK(&ompi_request_lock); \
314 if( false == collreq->req_ompi.req_complete ) { \
315 collreq->req_ompi.req_status.MPI_SOURCE = collreq->mpi_source; \
316 collreq->req_ompi.req_status.MPI_TAG = -1; \
317 collreq->req_ompi.req_status.MPI_ERROR = collreq->mpi_error; \
318 collreq->req_ompi.req_status._ucount = 0; \
319 ompi_request_complete(&(collreq)->req_ompi, true); \
321 OPAL_THREAD_UNLOCK(&ompi_request_lock); \
331 #define COLL_FTBASIC_CHECK_SKIP_ALL_FAILED_BASE(comm, peer) { \
332 if( !ompi_comm_is_proc_active(comm, peer, false) ) { \
342 #define COLL_FTBASIC_FIND_LOWEST_ALIVE_BASE(comm, size, peer) { \
344 for(i = 0; i < size; ++i ) { \
345 if( ompi_comm_is_proc_active(comm, i, false) ) { \
356 #define AGREEMENT_ENABLE_TIMING OPAL_ENABLE_DEBUG
358 #if AGREEMENT_ENABLE_TIMING == 1
359 #define COLL_FTBASIC_AGREEMENT_TIMER_2P_SETUP 0
360 #define COLL_FTBASIC_AGREEMENT_TIMER_2P_BCAST_REQ 1
361 #define COLL_FTBASIC_AGREEMENT_TIMER_2P_GATHER 2
362 #define COLL_FTBASIC_AGREEMENT_TIMER_2P_DECIDE 3
363 #define COLL_FTBASIC_AGREEMENT_TIMER_2P_BCAST 4
364 #define COLL_FTBASIC_AGREEMENT_TIMER_AR_SETUP 5
365 #define COLL_FTBASIC_AGREEMENT_TIMER_AR_GATHER 6
366 #define COLL_FTBASIC_AGREEMENT_TIMER_AR_DECIDE 7
367 #define COLL_FTBASIC_AGREEMENT_TIMER_AR_BCAST 8
368 #define COLL_FTBASIC_AGREEMENT_TIMER_PROTOCOL 9
369 #define COLL_FTBASIC_AGREEMENT_TIMER_DECIDE 10
370 #define COLL_FTBASIC_AGREEMENT_TIMER_REBALANCE 11
371 #define COLL_FTBASIC_AGREEMENT_TIMER_TOTAL 12
372 #define COLL_FTBASIC_AGREEMENT_TIMER_OTHER 13
373 #define COLL_FTBASIC_AGREEMENT_TIMER_MAX 14
375 double agreement_get_time(
void);
376 void agreement_start_time(
int idx);
377 void agreement_end_time(
int idx);
378 void agreement_display_all_timers(
void);
379 void agreement_clear_timers(
void);
381 #define AGREEMENT_START_TIMER(idx) \
383 if(OPAL_UNLIKELY( mca_coll_ftbasic_use_agreement_timer )) { \
384 agreement_start_time(idx); \
388 #define AGREEMENT_END_TIMER(idx) \
390 if(OPAL_UNLIKELY( mca_coll_ftbasic_use_agreement_timer )) { \
391 agreement_end_time(idx); \
395 #define AGREEMENT_CLEAR_ALL_TIMERS() \
397 if(OPAL_UNLIKELY( mca_coll_ftbasic_use_agreement_timer )) { \
398 agreement_clear_timers(); \
402 #define AGREEMENT_DISPLAY_ALL_TIMERS() \
404 if(OPAL_UNLIKELY( mca_coll_ftbasic_use_agreement_timer )) { \
405 agreement_display_all_timers(); \
410 #define AGREEMENT_START_TIMER(idx) ;
411 #define AGREEMENT_END_TIMER(idx) ;
412 #define AGREEMENT_CLEAR_ALL_TIMERS() ;
413 #define AGREEMENT_DISPLAY_ALL_TIMERS() ;
Definition: coll_ftbasic_agreement.h:181
Definition: opal_bitmap.h:53
Definition: coll_ftbasic_agreement.h:263
int seq_num
Agreement Seq Number.
Definition: coll_ftbasic_agreement.h:156
Definition: opal_list.h:98
Definition: coll_ftbasic.h:109
Definition: ompi_free_list.h:39
Group structure Currently we have four formats for storing the process pointers that are members of t...
Definition: group.h:79
Definition: ompi_free_list.h:62
agreement_state_t state
State of the protocol.
Definition: coll_ftbasic_agreement.h:159
opal_list_item_t super
This is a list object.
Definition: coll_ftbasic_agreement.h:153
ompi_free_list_item_t super
This is a list object.
Definition: coll_ftbasic_agreement.h:183
int attempt_num
Attempt number - For debugging only.
Definition: coll_ftbasic_agreement.h:165
Definition: communicator.h:118
Main top-level request struct definition.
Definition: request.h:100
Definition: coll_ftbasic_agreement.h:151
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
opal_bitmap_t * commit_bitmap
Committed bitmap.
Definition: coll_ftbasic_agreement.h:162