mpi/c: revamp error handling in MPI_{Pack,Unpack}[_external]
Thanks Alex and the folks at Mellanox for the help. Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
родитель
d5266aba90
Коммит
880f2d5431
@ -13,7 +13,7 @@
|
|||||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
* Copyright (c) 2015-2016 Research Organization for Information Science
|
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
@ -45,7 +45,7 @@ static const char FUNC_NAME[] = "MPI_Pack";
|
|||||||
int MPI_Pack(const void *inbuf, int incount, MPI_Datatype datatype,
|
int MPI_Pack(const void *inbuf, int incount, MPI_Datatype datatype,
|
||||||
void *outbuf, int outsize, int *position, MPI_Comm comm)
|
void *outbuf, int outsize, int *position, MPI_Comm comm)
|
||||||
{
|
{
|
||||||
int rc = MPI_SUCCESS;
|
int rc = MPI_SUCCESS, ret;
|
||||||
opal_convertor_t local_convertor;
|
opal_convertor_t local_convertor;
|
||||||
struct iovec invec;
|
struct iovec invec;
|
||||||
unsigned int iov_count;
|
unsigned int iov_count;
|
||||||
@ -95,14 +95,16 @@ int MPI_Pack(const void *inbuf, int incount, MPI_Datatype datatype,
|
|||||||
|
|
||||||
/* Do the actual packing */
|
/* Do the actual packing */
|
||||||
iov_count = 1;
|
iov_count = 1;
|
||||||
rc = opal_convertor_pack( &local_convertor, &invec, &iov_count, &size );
|
ret = opal_convertor_pack( &local_convertor, &invec, &iov_count, &size );
|
||||||
*position += size;
|
*position += size;
|
||||||
OBJ_DESTRUCT( &local_convertor );
|
OBJ_DESTRUCT( &local_convertor );
|
||||||
|
|
||||||
OPAL_CR_EXIT_LIBRARY();
|
OPAL_CR_EXIT_LIBRARY();
|
||||||
|
|
||||||
/* All done. Note that the convertor returns 1 upon success, not
|
/* All done. Note that the convertor returns 1 upon success, not
|
||||||
OMPI_SUCCESS. */
|
OPAL_SUCCESS. */
|
||||||
OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR,
|
if (1 != ret) {
|
||||||
comm, MPI_ERR_UNKNOWN, FUNC_NAME);
|
rc = OMPI_ERROR;
|
||||||
|
}
|
||||||
|
OMPI_ERRHANDLER_RETURN(rc, comm, MPI_ERR_UNKNOWN, FUNC_NAME);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
* Copyright (c) 2015-2016 Research Organization for Information Science
|
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
@ -76,6 +76,5 @@ int MPI_Pack_external(const char datarep[], const void *inbuf, int incount,
|
|||||||
|
|
||||||
OPAL_CR_EXIT_LIBRARY();
|
OPAL_CR_EXIT_LIBRARY();
|
||||||
|
|
||||||
OMPI_ERRHANDLER_RETURN((OMPI_SUCCESS == rc) ? OMPI_SUCCESS : OMPI_ERROR,
|
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
|
||||||
MPI_COMM_WORLD, rc, FUNC_NAME);
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
* Copyright (c) 2015-2016 Research Organization for Information Science
|
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
@ -66,6 +66,5 @@ int MPI_Pack_external_size(const char datarep[], int incount,
|
|||||||
datatype, size);
|
datatype, size);
|
||||||
OPAL_CR_EXIT_LIBRARY();
|
OPAL_CR_EXIT_LIBRARY();
|
||||||
|
|
||||||
OMPI_ERRHANDLER_RETURN((OMPI_SUCCESS == rc) ? OMPI_SUCCESS : OMPI_ERROR,
|
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
|
||||||
MPI_COMM_WORLD, rc, FUNC_NAME);
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2015-2016 Research Organization for Information Science
|
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
@ -79,6 +79,7 @@ int MPI_Unpack(const void *inbuf, int insize, int *position,
|
|||||||
OPAL_CR_ENTER_LIBRARY();
|
OPAL_CR_ENTER_LIBRARY();
|
||||||
|
|
||||||
if( insize > 0 ) {
|
if( insize > 0 ) {
|
||||||
|
int ret;
|
||||||
OBJ_CONSTRUCT( &local_convertor, opal_convertor_t );
|
OBJ_CONSTRUCT( &local_convertor, opal_convertor_t );
|
||||||
/* the resulting convertor will be set the the position ZERO */
|
/* the resulting convertor will be set the the position ZERO */
|
||||||
opal_convertor_copy_and_prepare_for_recv( ompi_mpi_local_convertor, &(datatype->super),
|
opal_convertor_copy_and_prepare_for_recv( ompi_mpi_local_convertor, &(datatype->super),
|
||||||
@ -98,17 +99,17 @@ int MPI_Unpack(const void *inbuf, int insize, int *position,
|
|||||||
|
|
||||||
/* Do the actual unpacking */
|
/* Do the actual unpacking */
|
||||||
iov_count = 1;
|
iov_count = 1;
|
||||||
rc = opal_convertor_unpack( &local_convertor, &outvec, &iov_count, &size );
|
ret = opal_convertor_unpack( &local_convertor, &outvec, &iov_count, &size );
|
||||||
*position += size;
|
*position += size;
|
||||||
OBJ_DESTRUCT( &local_convertor );
|
OBJ_DESTRUCT( &local_convertor );
|
||||||
} else {
|
/* All done. Note that the convertor returns 1 upon success, not
|
||||||
rc = 1;
|
OPAL_SUCCESS. */
|
||||||
|
if (1 != ret) {
|
||||||
|
rc = OMPI_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OPAL_CR_EXIT_LIBRARY();
|
OPAL_CR_EXIT_LIBRARY();
|
||||||
|
|
||||||
/* All done. Note that the convertor returns 1 upon success, not
|
OMPI_ERRHANDLER_RETURN(rc, comm, MPI_ERR_UNKNOWN, FUNC_NAME);
|
||||||
OMPI_SUCCESS. */
|
|
||||||
OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR,
|
|
||||||
comm, MPI_ERR_UNKNOWN, FUNC_NAME);
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||||
* reserved.
|
* reserved.
|
||||||
* Copyright (c) 2015-2016 Research Organization for Information Science
|
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
@ -70,9 +70,7 @@ int MPI_Unpack_external (const char datarep[], const void *inbuf, MPI_Aint insiz
|
|||||||
rc = ompi_datatype_unpack_external(datarep, inbuf, insize,
|
rc = ompi_datatype_unpack_external(datarep, inbuf, insize,
|
||||||
position, outbuf, outcount,
|
position, outbuf, outcount,
|
||||||
datatype);
|
datatype);
|
||||||
|
|
||||||
OPAL_CR_EXIT_LIBRARY();
|
OPAL_CR_EXIT_LIBRARY();
|
||||||
|
|
||||||
OMPI_ERRHANDLER_RETURN((OMPI_SUCCESS == rc) ? OMPI_SUCCESS : OMPI_ERROR,
|
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
|
||||||
MPI_COMM_WORLD, rc, FUNC_NAME);
|
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user