From 711b30fbac8baad6335ec619851d287c91b416ff Mon Sep 17 00:00:00 2001 From: Sven Stork Date: Wed, 29 Mar 2006 09:26:27 +0000 Subject: [PATCH] - introduction of user buffer checking for pt2pt operations This commit was SVN r9449. --- ompi/mpi/c/bindings.h | 75 ++++++++++++++++++++++------------- ompi/mpi/c/bsend.c | 7 +++- ompi/mpi/c/get_count.c | 3 +- ompi/mpi/c/ibsend.c | 7 +++- ompi/mpi/c/irecv.c | 7 ++-- ompi/mpi/c/isend.c | 7 +++- ompi/mpi/c/issend.c | 9 +++-- ompi/mpi/c/recv.c | 8 ++-- ompi/mpi/c/recv_init.c | 8 ++-- ompi/mpi/c/rsend.c | 7 +++- ompi/mpi/c/send.c | 8 ++-- ompi/mpi/c/send_init.c | 7 +++- ompi/mpi/c/sendrecv.c | 9 +++-- ompi/mpi/c/sendrecv_replace.c | 2 +- ompi/mpi/c/ssend.c | 7 +++- 15 files changed, 110 insertions(+), 61 deletions(-) diff --git a/ompi/mpi/c/bindings.h b/ompi/mpi/c/bindings.h index 242d9b4f84..4cdd8d476a 100644 --- a/ompi/mpi/c/bindings.h +++ b/ompi/mpi/c/bindings.h @@ -27,6 +27,7 @@ #if defined(c_plusplus) || defined(__cplusplus) extern "C" { #endif + /* If compiling in the profile directory, then we don't have weak symbols and therefore we need the defines to map from MPI->PMPI. NOTE: pragma weak stuff is handled on a file-by-file basis; it @@ -36,7 +37,7 @@ extern "C" { /* This variable is actually in src/mpi/runtime/ompi_mpi_init.c, but it is used by every MPI function. */ -OMPI_DECLSPEC extern bool ompi_mpi_param_check; + OMPI_DECLSPEC extern bool ompi_mpi_param_check; /* These macros have to be used to check the corectness of the datatype depending on the * operations that we have to do with them. They can be used on all functions, not only @@ -44,36 +45,56 @@ OMPI_DECLSPEC extern bool ompi_mpi_param_check; * responsability to do it. */ #define OMPI_CHECK_DATATYPE_FOR_SEND( RC, DDT, COUNT ) \ - do { \ - (RC) = MPI_SUCCESS; \ - if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \ - else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \ - else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \ - else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \ - } while (0) - -#define OMPI_CHECK_DATATYPE_FOR_RECV( RC, DDT, COUNT ) \ - do { \ - (RC) = MPI_SUCCESS; \ - if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \ - else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \ - else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \ - /* XXX Fix flags else if( ompi_ddt_is_overlapped((DDT)) ) (RC) = MPI_ERR_TYPE; */ \ - else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \ - } while (0) + do { \ + /* (RC) = MPI_SUCCESS; */ \ + if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \ + else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \ + else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \ + else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \ + } while (0) +#define OMPI_CHECK_DATATYPE_FOR_RECV( RC, DDT, COUNT ) \ + do { \ + /* (RC) = MPI_SUCCESS; */ \ + if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \ + else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \ + else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \ + /* XXX Fix flags else if( ompi_ddt_is_overlapped((DDT)) ) (RC) = MPI_ERR_TYPE; */ \ + else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \ + } while (0) + #define OMPI_CHECK_DATATYPE_FOR_ONE_SIDED( RC, DDT, COUNT ) \ - do { \ - (RC) = MPI_SUCCESS; \ - if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \ - else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \ - else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \ - else if( ompi_ddt_is_overerlapped((DDT)) ) (RC) = MPI_ERR_TYPE; \ - else if( !ompi_ddt_is_acceptable_for_one_sided((DDT)) ) (RC) = MPI_ERR_TYPE; \ - else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \ - } while(0) + do { \ + /*(RC) = MPI_SUCCESS; */ \ + if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \ + else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \ + else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \ + else if( ompi_ddt_is_overerlapped((DDT)) ) (RC) = MPI_ERR_TYPE; \ + else if( !ompi_ddt_is_acceptable_for_one_sided((DDT)) ) (RC) = MPI_ERR_TYPE; \ + else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \ + } while(0) + +/* This macro has to be used to check the correctness of the user buffer depending on the datatype. + * This macro expects that the DDT parameter is a valid pointer to an ompi datatype object. + */ +#define OMPI_CHECK_USER_BUFFER(RC, BUFFER, DDT, COUNT) \ + do { \ + if ( NULL == (BUFFER) && 0 < (COUNT) && MPI_SUCCESS == (RC) ) { \ + if ( (DDT)->flags & DT_FLAG_PREDEFINED ) { \ + (RC) = MPI_ERR_BUFFER; \ + } else { \ + unsigned long size = 0; \ + ompi_ddt_get_size((DDT), &size); \ + if ( size ) { \ + (RC) = MPI_ERR_BUFFER; \ + } \ + } \ + } \ + } while (0) + #if defined(c_plusplus) || defined(__cplusplus) } #endif + #endif /* OMPI_C_BINDINGS_H */ diff --git a/ompi/mpi/c/bsend.c b/ompi/mpi/c/bsend.c index 9e6dd8bfab..91523fd29b 100644 --- a/ompi/mpi/c/bsend.c +++ b/ompi/mpi/c/bsend.c @@ -35,13 +35,13 @@ 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; + int rc = MPI_SUCCESS; + if (dest == MPI_PROC_NULL) { return MPI_SUCCESS; } if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); @@ -53,6 +53,9 @@ int MPI_Bsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co rc = MPI_ERR_TAG; } else if (ompi_comm_peer_invalid(comm, dest)) { rc = MPI_ERR_RANK; + } else { + OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); + OMPI_CHECK_USER_BUFFER(rc, buf, type, count); } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/get_count.c b/ompi/mpi/c/get_count.c index 49fbb6bfbf..7ec456ff7d 100644 --- a/ompi/mpi/c/get_count.c +++ b/ompi/mpi/c/get_count.c @@ -34,7 +34,8 @@ static const char FUNC_NAME[] = "MPI_Get_count"; int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count) { - int size, rc; + int size = 0; + int rc = MPI_SUCCESS; if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); diff --git a/ompi/mpi/c/ibsend.c b/ompi/mpi/c/ibsend.c index 3e9740047a..7b673bc01c 100644 --- a/ompi/mpi/c/ibsend.c +++ b/ompi/mpi/c/ibsend.c @@ -36,14 +36,14 @@ static const char FUNC_NAME[] = "MPI_Ibsend"; int MPI_Ibsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm, MPI_Request *request) { - int rc; + int rc = MPI_SUCCESS; + if (dest == MPI_PROC_NULL) { *request = &ompi_request_empty; return MPI_SUCCESS; } if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); @@ -57,6 +57,9 @@ int MPI_Ibsend(void *buf, int count, MPI_Datatype type, int dest, rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; + } else { + OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); + OMPI_CHECK_USER_BUFFER(rc, buf, type, count); } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/irecv.c b/ompi/mpi/c/irecv.c index 325f744463..531df8b73e 100644 --- a/ompi/mpi/c/irecv.c +++ b/ompi/mpi/c/irecv.c @@ -35,17 +35,18 @@ static const char FUNC_NAME[] = "MPI_Irecv"; int MPI_Irecv(void *buf, int count, MPI_Datatype type, int source, int tag, MPI_Comm comm, MPI_Request *request) { - int rc; + int rc = MPI_SUCCESS; + if (source == MPI_PROC_NULL) { *request = &ompi_request_empty; return MPI_SUCCESS; } if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; 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)) { diff --git a/ompi/mpi/c/isend.c b/ompi/mpi/c/isend.c index 5578204590..1a11eb91cd 100644 --- a/ompi/mpi/c/isend.c +++ b/ompi/mpi/c/isend.c @@ -36,14 +36,14 @@ static const char FUNC_NAME[] = "MPI_Isend"; int MPI_Isend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm, MPI_Request *request) { - int rc; + int rc = MPI_SUCCESS; + if (dest == MPI_PROC_NULL) { *request = &ompi_request_empty; return MPI_SUCCESS; } if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); @@ -57,6 +57,9 @@ int MPI_Isend(void *buf, int count, MPI_Datatype type, int dest, rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; + } else { + OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); + OMPI_CHECK_USER_BUFFER(rc, buf, type, count); } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/issend.c b/ompi/mpi/c/issend.c index 13235c82a7..77a053f6c8 100644 --- a/ompi/mpi/c/issend.c +++ b/ompi/mpi/c/issend.c @@ -36,14 +36,14 @@ static const char FUNC_NAME[] = "MPI_Issend"; int MPI_Issend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm, MPI_Request *request) { - int rc; + int rc = MPI_SUCCESS; + if (dest == MPI_PROC_NULL) { *request = &ompi_request_empty; return MPI_SUCCESS; } if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); @@ -57,10 +57,13 @@ int MPI_Issend(void *buf, int count, MPI_Datatype type, int dest, rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; + } else { + OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); + OMPI_CHECK_USER_BUFFER(rc, buf, type, count); } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } - + 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/recv.c b/ompi/mpi/c/recv.c index 766b606587..4a31347806 100644 --- a/ompi/mpi/c/recv.c +++ b/ompi/mpi/c/recv.c @@ -35,7 +35,8 @@ static const char FUNC_NAME[] = "MPI_Recv"; int MPI_Recv(void *buf, int count, MPI_Datatype type, int source, int tag, MPI_Comm comm, MPI_Status *status) { - int rc; + int rc = MPI_SUCCESS; + if (MPI_PROC_NULL == source) { if (MPI_STATUS_IGNORE != status) { status->MPI_SOURCE = MPI_PROC_NULL; @@ -47,10 +48,10 @@ int MPI_Recv(void *buf, int count, MPI_Datatype type, int source, } if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; 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)) { @@ -58,6 +59,7 @@ int MPI_Recv(void *buf, int count, MPI_Datatype type, int source, } else if (source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) { rc = MPI_ERR_RANK; } + OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/recv_init.c b/ompi/mpi/c/recv_init.c index 4db6b71689..f26462c469 100644 --- a/ompi/mpi/c/recv_init.c +++ b/ompi/mpi/c/recv_init.c @@ -35,17 +35,18 @@ static const char FUNC_NAME[] = "MPI_Recv_init"; int MPI_Recv_init(void *buf, int count, MPI_Datatype type, int source, int tag, MPI_Comm comm, MPI_Request *request) { - int rc; + int rc = MPI_SUCCESS; + if (source == MPI_PROC_NULL) { *request = &ompi_request_empty; return MPI_SUCCESS; } if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; 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)) { @@ -53,6 +54,7 @@ int MPI_Recv_init(void *buf, int count, MPI_Datatype type, int source, } else if (source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) { rc = MPI_ERR_RANK; } + OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/rsend.c b/ompi/mpi/c/rsend.c index 2e630eeb36..db1bb77aa5 100644 --- a/ompi/mpi/c/rsend.c +++ b/ompi/mpi/c/rsend.c @@ -35,13 +35,13 @@ static const char FUNC_NAME[] = "MPI_Rsend"; int MPI_Rsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm) { - int rc; + int rc = MPI_SUCCESS; + if (dest == MPI_PROC_NULL) { return MPI_SUCCESS; } if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); @@ -53,6 +53,9 @@ int MPI_Rsend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co rc = MPI_ERR_TAG; } else if (ompi_comm_peer_invalid(comm, dest)) { rc = MPI_ERR_RANK; + } else { + OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); + OMPI_CHECK_USER_BUFFER(rc, buf, type, count); } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/send.c b/ompi/mpi/c/send.c index ecade048aa..a0dce6b585 100644 --- a/ompi/mpi/c/send.c +++ b/ompi/mpi/c/send.c @@ -36,13 +36,13 @@ static const char FUNC_NAME[] = "MPI_Send"; int MPI_Send(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm) { - int rc; + int rc = MPI_SUCCESS; + if (dest == MPI_PROC_NULL) { return MPI_SUCCESS; } if ( MPI_PARAM_CHECK ) { - int rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); @@ -53,7 +53,8 @@ int MPI_Send(void *buf, int count, MPI_Datatype type, int dest, } else if (ompi_comm_peer_invalid(comm, dest)) { rc = MPI_ERR_RANK; } else { - OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); + OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); + OMPI_CHECK_USER_BUFFER(rc, buf, type, count); } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } @@ -61,4 +62,3 @@ int MPI_Send(void *buf, int count, MPI_Datatype type, int dest, 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 638c46f254..61be692385 100644 --- a/ompi/mpi/c/send_init.c +++ b/ompi/mpi/c/send_init.c @@ -37,14 +37,14 @@ int MPI_Send_init(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm, MPI_Request *request) { - int rc; + int rc = MPI_SUCCESS; + if (dest == MPI_PROC_NULL) { *request = &ompi_request_empty; return MPI_SUCCESS; } if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); @@ -58,6 +58,9 @@ int MPI_Send_init(void *buf, int count, MPI_Datatype type, rc = MPI_ERR_RANK; } else if (request == NULL) { rc = MPI_ERR_REQUEST; + } else { + OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); + OMPI_CHECK_USER_BUFFER(rc, buf, type, count); } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/sendrecv.c b/ompi/mpi/c/sendrecv.c index af54c2e7d9..d048c16c4c 100644 --- a/ompi/mpi/c/sendrecv.c +++ b/ompi/mpi/c/sendrecv.c @@ -38,14 +38,15 @@ int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, MPI_Comm comm, MPI_Status *status) { ompi_request_t* req; - int rc; + int rc = MPI_SUCCESS; if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); OMPI_CHECK_DATATYPE_FOR_SEND(rc, sendtype, sendcount); OMPI_CHECK_DATATYPE_FOR_RECV(rc, recvtype, recvcount); - + OMPI_CHECK_USER_BUFFER(rc, sendbuf, sendtype, sendcount); + OMPI_CHECK_USER_BUFFER(rc, recvbuf, recvtype, recvcount); + if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); } else if (dest != MPI_PROC_NULL && ompi_comm_peer_invalid(comm, dest)) { @@ -55,7 +56,7 @@ int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, } else if (source != MPI_PROC_NULL && source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) { rc = MPI_ERR_RANK; } else if (((recvtag < 0) && (recvtag != MPI_ANY_TAG)) || (recvtag > mca_pml.pml_max_tag)) { - rc = MPI_ERR_TAG; + rc = MPI_ERR_TAG; } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/sendrecv_replace.c b/ompi/mpi/c/sendrecv_replace.c index e54ac54553..ce1411c119 100644 --- a/ompi/mpi/c/sendrecv_replace.c +++ b/ompi/mpi/c/sendrecv_replace.c @@ -39,7 +39,7 @@ int MPI_Sendrecv_replace(void * buf, int count, MPI_Datatype datatype, MPI_Comm comm, MPI_Status *status) { - int rc; + int rc = MPI_SUCCESS; if ( MPI_PARAM_CHECK ) { rc = MPI_SUCCESS; diff --git a/ompi/mpi/c/ssend.c b/ompi/mpi/c/ssend.c index bf7604399a..4c76ee1068 100644 --- a/ompi/mpi/c/ssend.c +++ b/ompi/mpi/c/ssend.c @@ -34,13 +34,13 @@ static const char FUNC_NAME[] = "MPI_Ssend"; int MPI_Ssend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm) { - int rc; + int rc = MPI_SUCCESS; + if (dest == MPI_PROC_NULL) { return MPI_SUCCESS; } if ( MPI_PARAM_CHECK ) { - rc = MPI_SUCCESS; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (ompi_comm_invalid(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); @@ -52,6 +52,9 @@ int MPI_Ssend(void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Co rc = MPI_ERR_TAG; } else if (ompi_comm_peer_invalid(comm, dest)) { rc = MPI_ERR_RANK; + } else { + OMPI_CHECK_DATATYPE_FOR_SEND(rc, type, count); + OMPI_CHECK_USER_BUFFER(rc, buf, type, count); } OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); }