1
1

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>
Этот коммит содержится в:
Gilles Gouaillardet 2017-03-01 09:59:58 +09:00
родитель d5266aba90
Коммит 880f2d5431
5 изменённых файлов: 23 добавлений и 24 удалений

Просмотреть файл

@ -13,7 +13,7 @@
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. 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.
* $COPYRIGHT$
*
@ -45,7 +45,7 @@ static const char FUNC_NAME[] = "MPI_Pack";
int MPI_Pack(const void *inbuf, int incount, MPI_Datatype datatype,
void *outbuf, int outsize, int *position, MPI_Comm comm)
{
int rc = MPI_SUCCESS;
int rc = MPI_SUCCESS, ret;
opal_convertor_t local_convertor;
struct iovec invec;
unsigned int iov_count;
@ -95,14 +95,16 @@ int MPI_Pack(const void *inbuf, int incount, MPI_Datatype datatype,
/* Do the actual packing */
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;
OBJ_DESTRUCT( &local_convertor );
OPAL_CR_EXIT_LIBRARY();
/* All done. Note that the convertor returns 1 upon success, not
OMPI_SUCCESS. */
OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR,
comm, MPI_ERR_UNKNOWN, FUNC_NAME);
OPAL_SUCCESS. */
if (1 != ret) {
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) 2013 Los Alamos National Security, LLC. 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.
* $COPYRIGHT$
*
@ -76,6 +76,5 @@ int MPI_Pack_external(const char datarep[], const void *inbuf, int incount,
OPAL_CR_EXIT_LIBRARY();
OMPI_ERRHANDLER_RETURN((OMPI_SUCCESS == rc) ? OMPI_SUCCESS : OMPI_ERROR,
MPI_COMM_WORLD, rc, FUNC_NAME);
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}

Просмотреть файл

@ -13,7 +13,7 @@
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. 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.
* $COPYRIGHT$
*
@ -66,6 +66,5 @@ int MPI_Pack_external_size(const char datarep[], int incount,
datatype, size);
OPAL_CR_EXIT_LIBRARY();
OMPI_ERRHANDLER_RETURN((OMPI_SUCCESS == rc) ? OMPI_SUCCESS : OMPI_ERROR,
MPI_COMM_WORLD, rc, FUNC_NAME);
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}

Просмотреть файл

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* 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.
* $COPYRIGHT$
*
@ -79,6 +79,7 @@ int MPI_Unpack(const void *inbuf, int insize, int *position,
OPAL_CR_ENTER_LIBRARY();
if( insize > 0 ) {
int ret;
OBJ_CONSTRUCT( &local_convertor, opal_convertor_t );
/* the resulting convertor will be set the the position ZERO */
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 */
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;
OBJ_DESTRUCT( &local_convertor );
} else {
rc = 1;
/* All done. Note that the convertor returns 1 upon success, not
OPAL_SUCCESS. */
if (1 != ret) {
rc = OMPI_ERROR;
}
}
OPAL_CR_EXIT_LIBRARY();
/* All done. Note that the convertor returns 1 upon success, not
OMPI_SUCCESS. */
OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR,
comm, MPI_ERR_UNKNOWN, FUNC_NAME);
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) 2013 Los Alamos National Security, LLC. 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.
* $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,
position, outbuf, outcount,
datatype);
OPAL_CR_EXIT_LIBRARY();
OMPI_ERRHANDLER_RETURN((OMPI_SUCCESS == rc) ? OMPI_SUCCESS : OMPI_ERROR,
MPI_COMM_WORLD, rc, FUNC_NAME);
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}