Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static inline int req_uses_vc(const MPID_Request* req, const MPIDI_VC_t *vc)
- {
- MPIDI_VC_t *vc1;
- MPIDI_Comm_get_vc(req->comm, req->match.parts.rank, &vc1);
- return vc == vc1;
- }
- static inline int is_vc_in_comm(const MPIDI_VC_t *vc, const MPID_Comm *comm)
- {
- int i;
- for (i = 0; i < comm->local_size; ++i) {
- MPIDI_VC_t *vc1;
- MPIDI_Comm_get_vc(comm, i, &vc1);
- if (vc == vc1)
- return i;
- }
- return -1;
- }
- static inline void dequeue_and_set_error(MPID_Request* req, MPID_Request* prev_req)
- {
- /* remove from queue */
- if (recvq_posted_head == req)
- recvq_posted_head = req->next;
- else
- prev_req->next = req->next;
- if (recvq_posted_tail == req)
- recvq_posted_tail = prev_req;
- /* set error and complete */
- req->status.MPI_ERROR = MPI_SUCCESS;
- MPIU_ERR_SET1(req->status.MPI_ERROR, MPI_ERR_OTHER, "**comm_fail", "**comm_fail %d", vc->pg_rank);
- MPIDI_CH3U_Request_complete(req);
- }
- #undef FUNCNAME
- #define FUNCNAME MPIDU_Complete_posted_with_error
- #undef FCNAME
- #define FCNAME MPIU_QUOTE(FUNCNAME)
- int MPIDU_Complete_posted_with_error(MPIDI_VC_t *vc)
- {
- int mpi_errno = MPI_SUCCESS;
- MPID_Request *req, *prev_req = NULL;
- MPIDI_STATE_DECL(MPID_STATE_MPIDU_COMPLETE_POSTED_WITH_ERROR);
- MPIDI_FUNC_ENTER(MPID_STATE_MPIDU_COMPLETE_POSTED_WITH_ERROR);
- /* check each req to see if the vc is part of that communicator */
- for (req = recvq_posted_head; req; prev_req = req, req = req->next) {
- if (req->match.parts.rank != MPI_ANY_SOURCE) {
- if (req_uses_vc(req, vc))
- dequeue_and_set_error(req, prev_req);
- } else {
- /* We need to dequeue all anysources posted in a
- communicator with a failed VC. We check whether the vc
- is in the communicator by iterating over the comm's VC
- table. Since this may be expensive, now that we know
- the vc is in comm, we take the opportunity to scan the
- rest of the posted recv queue for other anysources with
- the same communicator. */
- if (is_vc_in_comm(vc, req->comm)) {
- MPID_Comm *comm = req->comm;
- MPID_Request *as_req, *prev_as_req = prev_req;
- for (as_req = req; as_req; prev_as_req = as_req, as_req = as_req->next)
- if (as_req->comm == comm && as_req->match.parts.rank == MPI_ANY_SOURCE)
- dequeue_and_set_error(as_req, prev_as_req);
- }
- }
- }
- fn_exit:
- MPIDI_FUNC_EXIT(MPID_STATE_MPIDU_COMPLETE_POSTED_WITH_ERROR);
- return mpi_errno;
- fn_fail:
- goto fn_exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement