Minor updates:
* ompi_errcode_get_mpi_code() already checks for >0 error codes; the checks in OMPI_ERRHANDLER_INVOKE, OMPI_ERRHANDLER_CHECK, and OMPI_ERRHANDLER_RETURN were superfluous. * Ensure to use/return an OPAL_SOS-decoded value in ompi_errcode_get_mpi_code(). * Symbols beginning with !__ technically belong in the compiler namespace; we shouldn't be using those. * Other minor style updates in ompi_errcode_get_mpi_code(). This commit was SVN r23463.
Этот коммит содержится в:
родитель
45019a3abf
Коммит
2af3e6e5ae
@ -10,6 +10,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -27,6 +28,7 @@
|
||||
#include "ompi/constants.h"
|
||||
#include "opal/class/opal_object.h"
|
||||
#include "opal/class/opal_pointer_array.h"
|
||||
#include "opal/util/opal_sos.h"
|
||||
|
||||
#define OMPI_MAX_ERROR_STRING 64
|
||||
|
||||
@ -48,13 +50,17 @@ OMPI_DECLSPEC extern opal_pointer_array_t ompi_errcodes_intern;
|
||||
OMPI_DECLSPEC extern int ompi_errcode_intern_lastused;
|
||||
|
||||
/**
|
||||
* Return the MPI errcode for a given internal error code
|
||||
* Return the MPI errcode for a given internal error code. This
|
||||
* function guarantees to return a non-OPAL_SOS-encoded error code.
|
||||
*/
|
||||
static inline int ompi_errcode_get_mpi_code(int errcode)
|
||||
{
|
||||
int __ret = MPI_ERR_UNKNOWN;
|
||||
int __i;
|
||||
ompi_errcode_intern_t *__errc;
|
||||
int ret = MPI_ERR_UNKNOWN;
|
||||
int i;
|
||||
ompi_errcode_intern_t *errc;
|
||||
|
||||
/* Transmorgify, if necessary */
|
||||
errcode = OPAL_SOS_GET_ERROR_CODE(errcode);
|
||||
|
||||
/* If the errcode is >= 0, then it's already an MPI error code, so
|
||||
just return it. */
|
||||
@ -64,14 +70,14 @@ static inline int ompi_errcode_get_mpi_code(int errcode)
|
||||
|
||||
/* Otherwise, it's an internal OMPI code and we need to translate
|
||||
it */
|
||||
for ( __i=0; __i<ompi_errcode_intern_lastused; __i++) {
|
||||
__errc = (ompi_errcode_intern_t *)opal_pointer_array_get_item(&ompi_errcodes_intern, __i);
|
||||
if ( __errc->code == errcode ) {
|
||||
__ret = __errc->mpi_code;
|
||||
for (i = 0; i < ompi_errcode_intern_lastused; i++) {
|
||||
errc = (ompi_errcode_intern_t *)opal_pointer_array_get_item(&ompi_errcodes_intern, i);
|
||||
if (errc->code == errcode) {
|
||||
ret = errc->mpi_code;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return __ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,7 +10,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -26,9 +26,11 @@
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "mpi.h"
|
||||
|
||||
#include "opal/prefetch.h"
|
||||
#include "opal/class/opal_object.h"
|
||||
#include "opal/class/opal_pointer_array.h"
|
||||
|
||||
#include "ompi/runtime/mpiruntime.h"
|
||||
#include "ompi/errhandler/errhandler_predefined.h"
|
||||
#include "ompi/errhandler/errcode-internal.h"
|
||||
@ -208,7 +210,7 @@ struct ompi_request_t;
|
||||
ompi_errhandler_invoke((mpi_object)->error_handler, \
|
||||
(mpi_object), \
|
||||
(int)(mpi_object)->errhandler_type, \
|
||||
(err_code < 0 ? (ompi_errcode_get_mpi_code(err_code)) : err_code), \
|
||||
ompi_errcode_get_mpi_code(err_code), \
|
||||
(message));
|
||||
|
||||
/**
|
||||
@ -226,7 +228,7 @@ struct ompi_request_t;
|
||||
*/
|
||||
#define OMPI_ERRHANDLER_CHECK(rc, mpi_object, err_code, message) \
|
||||
if( OPAL_UNLIKELY(rc != OMPI_SUCCESS) ) { \
|
||||
int __mpi_err_code = (err_code < 0 ? (ompi_errcode_get_mpi_code(err_code)) : err_code); \
|
||||
int __mpi_err_code = ompi_errcode_get_mpi_code(err_code); \
|
||||
OPAL_CR_EXIT_LIBRARY() \
|
||||
ompi_errhandler_invoke((mpi_object)->error_handler, \
|
||||
(mpi_object), \
|
||||
@ -254,7 +256,7 @@ struct ompi_request_t;
|
||||
#define OMPI_ERRHANDLER_RETURN(rc, mpi_object, err_code, message) \
|
||||
OPAL_CR_EXIT_LIBRARY() \
|
||||
if ( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) { \
|
||||
int __mpi_err_code = (err_code < 0 ? (ompi_errcode_get_mpi_code(err_code)) : err_code); \
|
||||
int __mpi_err_code = ompi_errcode_get_mpi_code(err_code); \
|
||||
ompi_errhandler_invoke((mpi_object)->error_handler, \
|
||||
(mpi_object), \
|
||||
(int)(mpi_object)->errhandler_type, \
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user