From 65fedbe3be11e279970ff2431a2167c6db5180e1 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Thu, 3 Aug 2006 04:44:03 +0000 Subject: [PATCH] * followup to r10972... Even if MPI_PROC_NULL is given, we should do the full argument checking (allowing that MPI_PROC_NULL is legal, of course). Only after the argument checking do we shortcut. Fixes trac:237, which was caused by moving the MPI_PROC_NULL test in MPI_Bsend_init, but not allowing for MPI_PROC_NULL when checking rank. This commit was SVN r11108. The following SVN revision numbers were found above: r10972 --> open-mpi/ompi@31c66d92aa607d2098152075d0c93197c63e1269 The following Trac tickets were found above: Ticket 237 --> https://svn.open-mpi.org/trac/ompi/ticket/237 --- ompi/mpi/c/accumulate.c | 7 ++++--- ompi/mpi/c/bsend.c | 11 ++++++----- ompi/mpi/c/bsend_init.c | 3 ++- ompi/mpi/c/get.c | 6 ++++-- ompi/mpi/c/ibsend.c | 13 +++++++------ ompi/mpi/c/iprobe.c | 31 +++++++++++++++++-------------- ompi/mpi/c/irecv.c | 14 ++++++++------ ompi/mpi/c/irsend.c | 12 +++++++----- ompi/mpi/c/isend.c | 13 +++++++------ ompi/mpi/c/issend.c | 13 +++++++------ ompi/mpi/c/probe.c | 31 +++++++++++++++++-------------- ompi/mpi/c/put.c | 6 ++++-- ompi/mpi/c/recv.c | 34 ++++++++++++++++++---------------- ompi/mpi/c/recv_init.c | 14 ++++++++------ ompi/mpi/c/rsend.c | 11 ++++++----- ompi/mpi/c/rsend_init.c | 12 +++++++----- ompi/mpi/c/send.c | 11 ++++++----- ompi/mpi/c/send_init.c | 13 +++++++------ ompi/mpi/c/ssend.c | 11 ++++++----- ompi/mpi/c/ssend_init.c | 12 +++++++----- 20 files changed, 155 insertions(+), 123 deletions(-) diff --git a/ompi/mpi/c/accumulate.c b/ompi/mpi/c/accumulate.c index f3942bf16b..6d1c25c7e0 100644 --- a/ompi/mpi/c/accumulate.c +++ b/ompi/mpi/c/accumulate.c @@ -43,8 +43,6 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data int rc; ompi_win_t *ompi_win = (ompi_win_t*) win; - if (target_rank == MPI_PROC_NULL) return MPI_SUCCESS; - if (MPI_PARAM_CHECK) { rc = OMPI_SUCCESS; @@ -54,7 +52,8 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN, FUNC_NAME); } else if (origin_count < 0 || target_count < 0) { rc = MPI_ERR_COUNT; - } else if (ompi_win_peer_invalid(win, target_rank)) { + } else if (ompi_win_peer_invalid(win, target_rank) && + (MPI_PROC_NULL != target_rank)) { rc = MPI_ERR_RANK; } else if (MPI_OP_NULL == op) { rc = MPI_ERR_OP; @@ -118,6 +117,8 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data } } + if (MPI_PROC_NULL == target_rank) return MPI_SUCCESS; + rc = ompi_win->w_osc_module->osc_accumulate(origin_addr, origin_count, origin_datatype, diff --git a/ompi/mpi/c/bsend.c b/ompi/mpi/c/bsend.c index 91523fd29b..1c1211a4bc 100644 --- a/ompi/mpi/c/bsend.c +++ b/ompi/mpi/c/bsend.c @@ -36,10 +36,6 @@ static const char FUNC_NAME[] = "MPI_Bsend"; int MPI_Bsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm) { int rc = MPI_SUCCESS; - - if (dest == MPI_PROC_NULL) { - return MPI_SUCCESS; - } if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); @@ -51,7 +47,8 @@ int MPI_Bsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else { OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); @@ -60,6 +57,10 @@ int MPI_Bsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(send(buf, count, type, dest, tag, MCA_PML_BASE_SEND_BUFFERED, comm)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/bsend_init.c b/ompi/mpi/c/bsend_init.c index 4edc5d99a4..fb8d1fd807 100644 --- a/ompi/mpi/c/bsend_init.c +++ b/ompi/mpi/c/bsend_init.c @@ -49,7 +49,8 @@ int MPI_Bsend_init(void *buf, int count, MPI_Datatype type, rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; diff --git a/ompi/mpi/c/get.c b/ompi/mpi/c/get.c index 67850d84dd..f7746d7158 100644 --- a/ompi/mpi/c/get.c +++ b/ompi/mpi/c/get.c @@ -40,7 +40,6 @@ int MPI_Get(void *origin_addr, int origin_count, MPI_Datatype target_datatype, MPI_Win win) { int rc; - if (target_rank == MPI_PROC_NULL) return MPI_SUCCESS; if (MPI_PARAM_CHECK) { rc = OMPI_SUCCESS; @@ -51,7 +50,8 @@ int MPI_Get(void *origin_addr, int origin_count, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN, FUNC_NAME); } else if (origin_count < 0 || target_count < 0) { rc = MPI_ERR_COUNT; - } else if (ompi_win_peer_invalid(win, target_rank)) { + } else if (ompi_win_peer_invalid(win, target_rank) && + (MPI_PROC_NULL != target_rank)) { rc = MPI_ERR_RANK; } else if (!ompi_win_comm_allowed(win)) { rc = MPI_ERR_RMA_CONFLICT; @@ -61,6 +61,8 @@ int MPI_Get(void *origin_addr, int origin_count, OMPI_ERRHANDLER_CHECK(rc, win, rc, FUNC_NAME); } + if (MPI_PROC_NULL == target_rank) return MPI_SUCCESS; + rc = win->w_osc_module->osc_get(origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, win); diff --git a/ompi/mpi/c/ibsend.c b/ompi/mpi/c/ibsend.c index 7b673bc01c..71b914586b 100644 --- a/ompi/mpi/c/ibsend.c +++ b/ompi/mpi/c/ibsend.c @@ -38,11 +38,6 @@ int MPI_Ibsend(void *buf, int count, MPI_Datatype type, int dest, { int rc = MPI_SUCCESS; - if (dest == MPI_PROC_NULL) { - *request = &ompi_request_empty; - return MPI_SUCCESS; - } - if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { @@ -53,7 +48,8 @@ int MPI_Ibsend(void *buf, int count, MPI_Datatype type, int dest, rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; @@ -64,6 +60,11 @@ int MPI_Ibsend(void *buf, int count, MPI_Datatype type, int dest, OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + *request = &ompi_request_empty; + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(isend(buf, count, type, dest, tag, MCA_PML_BASE_SEND_BUFFERED, comm, request)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/iprobe.c b/ompi/mpi/c/iprobe.c index d7ec4d8379..e3a9ff2269 100644 --- a/ompi/mpi/c/iprobe.c +++ b/ompi/mpi/c/iprobe.c @@ -35,7 +35,23 @@ static const char FUNC_NAME[] = "MPI_Iprobe"; int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status) { int rc; - if (source == MPI_PROC_NULL) { + + if ( MPI_PARAM_CHECK ) { + rc = MPI_SUCCESS; + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > mca_pml.pml_max_tag)) { + rc = MPI_ERR_TAG; + } else if (ompi_comm_invalid(comm)) { + rc = MPI_ERR_COMM; + } else if ((source != MPI_ANY_SOURCE) && + (MPI_PROC_NULL != source) && + ompi_comm_peer_invalid(comm, source)) { + rc = MPI_ERR_RANK; + } + OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); + } + + if (MPI_PROC_NULL == source) { if (status) { status->MPI_SOURCE = MPI_PROC_NULL; status->MPI_TAG = MPI_ANY_TAG; @@ -46,19 +62,6 @@ int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status return MPI_SUCCESS; } - if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; - OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > mca_pml.pml_max_tag)) { - rc = MPI_ERR_TAG; - } else if (ompi_comm_invalid(comm)) { - rc = MPI_ERR_COMM; - } else if (source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) { - rc = MPI_ERR_RANK; - } - OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); - } - rc = MCA_PML_CALL(iprobe(source, tag, comm, flag, status)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/irecv.c b/ompi/mpi/c/irecv.c index 531df8b73e..9133c38742 100644 --- a/ompi/mpi/c/irecv.c +++ b/ompi/mpi/c/irecv.c @@ -37,11 +37,6 @@ int MPI_Irecv(void *buf, int count, MPI_Datatype type, int source, { int rc = MPI_SUCCESS; - if (source == MPI_PROC_NULL) { - *request = &ompi_request_empty; - return MPI_SUCCESS; - } - if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count); @@ -51,12 +46,19 @@ int MPI_Irecv(void *buf, int count, MPI_Datatype type, int source, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > mca_pml.pml_max_tag)) { rc = MPI_ERR_TAG; - } else if (source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) { + } else if ((MPI_ANY_SOURCE != source) && + (MPI_PROC_NULL != source) && + ompi_comm_peer_invalid(comm, source)) { rc = MPI_ERR_RANK; } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (source == MPI_PROC_NULL) { + *request = &ompi_request_empty; + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(irecv(buf,count,type,source,tag,comm,request)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/irsend.c b/ompi/mpi/c/irsend.c index 3333b086c1..531747f8a6 100644 --- a/ompi/mpi/c/irsend.c +++ b/ompi/mpi/c/irsend.c @@ -37,10 +37,6 @@ int MPI_Irsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm, MPI_Request *request) { int rc; - if (dest == MPI_PROC_NULL) { - *request = &ompi_request_empty; - return MPI_SUCCESS; - } if ( MPI_PARAM_CHECK ) { rc = MPI_SUCCESS; @@ -53,7 +49,8 @@ int MPI_Irsend(void *buf, int count, MPI_Datatype type, int dest, rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; @@ -61,6 +58,11 @@ int MPI_Irsend(void *buf, int count, MPI_Datatype type, int dest, OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + *request = &ompi_request_empty; + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(isend(buf,count,type,dest,tag, MCA_PML_BASE_SEND_READY,comm,request)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); diff --git a/ompi/mpi/c/isend.c b/ompi/mpi/c/isend.c index 1a11eb91cd..e10791c31a 100644 --- a/ompi/mpi/c/isend.c +++ b/ompi/mpi/c/isend.c @@ -38,11 +38,6 @@ int MPI_Isend(void *buf, int count, MPI_Datatype type, int dest, { int rc = MPI_SUCCESS; - if (dest == MPI_PROC_NULL) { - *request = &ompi_request_empty; - return MPI_SUCCESS; - } - if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { @@ -53,7 +48,8 @@ int MPI_Isend(void *buf, int count, MPI_Datatype type, int dest, rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; @@ -64,6 +60,11 @@ int MPI_Isend(void *buf, int count, MPI_Datatype type, int dest, OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + *request = &ompi_request_empty; + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(isend(buf,count,type,dest,tag,MCA_PML_BASE_SEND_STANDARD,comm,request)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/issend.c b/ompi/mpi/c/issend.c index 77a053f6c8..2f85f285d1 100644 --- a/ompi/mpi/c/issend.c +++ b/ompi/mpi/c/issend.c @@ -38,11 +38,6 @@ int MPI_Issend(void *buf, int count, MPI_Datatype type, int dest, { int rc = MPI_SUCCESS; - if (dest == MPI_PROC_NULL) { - *request = &ompi_request_empty; - return MPI_SUCCESS; - } - if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { @@ -53,7 +48,8 @@ int MPI_Issend(void *buf, int count, MPI_Datatype type, int dest, rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; @@ -64,6 +60,11 @@ int MPI_Issend(void *buf, int count, MPI_Datatype type, int dest, OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + *request = &ompi_request_empty; + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(isend(buf,count,type,dest,tag, MCA_PML_BASE_SEND_SYNCHRONOUS,comm,request)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); diff --git a/ompi/mpi/c/probe.c b/ompi/mpi/c/probe.c index 7fdec0739e..6e44cc3542 100644 --- a/ompi/mpi/c/probe.c +++ b/ompi/mpi/c/probe.c @@ -35,7 +35,23 @@ static const char FUNC_NAME[] = "MPI_Probe"; int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status) { int rc; - if (source == MPI_PROC_NULL) { + + if ( MPI_PARAM_CHECK ) { + rc = MPI_SUCCESS; + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > mca_pml.pml_max_tag)) { + rc = MPI_ERR_TAG; + } else if (ompi_comm_invalid(comm)) { + rc = MPI_ERR_COMM; + } else if ((source != MPI_ANY_SOURCE) && + (MPI_PROC_NULL != source) && + ompi_comm_peer_invalid(comm, source)) { + rc = MPI_ERR_RANK; + } + OMPI_ERRHANDLER_CHECK(rc, comm, rc, "MPI_Probe"); + } + + if (MPI_PROC_NULL == source) { if (status) { status->MPI_SOURCE = MPI_PROC_NULL; status->MPI_TAG = MPI_ANY_TAG; @@ -46,19 +62,6 @@ int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status) return MPI_SUCCESS; } - if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; - OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > mca_pml.pml_max_tag)) { - rc = MPI_ERR_TAG; - } else if (ompi_comm_invalid(comm)) { - rc = MPI_ERR_COMM; - } else if (source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) { - rc = MPI_ERR_RANK; - } - OMPI_ERRHANDLER_CHECK(rc, comm, rc, "MPI_Probe"); - } - rc = MCA_PML_CALL(probe(source, tag, comm, status)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, "MPI_Probe"); } diff --git a/ompi/mpi/c/put.c b/ompi/mpi/c/put.c index d151963fc4..fda254e3be 100644 --- a/ompi/mpi/c/put.c +++ b/ompi/mpi/c/put.c @@ -39,7 +39,6 @@ int MPI_Put(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, MPI_Datatype target_datatype, MPI_Win win) { int rc; - if (target_rank == MPI_PROC_NULL) return MPI_SUCCESS; if (MPI_PARAM_CHECK) { rc = OMPI_SUCCESS; @@ -50,7 +49,8 @@ int MPI_Put(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN, FUNC_NAME); } else if (origin_count < 0 || target_count < 0) { rc = MPI_ERR_COUNT; - } else if (ompi_win_peer_invalid(win, target_rank)) { + } else if (ompi_win_peer_invalid(win, target_rank) && + (MPI_PROC_NULL != target_rank)) { rc = MPI_ERR_RANK; } else if (!ompi_win_comm_allowed(win)) { rc = MPI_ERR_RMA_CONFLICT; @@ -60,6 +60,8 @@ int MPI_Put(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, OMPI_ERRHANDLER_CHECK(rc, win, rc, FUNC_NAME); } + if (MPI_PROC_NULL == target_rank) return MPI_SUCCESS; + rc = win->w_osc_module->osc_put(origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, win); diff --git a/ompi/mpi/c/recv.c b/ompi/mpi/c/recv.c index 9185b04379..14a5379a2b 100644 --- a/ompi/mpi/c/recv.c +++ b/ompi/mpi/c/recv.c @@ -37,6 +37,24 @@ int MPI_Recv(void *buf, int count, MPI_Datatype type, int source, { int rc = MPI_SUCCESS; + if ( MPI_PARAM_CHECK ) { + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count); + OMPI_CHECK_USER_BUFFER(rc, buf, type, count); + + if (ompi_comm_invalid(comm)) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); + } else if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > mca_pml.pml_max_tag)) { + rc = MPI_ERR_TAG; + } else if ((source != MPI_ANY_SOURCE) && + (MPI_PROC_NULL != source) && + ompi_comm_peer_invalid(comm, source)) { + rc = MPI_ERR_RANK; + } + + OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); + } + if (MPI_PROC_NULL == source) { if (MPI_STATUS_IGNORE != status) { status->MPI_SOURCE = MPI_PROC_NULL; @@ -48,22 +66,6 @@ int MPI_Recv(void *buf, int count, MPI_Datatype type, int source, return MPI_SUCCESS; } - if ( MPI_PARAM_CHECK ) { - OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count); - OMPI_CHECK_USER_BUFFER(rc, buf, type, count); - - if (ompi_comm_invalid(comm)) { - return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); - } else if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > mca_pml.pml_max_tag)) { - rc = MPI_ERR_TAG; - } else if (source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) { - rc = MPI_ERR_RANK; - } - - OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); - } - rc = MCA_PML_CALL(recv(buf, count, type, source, tag, comm, status)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/recv_init.c b/ompi/mpi/c/recv_init.c index f26462c469..8ba4c08629 100644 --- a/ompi/mpi/c/recv_init.c +++ b/ompi/mpi/c/recv_init.c @@ -37,11 +37,6 @@ int MPI_Recv_init(void *buf, int count, MPI_Datatype type, int source, { int rc = MPI_SUCCESS; - if (source == MPI_PROC_NULL) { - *request = &ompi_request_empty; - return MPI_SUCCESS; - } - if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count); @@ -51,13 +46,20 @@ int MPI_Recv_init(void *buf, int count, MPI_Datatype type, int source, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (((tag < 0) && (tag != MPI_ANY_TAG)) || (tag > mca_pml.pml_max_tag)) { rc = MPI_ERR_TAG; - } else if (source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) { + } else if ((source != MPI_ANY_SOURCE) && + (MPI_PROC_NULL != source) && + ompi_comm_peer_invalid(comm, source)) { rc = MPI_ERR_RANK; } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == source) { + *request = &ompi_request_empty; + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(irecv_init(buf,count,type,source,tag,comm,request)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/rsend.c b/ompi/mpi/c/rsend.c index db1bb77aa5..dbabada857 100644 --- a/ompi/mpi/c/rsend.c +++ b/ompi/mpi/c/rsend.c @@ -37,10 +37,6 @@ int MPI_Rsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co { int rc = MPI_SUCCESS; - if (dest == MPI_PROC_NULL) { - return MPI_SUCCESS; - } - if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { @@ -51,7 +47,8 @@ int MPI_Rsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else { OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); @@ -60,6 +57,10 @@ int MPI_Rsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(send(buf, count, type, dest, tag, MCA_PML_BASE_SEND_READY, comm)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); diff --git a/ompi/mpi/c/rsend_init.c b/ompi/mpi/c/rsend_init.c index 3dcfe48a84..8c85cc7109 100644 --- a/ompi/mpi/c/rsend_init.c +++ b/ompi/mpi/c/rsend_init.c @@ -38,10 +38,6 @@ int MPI_Rsend_init(void *buf, int count, MPI_Datatype type, MPI_Request *request) { int rc; - if (dest == MPI_PROC_NULL) { - *request = &ompi_request_empty; - return MPI_SUCCESS; - } if ( MPI_PARAM_CHECK ) { rc = MPI_SUCCESS; @@ -54,7 +50,8 @@ int MPI_Rsend_init(void *buf, int count, MPI_Datatype type, rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; @@ -62,6 +59,11 @@ int MPI_Rsend_init(void *buf, int count, MPI_Datatype type, OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + *request = &ompi_request_empty; + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(isend_init(buf,count,type,dest,tag, MCA_PML_BASE_SEND_READY,comm,request)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); diff --git a/ompi/mpi/c/send.c b/ompi/mpi/c/send.c index a0dce6b585..adfc37f8d8 100644 --- a/ompi/mpi/c/send.c +++ b/ompi/mpi/c/send.c @@ -38,10 +38,6 @@ int MPI_Send(void *buf, int count, MPI_Datatype type, int dest, { int rc = MPI_SUCCESS; - if (dest == MPI_PROC_NULL) { - return MPI_SUCCESS; - } - if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { @@ -50,7 +46,8 @@ int MPI_Send(void *buf, int count, MPI_Datatype type, int dest, rc = MPI_ERR_COUNT; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else { OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); @@ -59,6 +56,10 @@ int MPI_Send(void *buf, int count, MPI_Datatype type, int dest, OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(send(buf, count, type, dest, tag, MCA_PML_BASE_SEND_STANDARD, comm)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/send_init.c b/ompi/mpi/c/send_init.c index 61be692385..b942077d7b 100644 --- a/ompi/mpi/c/send_init.c +++ b/ompi/mpi/c/send_init.c @@ -39,11 +39,6 @@ int MPI_Send_init(void *buf, int count, MPI_Datatype type, { int rc = MPI_SUCCESS; - if (dest == MPI_PROC_NULL) { - *request = &ompi_request_empty; - return MPI_SUCCESS; - } - if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { @@ -54,7 +49,8 @@ int MPI_Send_init(void *buf, int count, MPI_Datatype type, rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; @@ -65,6 +61,11 @@ int MPI_Send_init(void *buf, int count, MPI_Datatype type, OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + *request = &ompi_request_empty; + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(isend_init(buf,count,type,dest,tag,MCA_PML_BASE_SEND_STANDARD,comm,request)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/ssend.c b/ompi/mpi/c/ssend.c index 4c76ee1068..06628ab40e 100644 --- a/ompi/mpi/c/ssend.c +++ b/ompi/mpi/c/ssend.c @@ -36,10 +36,6 @@ int MPI_Ssend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co { int rc = MPI_SUCCESS; - if (dest == MPI_PROC_NULL) { - return MPI_SUCCESS; - } - if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { @@ -50,7 +46,8 @@ int MPI_Ssend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else { OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); @@ -59,6 +56,10 @@ int MPI_Ssend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(send(buf, count, type, dest, tag, MCA_PML_BASE_SEND_SYNCHRONOUS, comm)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME); diff --git a/ompi/mpi/c/ssend_init.c b/ompi/mpi/c/ssend_init.c index 64010cc5e4..bc09491829 100644 --- a/ompi/mpi/c/ssend_init.c +++ b/ompi/mpi/c/ssend_init.c @@ -38,10 +38,6 @@ int MPI_Ssend_init(void *buf, int count, MPI_Datatype type, MPI_Request *request) { int rc; - if (dest == MPI_PROC_NULL) { - *request = &ompi_request_empty; - return MPI_SUCCESS; - } if ( MPI_PARAM_CHECK ) { rc = MPI_SUCCESS; @@ -54,7 +50,8 @@ int MPI_Ssend_init(void *buf, int count, MPI_Datatype type, rc = MPI_ERR_TYPE; } else if (tag < 0 || tag > mca_pml.pml_max_tag) { rc = MPI_ERR_TAG; - } else if (ompi_comm_peer_invalid(comm, dest)) { + } else if (ompi_comm_peer_invalid(comm, dest) && + (MPI_PROC_NULL != dest)) { rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; @@ -62,6 +59,11 @@ int MPI_Ssend_init(void *buf, int count, MPI_Datatype type, OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } + if (MPI_PROC_NULL == dest) { + *request = &ompi_request_empty; + return MPI_SUCCESS; + } + rc = MCA_PML_CALL(isend_init(buf,count,type,dest,tag, MCA_PML_BASE_SEND_SYNCHRONOUS,comm,request)); OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);