Created
March 7, 2012 23:48
-
-
Save goodell/1997358 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| commit 7f49a32b72ff868d46da29fe345fe5c5c0c0ca83 | |
| Author: Dave Goodell <[email protected]> | |
| Date: Wed Mar 7 16:18:50 2012 -0600 | |
| add a helper macro to create "proc null" requests | |
| Convert to using it in CH3's MPID_Irecv | |
| No reviewer. | |
| --- | |
| src/mpid/ch3/include/mpidimpl.h | 17 +++++++++++++++++ | |
| src/mpid/ch3/src/mpid_irecv.c | 18 +++--------------- | |
| 2 files changed, 20 insertions(+), 15 deletions(-) | |
| diff --git a/src/mpid/ch3/include/mpidimpl.h b/src/mpid/ch3/include/mpidimpl.h | |
| index 2038d13..155296f 100644 | |
| --- a/src/mpid/ch3/include/mpidimpl.h | |
| +++ b/src/mpid/ch3/include/mpidimpl.h | |
| @@ -378,6 +378,23 @@ extern MPIDI_Process_t MPIDI_Process; | |
| MPIDI_CH3_REQUEST_INIT(rreq_);\ | |
| } | |
| +/* creates a new, trivially complete recv request that is suitable for | |
| + * returning when a user passed MPI_PROC_NULL */ | |
| +#define MPIDI_Request_create_null_rreq(rreq_, mpi_errno_, FAIL_) \ | |
| + do { \ | |
| + (rreq_) = MPID_Request_create(); \ | |
| + if ((rreq_) != NULL) { \ | |
| + MPIU_Object_set_ref((rreq_), 1); \ | |
| + /* MT FIXME should these be handled by MPID_Request_create? */ \ | |
| + MPID_cc_set(&(rreq_)->cc, 0); \ | |
| + (rreq_)->kind = MPID_REQUEST_RECV; \ | |
| + MPIR_Status_set_procnull(&(rreq_)->status); \ | |
| + } \ | |
| + else { \ | |
| + MPIU_ERR_SETANDJUMP(mpi_errno_,MPI_ERR_OTHER,"**nomemreq"); \ | |
| + } \ | |
| + } while (0) | |
| + | |
| #define MPIDI_REQUEST_MSG_MASK (0x3 << MPIDI_REQUEST_MSG_SHIFT) | |
| #define MPIDI_REQUEST_MSG_SHIFT 0 | |
| #define MPIDI_REQUEST_NO_MSG 0 | |
| diff --git a/src/mpid/ch3/src/mpid_irecv.c b/src/mpid/ch3/src/mpid_irecv.c | |
| index c07341b..566a9c2 100644 | |
| --- a/src/mpid/ch3/src/mpid_irecv.c | |
| +++ b/src/mpid/ch3/src/mpid_irecv.c | |
| @@ -24,23 +24,11 @@ int MPID_Irecv(void * buf, int count, MPI_Datatype datatype, int rank, int tag, | |
| MPIU_DBG_MSG_FMT(CH3_OTHER,VERBOSE,(MPIU_DBG_FDEST, | |
| "rank=%d, tag=%d, context=%d", | |
| rank, tag, comm->recvcontext_id + context_offset)); | |
| - | |
| + | |
| if (rank == MPI_PROC_NULL) | |
| { | |
| - rreq = MPID_Request_create(); | |
| - if (rreq != NULL) | |
| - { | |
| - /* MT FIXME should these be handled by MPID_Request_create? */ | |
| - MPIU_Object_set_ref(rreq, 1); | |
| - MPID_cc_set(&rreq->cc, 0); | |
| - rreq->kind = MPID_REQUEST_RECV; | |
| - MPIR_Status_set_procnull(&rreq->status); | |
| - } | |
| - else | |
| - { | |
| - MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomemreq"); | |
| - } | |
| - goto fn_exit; | |
| + MPIDI_Request_create_null_rreq(rreq, mpi_errno, fn_fail); | |
| + goto fn_exit; | |
| } | |
| MPIU_THREAD_CS_ENTER(MSGQUEUE,); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment