- introduction of user buffer checking for pt2pt operations
This commit was SVN r9449.
Этот коммит содержится в:
родитель
cf425f6289
Коммит
711b30fbac
@ -27,6 +27,7 @@
|
|||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If compiling in the profile directory, then we don't have weak
|
/* If compiling in the profile directory, then we don't have weak
|
||||||
symbols and therefore we need the defines to map from MPI->PMPI.
|
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
|
NOTE: pragma weak stuff is handled on a file-by-file basis; it
|
||||||
@ -45,7 +46,7 @@ OMPI_DECLSPEC extern bool ompi_mpi_param_check;
|
|||||||
*/
|
*/
|
||||||
#define OMPI_CHECK_DATATYPE_FOR_SEND( RC, DDT, COUNT ) \
|
#define OMPI_CHECK_DATATYPE_FOR_SEND( RC, DDT, COUNT ) \
|
||||||
do { \
|
do { \
|
||||||
(RC) = MPI_SUCCESS; \
|
/* (RC) = MPI_SUCCESS; */ \
|
||||||
if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
|
if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
|
||||||
else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
|
else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
|
||||||
else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
||||||
@ -54,7 +55,7 @@ OMPI_DECLSPEC extern bool ompi_mpi_param_check;
|
|||||||
|
|
||||||
#define OMPI_CHECK_DATATYPE_FOR_RECV( RC, DDT, COUNT ) \
|
#define OMPI_CHECK_DATATYPE_FOR_RECV( RC, DDT, COUNT ) \
|
||||||
do { \
|
do { \
|
||||||
(RC) = MPI_SUCCESS; \
|
/* (RC) = MPI_SUCCESS; */ \
|
||||||
if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
|
if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
|
||||||
else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
|
else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
|
||||||
else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
||||||
@ -64,7 +65,7 @@ OMPI_DECLSPEC extern bool ompi_mpi_param_check;
|
|||||||
|
|
||||||
#define OMPI_CHECK_DATATYPE_FOR_ONE_SIDED( RC, DDT, COUNT ) \
|
#define OMPI_CHECK_DATATYPE_FOR_ONE_SIDED( RC, DDT, COUNT ) \
|
||||||
do { \
|
do { \
|
||||||
(RC) = MPI_SUCCESS; \
|
/*(RC) = MPI_SUCCESS; */ \
|
||||||
if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
|
if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \
|
||||||
else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
|
else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \
|
||||||
else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
||||||
@ -73,7 +74,27 @@ OMPI_DECLSPEC extern bool ompi_mpi_param_check;
|
|||||||
else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \
|
||||||
} while(0)
|
} 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)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* OMPI_C_BINDINGS_H */
|
#endif /* OMPI_C_BINDINGS_H */
|
||||||
|
@ -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 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) {
|
if (dest == MPI_PROC_NULL) {
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
int rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
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;
|
rc = MPI_ERR_TAG;
|
||||||
} else if (ompi_comm_peer_invalid(comm, dest)) {
|
} else if (ompi_comm_peer_invalid(comm, dest)) {
|
||||||
rc = MPI_ERR_RANK;
|
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);
|
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
@ -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 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) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
@ -36,14 +36,14 @@ static const char FUNC_NAME[] = "MPI_Ibsend";
|
|||||||
int MPI_Ibsend(void *buf, int count, MPI_Datatype type, int dest,
|
int MPI_Ibsend(void *buf, int count, MPI_Datatype type, int dest,
|
||||||
int tag, MPI_Comm comm, MPI_Request *request)
|
int tag, MPI_Comm comm, MPI_Request *request)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = MPI_SUCCESS;
|
||||||
|
|
||||||
if (dest == MPI_PROC_NULL) {
|
if (dest == MPI_PROC_NULL) {
|
||||||
*request = &ompi_request_empty;
|
*request = &ompi_request_empty;
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
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;
|
rc = MPI_ERR_RANK;
|
||||||
} else if (request == NULL) {
|
} else if (request == NULL) {
|
||||||
rc = MPI_ERR_REQUEST;
|
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);
|
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
@ -35,16 +35,17 @@ static const char FUNC_NAME[] = "MPI_Irecv";
|
|||||||
int MPI_Irecv(void *buf, int count, MPI_Datatype type, int source,
|
int MPI_Irecv(void *buf, int count, MPI_Datatype type, int source,
|
||||||
int tag, MPI_Comm comm, MPI_Request *request)
|
int tag, MPI_Comm comm, MPI_Request *request)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = MPI_SUCCESS;
|
||||||
|
|
||||||
if (source == MPI_PROC_NULL) {
|
if (source == MPI_PROC_NULL) {
|
||||||
*request = &ompi_request_empty;
|
*request = &ompi_request_empty;
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count);
|
OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count);
|
||||||
|
OMPI_CHECK_USER_BUFFER(rc, buf, type, count);
|
||||||
|
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
||||||
|
@ -36,14 +36,14 @@ static const char FUNC_NAME[] = "MPI_Isend";
|
|||||||
int MPI_Isend(void *buf, int count, MPI_Datatype type, int dest,
|
int MPI_Isend(void *buf, int count, MPI_Datatype type, int dest,
|
||||||
int tag, MPI_Comm comm, MPI_Request *request)
|
int tag, MPI_Comm comm, MPI_Request *request)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = MPI_SUCCESS;
|
||||||
|
|
||||||
if (dest == MPI_PROC_NULL) {
|
if (dest == MPI_PROC_NULL) {
|
||||||
*request = &ompi_request_empty;
|
*request = &ompi_request_empty;
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
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;
|
rc = MPI_ERR_RANK;
|
||||||
} else if (request == NULL) {
|
} else if (request == NULL) {
|
||||||
rc = MPI_ERR_REQUEST;
|
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);
|
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
@ -36,14 +36,14 @@ static const char FUNC_NAME[] = "MPI_Issend";
|
|||||||
int MPI_Issend(void *buf, int count, MPI_Datatype type, int dest,
|
int MPI_Issend(void *buf, int count, MPI_Datatype type, int dest,
|
||||||
int tag, MPI_Comm comm, MPI_Request *request)
|
int tag, MPI_Comm comm, MPI_Request *request)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = MPI_SUCCESS;
|
||||||
|
|
||||||
if (dest == MPI_PROC_NULL) {
|
if (dest == MPI_PROC_NULL) {
|
||||||
*request = &ompi_request_empty;
|
*request = &ompi_request_empty;
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
||||||
@ -57,6 +57,9 @@ int MPI_Issend(void *buf, int count, MPI_Datatype type, int dest,
|
|||||||
rc = MPI_ERR_RANK;
|
rc = MPI_ERR_RANK;
|
||||||
} else if (request == NULL) {
|
} else if (request == NULL) {
|
||||||
rc = MPI_ERR_REQUEST;
|
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);
|
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ static const char FUNC_NAME[] = "MPI_Recv";
|
|||||||
int MPI_Recv(void *buf, int count, MPI_Datatype type, int source,
|
int MPI_Recv(void *buf, int count, MPI_Datatype type, int source,
|
||||||
int tag, MPI_Comm comm, MPI_Status *status)
|
int tag, MPI_Comm comm, MPI_Status *status)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = MPI_SUCCESS;
|
||||||
|
|
||||||
if (MPI_PROC_NULL == source) {
|
if (MPI_PROC_NULL == source) {
|
||||||
if (MPI_STATUS_IGNORE != status) {
|
if (MPI_STATUS_IGNORE != status) {
|
||||||
status->MPI_SOURCE = MPI_PROC_NULL;
|
status->MPI_SOURCE = MPI_PROC_NULL;
|
||||||
@ -47,9 +48,9 @@ int MPI_Recv(void *buf, int count, MPI_Datatype type, int source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count);
|
OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count);
|
||||||
|
OMPI_CHECK_USER_BUFFER(rc, buf, type, count);
|
||||||
|
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
||||||
@ -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)) {
|
} else if (source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) {
|
||||||
rc = MPI_ERR_RANK;
|
rc = MPI_ERR_RANK;
|
||||||
}
|
}
|
||||||
|
|
||||||
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,16 +35,17 @@ static const char FUNC_NAME[] = "MPI_Recv_init";
|
|||||||
int MPI_Recv_init(void *buf, int count, MPI_Datatype type, int source,
|
int MPI_Recv_init(void *buf, int count, MPI_Datatype type, int source,
|
||||||
int tag, MPI_Comm comm, MPI_Request *request)
|
int tag, MPI_Comm comm, MPI_Request *request)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = MPI_SUCCESS;
|
||||||
|
|
||||||
if (source == MPI_PROC_NULL) {
|
if (source == MPI_PROC_NULL) {
|
||||||
*request = &ompi_request_empty;
|
*request = &ompi_request_empty;
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count);
|
OMPI_CHECK_DATATYPE_FOR_RECV(rc, type, count);
|
||||||
|
OMPI_CHECK_USER_BUFFER(rc, buf, type, count);
|
||||||
|
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
||||||
@ -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)) {
|
} else if (source != MPI_ANY_SOURCE && ompi_comm_peer_invalid(comm, source)) {
|
||||||
rc = MPI_ERR_RANK;
|
rc = MPI_ERR_RANK;
|
||||||
}
|
}
|
||||||
|
|
||||||
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 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) {
|
if (dest == MPI_PROC_NULL) {
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
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;
|
rc = MPI_ERR_TAG;
|
||||||
} else if (ompi_comm_peer_invalid(comm, dest)) {
|
} else if (ompi_comm_peer_invalid(comm, dest)) {
|
||||||
rc = MPI_ERR_RANK;
|
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);
|
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,13 @@ static const char FUNC_NAME[] = "MPI_Send";
|
|||||||
int MPI_Send(void *buf, int count, MPI_Datatype type, int dest,
|
int MPI_Send(void *buf, int count, MPI_Datatype type, int dest,
|
||||||
int tag, MPI_Comm comm)
|
int tag, MPI_Comm comm)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = MPI_SUCCESS;
|
||||||
|
|
||||||
if (dest == MPI_PROC_NULL) {
|
if (dest == MPI_PROC_NULL) {
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
int rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
||||||
@ -54,6 +54,7 @@ int MPI_Send(void *buf, int count, MPI_Datatype type, int dest,
|
|||||||
rc = MPI_ERR_RANK;
|
rc = MPI_ERR_RANK;
|
||||||
} else {
|
} 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);
|
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));
|
rc = MCA_PML_CALL(send(buf, count, type, dest, tag, MCA_PML_BASE_SEND_STANDARD, comm));
|
||||||
OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
|
OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,14 +37,14 @@ int MPI_Send_init(void *buf, int count, MPI_Datatype type,
|
|||||||
int dest, int tag, MPI_Comm comm,
|
int dest, int tag, MPI_Comm comm,
|
||||||
MPI_Request *request)
|
MPI_Request *request)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = MPI_SUCCESS;
|
||||||
|
|
||||||
if (dest == MPI_PROC_NULL) {
|
if (dest == MPI_PROC_NULL) {
|
||||||
*request = &ompi_request_empty;
|
*request = &ompi_request_empty;
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
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;
|
rc = MPI_ERR_RANK;
|
||||||
} else if (request == NULL) {
|
} else if (request == NULL) {
|
||||||
rc = MPI_ERR_REQUEST;
|
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);
|
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
@ -38,13 +38,14 @@ int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
|||||||
MPI_Comm comm, MPI_Status *status)
|
MPI_Comm comm, MPI_Status *status)
|
||||||
{
|
{
|
||||||
ompi_request_t* req;
|
ompi_request_t* req;
|
||||||
int rc;
|
int rc = MPI_SUCCESS;
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
OMPI_CHECK_DATATYPE_FOR_SEND(rc, sendtype, sendcount);
|
OMPI_CHECK_DATATYPE_FOR_SEND(rc, sendtype, sendcount);
|
||||||
OMPI_CHECK_DATATYPE_FOR_RECV(rc, recvtype, recvcount);
|
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)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
||||||
|
@ -39,7 +39,7 @@ int MPI_Sendrecv_replace(void * buf, int count, MPI_Datatype datatype,
|
|||||||
MPI_Comm comm, MPI_Status *status)
|
MPI_Comm comm, MPI_Status *status)
|
||||||
|
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = MPI_SUCCESS;
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
rc = MPI_SUCCESS;
|
||||||
|
@ -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 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) {
|
if (dest == MPI_PROC_NULL) {
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MPI_PARAM_CHECK ) {
|
if ( MPI_PARAM_CHECK ) {
|
||||||
rc = MPI_SUCCESS;
|
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
if (ompi_comm_invalid(comm)) {
|
if (ompi_comm_invalid(comm)) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
|
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;
|
rc = MPI_ERR_TAG;
|
||||||
} else if (ompi_comm_peer_invalid(comm, dest)) {
|
} else if (ompi_comm_peer_invalid(comm, dest)) {
|
||||||
rc = MPI_ERR_RANK;
|
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);
|
OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user