|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* (C) 2001 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpiimpl.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* -- Begin Profiling Symbol Block for routine MPI_Win_call_errhandler */
|
|
Packit Service |
c5cf8c |
#if defined(HAVE_PRAGMA_WEAK)
|
|
Packit Service |
c5cf8c |
#pragma weak MPI_Win_call_errhandler = PMPI_Win_call_errhandler
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
|
|
Packit Service |
c5cf8c |
#pragma _HP_SECONDARY_DEF PMPI_Win_call_errhandler MPI_Win_call_errhandler
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_PRAGMA_CRI_DUP)
|
|
Packit Service |
c5cf8c |
#pragma _CRI duplicate MPI_Win_call_errhandler as PMPI_Win_call_errhandler
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_WEAK_ATTRIBUTE)
|
|
Packit Service |
c5cf8c |
int MPI_Win_call_errhandler(MPI_Win win, int errorcode)
|
|
Packit Service |
c5cf8c |
__attribute__ ((weak, alias("PMPI_Win_call_errhandler")));
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
/* -- End Profiling Symbol Block */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
|
|
Packit Service |
c5cf8c |
the MPI routines */
|
|
Packit Service |
c5cf8c |
#ifndef MPICH_MPI_FROM_PMPI
|
|
Packit Service |
c5cf8c |
#undef MPI_Win_call_errhandler
|
|
Packit Service |
c5cf8c |
#define MPI_Win_call_errhandler PMPI_Win_call_errhandler
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#undef FUNCNAME
|
|
Packit Service |
c5cf8c |
#define FUNCNAME MPI_Win_call_errhandler
|
|
Packit Service |
c5cf8c |
#undef FCNAME
|
|
Packit Service |
c5cf8c |
#define FCNAME "MPI_Win_call_errhander"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/*@
|
|
Packit Service |
c5cf8c |
MPI_Win_call_errhandler - Call the error handler installed on a
|
|
Packit Service |
c5cf8c |
window object
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Input Parameters:
|
|
Packit Service |
c5cf8c |
+ win - window with error handler (handle)
|
|
Packit Service |
c5cf8c |
- errorcode - error code (integer)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Note:
|
|
Packit Service |
c5cf8c |
Assuming the input parameters are valid, when the error handler is set to
|
|
Packit Service |
c5cf8c |
MPI_ERRORS_RETURN, this routine will always return MPI_SUCCESS.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
.N ThreadSafeNoUpdate
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
.N Fortran
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
.N Errors
|
|
Packit Service |
c5cf8c |
.N MPI_SUCCESS
|
|
Packit Service |
c5cf8c |
.N MPI_ERR_WIN
|
|
Packit Service |
c5cf8c |
@*/
|
|
Packit Service |
c5cf8c |
int MPI_Win_call_errhandler(MPI_Win win, int errorcode)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int mpi_errno = MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
MPIR_Win *win_ptr = NULL;
|
|
Packit Service |
c5cf8c |
int in_cs = FALSE;
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_STATE_DECL(MPID_STATE_MPI_WIN_CALL_ERRHANDLER);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_INITIALIZED_ORDIE();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_ENTER(MPID_STATE_MPI_WIN_CALL_ERRHANDLER);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Validate parameters, especially handles needing to be converted */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPID_BEGIN_ERROR_CHECKS;
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_WIN(win, mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
MPID_END_ERROR_CHECKS;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Convert MPI object handles to object pointers */
|
|
Packit Service |
c5cf8c |
MPIR_Win_get_ptr(win, win_ptr);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Validate parameters and objects (post conversion) */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPID_BEGIN_ERROR_CHECKS;
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
/* Validate win_ptr */
|
|
Packit Service |
c5cf8c |
MPIR_Win_valid_ptr(win_ptr, mpi_errno);
|
|
Packit Service |
c5cf8c |
/* If win_ptr is not valid, it will be reset to null */
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
MPID_END_ERROR_CHECKS;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#endif /* HAVE_ERROR_CHECKING */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* ... body of routine ... */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_POBJ_WIN_MUTEX(win_ptr));
|
|
Packit Service |
c5cf8c |
in_cs = TRUE;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (!win_ptr->errhandler || win_ptr->errhandler->handle == MPI_ERRORS_ARE_FATAL) {
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Err_return_win(win_ptr, "MPI_Win_call_errhandler", errorcode);
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (win_ptr->errhandler->handle == MPI_ERRORS_RETURN) {
|
|
Packit Service |
c5cf8c |
/* MPI_ERRORS_RETURN should always return MPI_SUCCESS */
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Check for the special case of errors-throw-exception. In this case
|
|
Packit Service |
c5cf8c |
* return the error code; the C++ wrapper will cause an exception to
|
|
Packit Service |
c5cf8c |
* be thrown.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_CXX_BINDING
|
|
Packit Service |
c5cf8c |
if (win_ptr->errhandler->handle == MPIR_ERRORS_THROW_EXCEPTIONS) {
|
|
Packit Service |
c5cf8c |
mpi_errno = errorcode;
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
switch (win_ptr->errhandler->language) {
|
|
Packit Service |
c5cf8c |
case MPIR_LANG__C:
|
|
Packit Service |
c5cf8c |
(*win_ptr->errhandler->errfn.C_Win_Handler_function) (&win_ptr->handle, &errorcode);
|
|
Packit Service |
c5cf8c |
break;
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_CXX_BINDING
|
|
Packit Service |
c5cf8c |
case MPIR_LANG__CXX:
|
|
Packit Service |
c5cf8c |
MPIR_Process.cxx_call_errfn(2, &win_ptr->handle,
|
|
Packit Service |
c5cf8c |
&errorcode,
|
|
Packit Service |
c5cf8c |
(void (*)(void)) win_ptr->errhandler->
|
|
Packit Service |
c5cf8c |
errfn.C_Win_Handler_function);
|
|
Packit Service |
c5cf8c |
break;
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_FORTRAN_BINDING
|
|
Packit Service |
c5cf8c |
case MPIR_LANG__FORTRAN90:
|
|
Packit Service |
c5cf8c |
case MPIR_LANG__FORTRAN:
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
/* If int and MPI_Fint aren't the same size, we need to
|
|
Packit Service |
c5cf8c |
* convert. As this is not performance critical, we
|
|
Packit Service |
c5cf8c |
* do this even if MPI_Fint and int are the same size. */
|
|
Packit Service |
c5cf8c |
MPI_Fint ferr = errorcode;
|
|
Packit Service |
c5cf8c |
MPI_Fint winhandle = win_ptr->handle;
|
|
Packit Service |
c5cf8c |
(*win_ptr->errhandler->errfn.F77_Handler_function) (&winhandle, &ferr);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
break;
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* ... end of body of routine ... */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_exit:
|
|
Packit Service |
c5cf8c |
if (in_cs)
|
|
Packit Service |
c5cf8c |
MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_POBJ_WIN_MUTEX(win_ptr));
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_EXIT(MPID_STATE_MPI_WIN_CALL_ERRHANDLER);
|
|
Packit Service |
c5cf8c |
return mpi_errno;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* --BEGIN ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
fn_fail:
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
mpi_errno =
|
|
Packit Service |
c5cf8c |
MPIR_Err_create_code(mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
|
|
Packit Service |
c5cf8c |
"**mpi_win_call_errhandler", "**mpi_win_call_errhandler %W %d",
|
|
Packit Service |
c5cf8c |
win, errorcode);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Err_return_win(win_ptr, FCNAME, mpi_errno);
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
/* --END ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
}
|