2004-03-19 09:12:43 +03: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-03-19 09:12:43 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-03-19 09:12:43 +03:00
|
|
|
|
|
|
|
#include "communicator/communicator.h"
|
|
|
|
#include "win/win.h"
|
|
|
|
#include "file/file.h"
|
|
|
|
#include "errhandler/errhandler.h"
|
2005-03-25 23:25:28 +03:00
|
|
|
#include "mpi/f77/fint_2_int.h"
|
2004-03-19 09:12:43 +03:00
|
|
|
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
|
2004-09-06 16:06:27 +04:00
|
|
|
int object_type, int err_code, const char *message)
|
2004-03-19 09:12:43 +03:00
|
|
|
{
|
2005-03-25 23:25:28 +03:00
|
|
|
MPI_Fint fortran_handle, fortran_err_code = OMPI_INT_2_FINT(err_code);
|
2004-09-06 16:06:27 +04:00
|
|
|
ompi_communicator_t *comm;
|
2004-12-14 05:35:03 +03:00
|
|
|
#if OMPI_WANT_MPI2_ONE_SIDED
|
2004-09-06 16:06:27 +04:00
|
|
|
ompi_win_t *win;
|
2004-12-14 05:35:03 +03:00
|
|
|
#endif
|
2004-09-06 16:06:27 +04:00
|
|
|
ompi_file_t *file;
|
|
|
|
|
|
|
|
/* If we got no errorhandler, then just invoke errors_abort */
|
|
|
|
if (NULL == errhandler) {
|
|
|
|
ompi_mpi_errors_are_fatal_comm_handler(NULL, NULL, message);
|
2004-03-19 09:12:43 +03:00
|
|
|
}
|
2004-09-06 16:06:27 +04:00
|
|
|
|
|
|
|
/* Figure out what kind of errhandler it is, figure out if it's
|
|
|
|
fortran or C, and then invoke it */
|
|
|
|
|
|
|
|
switch (object_type) {
|
|
|
|
case OMPI_ERRHANDLER_TYPE_COMM:
|
|
|
|
comm = (ompi_communicator_t *) mpi_object;
|
|
|
|
if (errhandler->eh_fortran_function) {
|
2005-03-25 23:25:28 +03:00
|
|
|
fortran_handle = OMPI_INT_2_FINT(comm->c_f_to_c_index);
|
|
|
|
errhandler->eh_fort_fn(&fortran_handle, &fortran_err_code);
|
2004-09-06 16:06:27 +04:00
|
|
|
} else {
|
|
|
|
errhandler->eh_comm_fn(&comm, &err_code, message, NULL);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-12-14 05:35:03 +03:00
|
|
|
#if OMPI_WANT_MPI2_ONE_SIDED
|
2004-09-06 16:06:27 +04:00
|
|
|
case OMPI_ERRHANDLER_TYPE_WIN:
|
|
|
|
win = (ompi_win_t *) mpi_object;
|
|
|
|
if (errhandler->eh_fortran_function) {
|
2005-03-25 23:25:28 +03:00
|
|
|
fortran_handle = OMPI_INT_2_FINT(win->w_f_to_c_index);
|
|
|
|
errhandler->eh_fort_fn(&fortran_handle, &fortran_err_code);
|
2004-09-06 16:06:27 +04:00
|
|
|
} else {
|
|
|
|
errhandler->eh_win_fn(&win, &err_code, message, NULL);
|
|
|
|
}
|
|
|
|
break;
|
2004-12-14 05:35:03 +03:00
|
|
|
#endif
|
2004-09-06 16:06:27 +04:00
|
|
|
|
|
|
|
case OMPI_ERRHANDLER_TYPE_FILE:
|
|
|
|
file = (ompi_file_t *) mpi_object;
|
|
|
|
if (errhandler->eh_fortran_function) {
|
2005-03-25 23:25:28 +03:00
|
|
|
fortran_handle = OMPI_INT_2_FINT(file->f_f_to_c_index);
|
|
|
|
errhandler->eh_fort_fn(&fortran_handle, &fortran_err_code);
|
2004-09-06 16:06:27 +04:00
|
|
|
} else {
|
|
|
|
errhandler->eh_file_fn(&file, &err_code, message, NULL);
|
|
|
|
}
|
|
|
|
break;
|
2004-03-19 09:12:43 +03:00
|
|
|
}
|
2004-09-06 16:06:27 +04:00
|
|
|
|
|
|
|
/* All done */
|
|
|
|
return err_code;
|
2004-03-19 09:12:43 +03:00
|
|
|
}
|