11 #ifndef __VPROTOCOL_PESSIMIST_EVENTLOG_H__
12 #define __VPROTOCOL_PESSIMIST_EVENTLOG_H__
14 #include "vprotocol_pessimist.h"
15 #include "vprotocol_pessimist_request.h"
16 #include "vprotocol_pessimist_eventlog_protocol.h"
40 static inline void vprotocol_pessimist_matching_log_prepare(
ompi_request_t *req)
43 if(MPI_ANY_SOURCE == pmlreq->
req_peer)
46 VPESSIMIST_MATCHING_EVENT_NEW(event);
48 VPESSIMIST_RECV_FTREQ(req)->event = event;
58 static inline void vprotocol_pessimist_matching_log_finish(
ompi_request_t *req)
66 V_OUTPUT_VERBOSE(70,
"pessimist:\tlog\tmatch\t%"PRIpclock
"\tsrc %d\tseq %"PRIpclock, ftreq->reqid, req->
req_status.MPI_SOURCE, ((
mca_pml_base_request_t *) req)->req_sequence);
68 mevent = &(
event->u_event.e_matching);
69 mevent->reqid = ftreq->reqid;
76 #include "ompi/request/request_default.h"
79 #define __VPROTOCOL_PESSIMIST_SEND_BUFFER() do { \
80 if(OPAL_UNLIKELY(mca_vprotocol_pessimist.event_buffer_length)) \
83 ompi_request_t *req; \
84 vprotocol_pessimist_clock_t max_clock; \
85 if(OPAL_UNLIKELY(ompi_comm_invalid(mca_vprotocol_pessimist.el_comm))) \
87 rc = vprotocol_pessimist_event_logger_connect(0, \
88 &mca_vprotocol_pessimist.el_comm); \
89 if(OMPI_SUCCESS != rc) \
90 OMPI_ERRHANDLER_INVOKE(mca_vprotocol_pessimist.el_comm, rc, \
91 __FILE__ ": failed to connect to an Event Logger"); \
93 rc = mca_pml_v.host_pml.pml_irecv(&max_clock, \
94 1, MPI_UNSIGNED_LONG_LONG, 0, \
95 VPROTOCOL_PESSIMIST_EVENTLOG_ACK, \
96 mca_vprotocol_pessimist.el_comm, &req); \
97 rc = mca_pml_v.host_pml.pml_send(mca_vprotocol_pessimist.event_buffer,\
98 mca_vprotocol_pessimist.event_buffer_length * \
99 sizeof(vprotocol_pessimist_mem_event_t), MPI_BYTE, 0, \
100 VPROTOCOL_PESSIMIST_EVENTLOG_PUT_EVENTS_CMD, \
101 MCA_PML_BASE_SEND_STANDARD, mca_vprotocol_pessimist.el_comm); \
102 if(OPAL_UNLIKELY(MPI_SUCCESS != rc)) \
103 OMPI_ERRHANDLER_INVOKE(mca_vprotocol_pessimist.el_comm, rc, \
104 __FILE__ ": failed logging a set of recovery event"); \
105 mca_vprotocol_pessimist.event_buffer_length = 0; \
106 rc = mca_pml_v.host_request_fns.req_wait(&req, MPI_STATUS_IGNORE); \
107 if(OPAL_UNLIKELY(MPI_SUCCESS != rc)) \
108 OMPI_ERRHANDLER_INVOKE(mca_vprotocol_pessimist.el_comm, rc, \
109 __FILE__ ": failed logging a set of recovery event"); \
117 static inline void vprotocol_pessimist_event_flush(
void)
134 if(event->u_event.e_matching.src == -1)
138 assert(event->type == VPROTOCOL_PESSIMIST_EVENT_TYPE_MATCHING);
141 V_OUTPUT_VERBOSE(41,
"pessimist:\tlog\tel\t%"PRIpclock
"\tnot matched yet (%d)", event->u_event.e_matching.reqid, event->u_event.e_matching.src);
144 event->u_event.e_matching.src =
145 event->req->req_ompi.req_status.MPI_SOURCE;
148 V_OUTPUT_VERBOSE(40,
"pessimist:\tlog\tel\t%"PRIpclock
"\tfrom %d\tsent to EL", event->u_event.e_matching.reqid, event->u_event.e_matching.src);
149 mca_vprotocol_pessimist.event_buffer[mca_vprotocol_pessimist.event_buffer_length++] =
151 if(mca_vprotocol_pessimist.event_buffer_length ==
152 mca_vprotocol_pessimist.event_buffer_max_length)
153 __VPROTOCOL_PESSIMIST_SEND_BUFFER();
154 assert(mca_vprotocol_pessimist.event_buffer_length < mca_vprotocol_pessimist.event_buffer_max_length);
158 VPESSIMIST_EVENT_RETURN(event);
162 __VPROTOCOL_PESSIMIST_SEND_BUFFER();
171 #define VPROTOCOL_PESSIMIST_MATCHING_REPLAY(src) do { \
172 if(mca_vprotocol_pessimist.replay && ((src) == MPI_ANY_SOURCE)) \
173 vprotocol_pessimist_matching_replay(&(src)); \
175 void vprotocol_pessimist_matching_replay(
int *src);
184 static inline void vprotocol_pessimist_delivery_log(
ompi_request_t *req)
192 V_OUTPUT_VERBOSE(70,
"pessimist:\tlog\tdeliver\t%"PRIpclock
"\tnone", mca_vprotocol_pessimist.clock);
195 if(event->type == VPROTOCOL_PESSIMIST_EVENT_TYPE_DELIVERY &&
196 event->u_event.e_delivery.reqid == 0)
199 event->u_event.e_delivery.probeid = mca_vprotocol_pessimist.clock++;
205 VPESSIMIST_DELIVERY_EVENT_NEW(event);
206 devent = &(
event->u_event.e_delivery);
207 devent->probeid = mca_vprotocol_pessimist.clock++;
216 V_OUTPUT_VERBOSE(70,
"pessimist:\tlog\tdeliver\t%"PRIpclock
"\treq %"PRIpclock, mca_vprotocol_pessimist.clock, VPESSIMIST_FTREQ(req)->reqid);
217 VPESSIMIST_DELIVERY_EVENT_NEW(event);
218 devent = &(
event->u_event.e_delivery);
219 devent->probeid = mca_vprotocol_pessimist.clock++;
220 devent->reqid = VPESSIMIST_FTREQ(req)->reqid;
234 #define VPROTOCOL_PESSIMIST_DELIVERY_REPLAY(n, reqs, outcount, i, status) do {\
235 if(mca_vprotocol_pessimist.replay) \
236 vprotocol_pessimist_delivery_replay(n, reqs, outcount, i, status); \
238 void vprotocol_pessimist_delivery_replay(
size_t,
ompi_request_t **,
static opal_list_item_t * opal_list_get_first(opal_list_t *list)
Return the first item on the list (does not remove it).
Definition: opal_list.h:195
Definition: vprotocol_pessimist_event.h:35
static opal_list_item_t * opal_list_remove_item(opal_list_t *list, opal_list_item_t *item)
Remove an item from a list.
Definition: opal_list.h:348
static opal_list_item_t * opal_list_get_last(opal_list_t *list)
Return the last item on the list (does not remove it).
Definition: opal_list.h:222
ompi_status_public_t req_status
Completion status.
Definition: request.h:103
static bool opal_list_is_empty(opal_list_t *list)
Check for empty list.
Definition: opal_list.h:174
Structure to represent a single event.
Definition: event_struct.h:87
Definition: vprotocol_pessimist_event.h:45
int32_t req_peer
peer process - rank w/in this communicator
Definition: pml_base_request.h:71
Definition: opal_list.h:98
Definition: vprotocol_pessimist_event.h:30
#define opal_list_append(l, i)
Append an item to the end of the list.
Definition: opal_list.h:410
#define opal_list_get_next(item)
Get the next item in a list.
Definition: opal_list.h:128
Definition: vprotocol_pessimist_request.h:22
ompi_request_t req_ompi
base request
Definition: pml_base_request.h:60
Definition: communicator.h:118
Main top-level request struct definition.
Definition: request.h:100
Type of request.
Definition: pml_base_request.h:57
static opal_list_item_t * opal_list_get_end(opal_list_t *list)
Return the end of the list; an invalid list entry suitable for comparison only.
Definition: opal_list.h:274