2004-06-18 02:40:16 +04:00
|
|
|
/*
|
2004-11-22 04:38:40 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-06-18 02:40:16 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/** @file **/
|
|
|
|
|
|
|
|
#ifndef OMPI_MPI_ERRCODE_H
|
|
|
|
#define OMPI_MPI_ERRCODE_H
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include "mpi.h"
|
2005-07-03 20:06:07 +04:00
|
|
|
#include "opal/class/opal_object.h"
|
2004-06-18 02:40:16 +04:00
|
|
|
#include "class/ompi_pointer_array.h"
|
|
|
|
|
2004-10-21 02:31:03 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2004-06-18 02:40:16 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Back-end type for MPI error codes
|
|
|
|
*/
|
|
|
|
struct ompi_mpi_errcode_t {
|
2005-07-03 20:06:07 +04:00
|
|
|
opal_object_t super;
|
2004-06-18 02:40:16 +04:00
|
|
|
int code;
|
2004-10-18 20:55:20 +04:00
|
|
|
int cls;
|
2004-06-18 02:40:16 +04:00
|
|
|
char errstring[MPI_MAX_ERROR_STRING];
|
|
|
|
};
|
|
|
|
typedef struct ompi_mpi_errcode_t ompi_mpi_errcode_t;
|
|
|
|
|
2004-10-22 20:06:05 +04:00
|
|
|
OMPI_DECLSPEC extern ompi_pointer_array_t ompi_mpi_errcodes;
|
|
|
|
OMPI_DECLSPEC extern int ompi_mpi_errcode_lastused;
|
2004-06-18 02:40:16 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check for a valid error code
|
|
|
|
*/
|
|
|
|
static inline bool ompi_mpi_errcode_is_invalid(int errcode)
|
|
|
|
{
|
|
|
|
if ( errcode >= 0 && errcode < ompi_mpi_errcode_lastused )
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the error class
|
|
|
|
*/
|
|
|
|
static inline int ompi_mpi_errcode_get_class (int errcode)
|
|
|
|
{
|
|
|
|
ompi_mpi_errcode_t *err;
|
|
|
|
|
2004-10-18 20:55:20 +04:00
|
|
|
err = (ompi_mpi_errcode_t *)ompi_pointer_array_get_item(&ompi_mpi_errcodes, errcode);
|
|
|
|
return err->cls;
|
2004-06-18 02:40:16 +04:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Return the error string
|
|
|
|
*/
|
|
|
|
static inline char* ompi_mpi_errcode_get_string (int errcode)
|
|
|
|
{
|
|
|
|
ompi_mpi_errcode_t *err;
|
|
|
|
|
2004-10-18 20:55:20 +04:00
|
|
|
err = (ompi_mpi_errcode_t *)ompi_pointer_array_get_item(&ompi_mpi_errcodes, errcode);
|
2004-06-18 02:40:16 +04:00
|
|
|
return err->errstring;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the error codes
|
|
|
|
*
|
|
|
|
* @returns OMPI_SUCCESS Upon success
|
|
|
|
* @returns OMPI_ERROR Otherwise
|
|
|
|
*
|
|
|
|
* Invoked from ompi_mpi_init(); sets up all static MPI error codes,
|
|
|
|
*/
|
|
|
|
int ompi_mpi_errcode_init(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Finalize the error codes.
|
|
|
|
*
|
|
|
|
* @returns OMPI_SUCCESS Always
|
|
|
|
*
|
|
|
|
* Invokes from ompi_mpi_finalize(); tears down the error code array.
|
|
|
|
*/
|
|
|
|
int ompi_mpi_errcode_finalize(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an error code
|
|
|
|
*
|
|
|
|
* @param: error class to which this new error code belongs to
|
|
|
|
*
|
|
|
|
* @returns the new error code on SUCCESS (>0)
|
|
|
|
* @returns OMPI_ERROR otherwise
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
int ompi_mpi_errcode_add (int errclass);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an error string to an error code
|
|
|
|
*
|
|
|
|
* @param: error code for which the string is defined
|
|
|
|
* @param: error string to add
|
|
|
|
* @param: length of the string
|
|
|
|
*
|
|
|
|
* @returns OMPI_SUCCESS on success
|
|
|
|
* @returns OMPI_ERROR on error
|
|
|
|
*/
|
|
|
|
int ompi_mpi_errcode_add_string (int errcode, char* string, int len);
|
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* OMPI_MPI_ERRCODE_H */
|