First cut of the errhandler stuff (invocation of errorhandlers, to be
invoked by top-level MPI functions). See doxygen comments for explanations of which macros to use. This commit was SVN r926.
Этот коммит содержится в:
родитель
251f68b94f
Коммит
b195c85f60
@ -42,6 +42,7 @@ libmpi_la_LIBADD = \
|
||||
communicator/libcommunicator.la \
|
||||
ctnetwork/libctnetwork.la \
|
||||
datatype/libdatatype.la \
|
||||
errhandler/liberrhandler.la \
|
||||
event/libevent.la \
|
||||
group/libgroup.la \
|
||||
info/libinfo.la \
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define LAM_COMMUNICATOR_H
|
||||
|
||||
#include "lfc/lam_object.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "threads/mutex.h"
|
||||
#include "util/output.h"
|
||||
#include "mpi.h"
|
||||
@ -40,9 +41,13 @@ struct lam_communicator_t {
|
||||
int *c_topo_index; /**< Graph indices */
|
||||
int *c_topo_edges; /**< Graph edges */
|
||||
|
||||
/* index in Fortran <-> C translation array */
|
||||
|
||||
int c_f_to_c_index;
|
||||
|
||||
/* Error handling */
|
||||
|
||||
MPI_Errhandler c_error_handler;
|
||||
lam_errhandler_t *c_error_handler;
|
||||
|
||||
/* Hooks for PML to hang things */
|
||||
struct mca_pml_comm_t* c_pml_comm;
|
||||
|
@ -5,11 +5,17 @@
|
||||
|
||||
include $(top_srcdir)/config/Makefile.options
|
||||
|
||||
noinst_LTLIBRARIES = liberrhandler.la
|
||||
|
||||
# Source code files
|
||||
|
||||
headers = \
|
||||
errhandler.h
|
||||
|
||||
liberrhandler_la_SOURCES = \
|
||||
$(headers) \
|
||||
errhandler_invoke.c
|
||||
|
||||
# Conditionally install the header files
|
||||
|
||||
if WANT_INSTALL_HEADERS
|
||||
|
@ -7,10 +7,117 @@
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "lfc/lam_object.h"
|
||||
|
||||
typedef void (fortran_handler_fn_t)(int *, int *, ...);
|
||||
|
||||
|
||||
struct lam_errhandler_t {
|
||||
/* JMS Put stuff here */
|
||||
lam_object_t super;
|
||||
|
||||
char eh_name[MPI_MAX_OBJECT_NAME];
|
||||
|
||||
bool eh_fortran_function;
|
||||
enum {
|
||||
LAM_ERRHANDLER_COMM,
|
||||
LAM_ERRHANDLER_WIN,
|
||||
LAM_ERRHANDLER_FILE
|
||||
} eh_mpi_object_type;
|
||||
|
||||
union {
|
||||
MPI_Comm_errhandler_fn *c_comm_fn;
|
||||
MPI_File_errhandler_fn *c_file_fn;
|
||||
MPI_Win_errhandler_fn *c_win_fn;
|
||||
|
||||
fortran_handler_fn_t *fort_fn;
|
||||
} eh_func;
|
||||
};
|
||||
typedef struct lam_errhandler_t lam_errhandler_t;
|
||||
|
||||
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* This function should not be invoked directly; it should only be
|
||||
* invoked by LAM_ERRHDL_INVOKE(), LAM_ERRHDL_CHECK(), or
|
||||
* LAM_ERRHDL_RETURN().
|
||||
*
|
||||
* @param errhandler The MPI_Errhandler to invoke
|
||||
* @param mpi_object The MPI object to invoke the errhandler on (a
|
||||
* comm, win, or win)
|
||||
* @param err_code The error code
|
||||
* @param message Any additional message; typically the name of the
|
||||
* MPI function that is invoking the error.
|
||||
*
|
||||
* This function invokes the MPI exception function on the error
|
||||
* handler. If the errhandler was created from fortran, the error
|
||||
* handler will be invoked with fortran linkage. Otherwise, it is
|
||||
* invoked with C linkage.
|
||||
*/
|
||||
int lam_errhandler_invoke(lam_errhandler_t *errhandler, void *mpi_object,
|
||||
int err_code, char *message);
|
||||
|
||||
/**
|
||||
* This is the macro to invoke to directly invoke an MPI error
|
||||
* handler.
|
||||
*
|
||||
* @param errhandler The MPI_Errhandler to invoke
|
||||
* @param mpi_object The MPI object to invoke the errhandler on (a
|
||||
* comm, win, or win)
|
||||
* @param err_code The error code
|
||||
* @param message Any additional message; typically the name of the
|
||||
* MPI function that is invoking the error.
|
||||
*
|
||||
* This macro is used when you want to directly invoke the error
|
||||
* handler. It is exactly equivalent to calling
|
||||
* lam_errhandler_invoke() directly, but is provided to have a
|
||||
* parallel invocation to LAM_ERRHDL_CHECK() and LAM_ERRHDL_RETURN().
|
||||
*/
|
||||
#define LAM_ERRHDL_INVOKE(errhandler, mpi_object, err_code, message) \
|
||||
lam_errhandler_invoke((errhandler), (mpi_object), (err_code), (message);
|
||||
|
||||
/**
|
||||
* Conditionally invoke an MPI error handler.
|
||||
*
|
||||
* @param rc The return code to check
|
||||
* @param errhandler The MPI_Errhandler to invoke
|
||||
* @param mpi_object The MPI object to invoke the errhandler on (a
|
||||
* comm, win, or win)
|
||||
* @param err_code The error code
|
||||
* @param message Any additional message; typically the name of the
|
||||
* MPI function that is invoking the error.
|
||||
*
|
||||
* This macro will invoke the error handler if the return code is not
|
||||
* LAM_SUCCESS.
|
||||
*/
|
||||
#define LAM_ERRHDL_CHECK(rc, errhandler, mpi_object, err_code, message) \
|
||||
if (rc != LAM_SUCCESS) { \
|
||||
lam_errhandler_invoke((errhandler), (mpi_object), (err_code), (message)); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditionally invoke an MPI error handler; if there is no error,
|
||||
* return MPI_SUCCESS.
|
||||
*
|
||||
* @param rc The return code to check
|
||||
* @param errhandler The MPI_Errhandler to invoke
|
||||
* @param mpi_object The MPI object to invoke the errhandler on (a
|
||||
* comm, win, or win)
|
||||
* @param err_code The error code
|
||||
* @param message Any additional message; typically the name of the
|
||||
* MPI function that is invoking the error.
|
||||
*
|
||||
* This macro will invoke the error handler if the return code is not
|
||||
* LAM_SUCCESS. If the return code is LAM_SUCCESS, then return
|
||||
* MPI_SUCCESS.
|
||||
*/
|
||||
#define LAM_ERRHDL_RETURN(rc, errhandler, mpi_object, err_code, message) \
|
||||
if (rc != LAM_SUCCESS) { \
|
||||
lam_errhandler_invoke((errhandler), (mpi_object), (err_code), (message)); \
|
||||
} else { \
|
||||
return MPI_SUCCESS; \
|
||||
}
|
||||
|
||||
|
||||
#endif /* LAM_ERRHANDLER_H */
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define LAM_FILE_H
|
||||
|
||||
#include "mpi.h"
|
||||
#include "errhandler/errhandler.h"
|
||||
#include "mca/io/io.h"
|
||||
|
||||
typedef enum {
|
||||
@ -15,15 +16,22 @@ typedef enum {
|
||||
|
||||
|
||||
struct lam_file_t {
|
||||
char f_name[MPI_MAX_OBJECT_NAME];
|
||||
lam_io_version_t lam_io_version;
|
||||
char f_name[MPI_MAX_OBJECT_NAME];
|
||||
lam_io_version_t lam_io_version;
|
||||
|
||||
/* Hooks for io modules to hang things */
|
||||
union {
|
||||
mca_io_1_0_0_t f_io;
|
||||
} mca_io_functions;
|
||||
/* Hooks for io modules to hang things */
|
||||
|
||||
union {
|
||||
mca_io_1_0_0_t f_io;
|
||||
} mca_io_functions;
|
||||
|
||||
/* index in Fortran <-> C translation array */
|
||||
|
||||
int f_f_to_c_index;
|
||||
|
||||
/* Error handling */
|
||||
|
||||
lam_errhandler_t *f_errhandler;
|
||||
};
|
||||
typedef struct lam_file_t lam_file_t;
|
||||
|
||||
|
@ -12,12 +12,21 @@
|
||||
|
||||
extern lam_class_t lam_win_t_class;
|
||||
struct lam_win_t {
|
||||
char w_name[MPI_MAX_OBJECT_NAME];
|
||||
|
||||
lam_object_t w_base;
|
||||
|
||||
/* Attributes */
|
||||
|
||||
lam_hash_table_t *keyhash;
|
||||
|
||||
/* Other stuffs */
|
||||
/* index in Fortran <-> C translation array */
|
||||
|
||||
int w_f_to_c_index;
|
||||
|
||||
/* Error handling */
|
||||
|
||||
lam_errhandler_t *w_errhandler;
|
||||
};
|
||||
|
||||
typedef struct lam_win_t lam_win_t;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user