Blame src/mpi/pt2pt/greq_complete.c

Packit 0848f5
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit 0848f5
/*
Packit 0848f5
 *  (C) 2001 by Argonne National Laboratory.
Packit 0848f5
 *      See COPYRIGHT in top-level directory.
Packit 0848f5
 */
Packit 0848f5
Packit 0848f5
#include "mpiimpl.h"
Packit 0848f5
Packit 0848f5
/* -- Begin Profiling Symbol Block for routine MPI_Grequest_complete */
Packit 0848f5
#if defined(HAVE_PRAGMA_WEAK)
Packit 0848f5
#pragma weak MPI_Grequest_complete = PMPI_Grequest_complete
Packit 0848f5
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
Packit 0848f5
#pragma _HP_SECONDARY_DEF PMPI_Grequest_complete  MPI_Grequest_complete
Packit 0848f5
#elif defined(HAVE_PRAGMA_CRI_DUP)
Packit 0848f5
#pragma _CRI duplicate MPI_Grequest_complete as PMPI_Grequest_complete
Packit 0848f5
#elif defined(HAVE_WEAK_ATTRIBUTE)
Packit 0848f5
int MPI_Grequest_complete(MPI_Request request) __attribute__((weak,alias("PMPI_Grequest_complete")));
Packit 0848f5
#endif
Packit 0848f5
/* -- End Profiling Symbol Block */
Packit 0848f5
Packit 0848f5
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
Packit 0848f5
   the MPI routines.  You can use USE_WEAK_SYMBOLS to see if MPICH is
Packit 0848f5
   using weak symbols to implement the MPI routines. */
Packit 0848f5
#ifndef MPICH_MPI_FROM_PMPI
Packit 0848f5
#undef MPI_Grequest_complete
Packit 0848f5
#define MPI_Grequest_complete PMPI_Grequest_complete
Packit 0848f5
Packit 0848f5
/* Any internal routines can go here.  Make them static if possible.  If they
Packit 0848f5
   are used by both the MPI and PMPI versions, use PMPI_LOCAL instead of 
Packit 0848f5
   static; this macro expands into "static" if weak symbols are supported and
Packit 0848f5
   into nothing otherwise. */
Packit 0848f5
#undef FUNCNAME
Packit 0848f5
#define FUNCNAME MPIR_Grequest_complete
Packit 0848f5
#undef FCNAME
Packit 0848f5
#define FCNAME MPL_QUOTE(FUNCNAME)
Packit 0848f5
void MPIR_Grequest_complete_impl(MPID_Request *request_ptr)
Packit 0848f5
{
Packit 0848f5
    /* Set the request as completed.  This does not change the
Packit 0848f5
       reference count on the generalized request */
Packit 0848f5
    MPID_Request_complete( request_ptr );
Packit 0848f5
Packit 0848f5
    /* The request release comes with the wait/test, not this complete
Packit 0848f5
       routine, so we don't call the MPID_Request_release routine */
Packit 0848f5
}
Packit 0848f5
Packit 0848f5
#endif
Packit 0848f5
Packit 0848f5
#undef FUNCNAME
Packit 0848f5
#define FUNCNAME MPI_Grequest_complete
Packit 0848f5
#undef FCNAME
Packit 0848f5
#define FCNAME MPL_QUOTE(FUNCNAME)
Packit 0848f5
/*@
Packit 0848f5
   MPI_Grequest_complete - Notify MPI that a user-defined request is complete
Packit 0848f5
Packit 0848f5
Input Parameters:
Packit 0848f5
.  request - Generalized request to mark as complete
Packit 0848f5
Packit 0848f5
.N ThreadSafe
Packit 0848f5
Packit 0848f5
.N Fortran
Packit 0848f5
Packit 0848f5
.N Errors
Packit 0848f5
.N MPI_SUCCESS
Packit 0848f5
Packit 0848f5
.seealso: MPI_Grequest_start
Packit 0848f5
@*/
Packit 0848f5
int MPI_Grequest_complete( MPI_Request request )
Packit 0848f5
{
Packit 0848f5
    int mpi_errno = MPI_SUCCESS;
Packit 0848f5
    MPID_Request *request_ptr;
Packit 0848f5
    MPID_MPI_STATE_DECL(MPID_STATE_MPI_GREQUEST_COMPLETE);
Packit 0848f5
Packit 0848f5
    MPIR_ERRTEST_INITIALIZED_ORDIE();
Packit 0848f5
    
Packit 0848f5
    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
Packit 0848f5
    MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GREQUEST_COMPLETE);
Packit 0848f5
    
Packit 0848f5
    /* Validate handle parameters needing to be converted */
Packit 0848f5
#   ifdef HAVE_ERROR_CHECKING
Packit 0848f5
    {
Packit 0848f5
        MPID_BEGIN_ERROR_CHECKS;
Packit 0848f5
        {
Packit 0848f5
	    MPIR_ERRTEST_REQUEST(request, mpi_errno);
Packit 0848f5
        }
Packit 0848f5
        MPID_END_ERROR_CHECKS;
Packit 0848f5
    }
Packit 0848f5
#   endif /* HAVE_ERROR_CHECKING */
Packit 0848f5
Packit 0848f5
    /* Convert MPI object handles to object pointers */
Packit 0848f5
    MPID_Request_get_ptr( request, request_ptr );
Packit 0848f5
Packit 0848f5
    /* Validate parameters if error checking is enabled */
Packit 0848f5
#   ifdef HAVE_ERROR_CHECKING
Packit 0848f5
    {
Packit 0848f5
        MPID_BEGIN_ERROR_CHECKS;
Packit 0848f5
        {
Packit 0848f5
	    MPID_Request_valid_ptr(request_ptr,mpi_errno);
Packit 0848f5
	    if (request_ptr && request_ptr->kind != MPID_UREQUEST) {
Packit 0848f5
 	        mpi_errno = MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_ARG, 
Packit 0848f5
						  "**notgenreq", 0 );
Packit 0848f5
	    }
Packit 0848f5
            if (mpi_errno) goto fn_fail;
Packit 0848f5
        }
Packit 0848f5
        MPID_END_ERROR_CHECKS;
Packit 0848f5
    }
Packit 0848f5
#   endif /* HAVE_ERROR_CHECKING */
Packit 0848f5
Packit 0848f5
    /* ... body of routine ...  */
Packit 0848f5
    
Packit 0848f5
    MPIR_Grequest_complete_impl(request_ptr);
Packit 0848f5
    
Packit 0848f5
    /* ... end of body of routine ... */
Packit 0848f5
Packit 0848f5
#ifdef HAVE_ERROR_CHECKING
Packit 0848f5
  fn_exit:
Packit 0848f5
#endif
Packit 0848f5
    MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GREQUEST_COMPLETE);
Packit 0848f5
    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
Packit 0848f5
    return mpi_errno;
Packit 0848f5
    
Packit 0848f5
    /* --BEGIN ERROR HANDLING-- */
Packit 0848f5
#   ifdef HAVE_ERROR_CHECKING
Packit 0848f5
  fn_fail:
Packit 0848f5
    {
Packit 0848f5
	mpi_errno = MPIR_Err_create_code(
Packit 0848f5
	    mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, 
Packit 0848f5
	    "**mpi_grequest_complete",
Packit 0848f5
	    "**mpi_grequest_complete %R", request);
Packit 0848f5
    }
Packit 0848f5
    mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno );
Packit 0848f5
    goto fn_exit;
Packit 0848f5
#   endif
Packit 0848f5
    /* --END ERROR HANDLING-- */
Packit 0848f5
}