|
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_Rget_accumulate */
|
|
Packit Service |
c5cf8c |
#if defined(HAVE_PRAGMA_WEAK)
|
|
Packit Service |
c5cf8c |
#pragma weak MPI_Rget_accumulate = PMPI_Rget_accumulate
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
|
|
Packit Service |
c5cf8c |
#pragma _HP_SECONDARY_DEF PMPI_Rget_accumulate MPI_Rget_accumulate
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_PRAGMA_CRI_DUP)
|
|
Packit Service |
c5cf8c |
#pragma _CRI duplicate MPI_Rget_accumulate as PMPI_Rget_accumulate
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_WEAK_ATTRIBUTE)
|
|
Packit Service |
c5cf8c |
int MPI_Rget_accumulate(const void *origin_addr, int origin_count,
|
|
Packit Service |
c5cf8c |
MPI_Datatype origin_datatype, void *result_addr, int result_count,
|
|
Packit Service |
c5cf8c |
MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp,
|
|
Packit Service |
c5cf8c |
int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win,
|
|
Packit Service |
c5cf8c |
MPI_Request * request)
|
|
Packit Service |
c5cf8c |
__attribute__ ((weak, alias("PMPI_Rget_accumulate")));
|
|
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_Rget_accumulate
|
|
Packit Service |
c5cf8c |
#define MPI_Rget_accumulate PMPI_Rget_accumulate
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#undef FUNCNAME
|
|
Packit Service |
c5cf8c |
#define FUNCNAME MPI_Rget_accumulate
|
|
Packit Service |
c5cf8c |
#undef FCNAME
|
|
Packit Service |
c5cf8c |
#define FCNAME MPL_QUOTE(FUNCNAME)
|
|
Packit Service |
c5cf8c |
/*@
|
|
Packit Service |
c5cf8c |
MPI_Rget_accumulate - Perform an atomic, one-sided read-and-accumulate
|
|
Packit Service |
c5cf8c |
operation and return a request handle for the operation.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
'MPI_Rget_accumulate' is similar to 'MPI_Get_accumulate', except that it allocates
|
|
Packit Service |
c5cf8c |
a communication request object and associates it with the request handle (the
|
|
Packit Service |
c5cf8c |
argument request) that can be used to wait or test for completion. The
|
|
Packit Service |
c5cf8c |
completion of an 'MPI_Rget_accumulate' operation indicates that the data is
|
|
Packit Service |
c5cf8c |
available in the result buffer and the origin buffer is free to be updated. It
|
|
Packit Service |
c5cf8c |
does not indicate that the operation has been completed at the target window.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Input Parameters:
|
|
Packit Service |
c5cf8c |
+ origin_addr - initial address of buffer (choice)
|
|
Packit Service |
c5cf8c |
. origin_count - number of entries in buffer (nonnegative integer)
|
|
Packit Service |
c5cf8c |
. origin_datatype - datatype of each buffer entry (handle)
|
|
Packit Service |
c5cf8c |
. result_addr - initial address of result buffer (choice)
|
|
Packit Service |
c5cf8c |
. result_count - number of entries in result buffer (non-negative integer)
|
|
Packit Service |
c5cf8c |
. result_datatype - datatype of each entry in result buffer (handle)
|
|
Packit Service |
c5cf8c |
. target_rank - rank of target (nonnegative integer)
|
|
Packit Service |
c5cf8c |
. target_disp - displacement from start of window to beginning of target
|
|
Packit Service |
c5cf8c |
buffer (nonnegative integer)
|
|
Packit Service |
c5cf8c |
. target_count - number of entries in target buffer (nonnegative integer)
|
|
Packit Service |
c5cf8c |
. target_datatype - datatype of each entry in target buffer (handle)
|
|
Packit Service |
c5cf8c |
. op - predefined reduce operation (handle)
|
|
Packit Service |
c5cf8c |
- win - window object (handle)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Output Parameters:
|
|
Packit Service |
c5cf8c |
. request - RMA request (handle)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Notes:
|
|
Packit Service |
c5cf8c |
This operations is atomic with respect to other "accumulate" operations.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The get and accumulate steps are executed atomically for each basic element in
|
|
Packit Service |
c5cf8c |
the datatype (see MPI 3.0 Section 11.7 for details). The predefined operation
|
|
Packit Service |
c5cf8c |
'MPI_REPLACE' provides fetch-and-set behavior.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The basic components of both the origin and target datatype must be the same
|
|
Packit Service |
c5cf8c |
predefined datatype (e.g., all 'MPI_INT' or all 'MPI_DOUBLE_PRECISION').
|
|
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_ARG
|
|
Packit Service |
c5cf8c |
.N MPI_ERR_COUNT
|
|
Packit Service |
c5cf8c |
.N MPI_ERR_RANK
|
|
Packit Service |
c5cf8c |
.N MPI_ERR_TYPE
|
|
Packit Service |
c5cf8c |
.N MPI_ERR_WIN
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
.seealso: MPI_Get_accumulate MPI_Fetch_and_op
|
|
Packit Service |
c5cf8c |
@*/
|
|
Packit Service |
c5cf8c |
int MPI_Rget_accumulate(const void *origin_addr, int origin_count,
|
|
Packit Service |
c5cf8c |
MPI_Datatype origin_datatype, void *result_addr, int result_count,
|
|
Packit Service |
c5cf8c |
MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp,
|
|
Packit Service |
c5cf8c |
int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win,
|
|
Packit Service |
c5cf8c |
MPI_Request * request)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int mpi_errno = MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
MPIR_Win *win_ptr = NULL;
|
|
Packit Service |
c5cf8c |
MPIR_Request *request_ptr = NULL;
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_STATE_DECL(MPID_STATE_MPI_RGET_ACCUMULATE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_INITIALIZED_ORDIE();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_RMA_ENTER(MPID_STATE_MPI_RGET_ACCUMULATE);
|
|
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 /* HAVE_ERROR_CHECKING */
|
|
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 |
MPIR_Comm *comm_ptr;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Validate win_ptr */
|
|
Packit Service |
c5cf8c |
MPIR_Win_valid_ptr(win_ptr, mpi_errno);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (op != MPI_NO_OP) {
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_COUNT(origin_count, mpi_errno);
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_DATATYPE(origin_datatype, "origin_datatype", mpi_errno);
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_USERBUFFER(origin_addr, origin_count, origin_datatype, mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_COUNT(result_count, mpi_errno);
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_DATATYPE(result_datatype, "result_datatype", mpi_errno);
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_USERBUFFER(result_addr, result_count, result_datatype, mpi_errno);
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_COUNT(target_count, mpi_errno);
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_DATATYPE(target_datatype, "target_datatype", mpi_errno);
|
|
Packit Service |
c5cf8c |
if (win_ptr->create_flavor != MPI_WIN_FLAVOR_DYNAMIC)
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_DISP(target_disp, mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (op != MPI_NO_OP && HANDLE_GET_KIND(origin_datatype) != HANDLE_KIND_BUILTIN) {
|
|
Packit Service |
c5cf8c |
MPIR_Datatype *datatype_ptr = NULL;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_Datatype_get_ptr(origin_datatype, datatype_ptr);
|
|
Packit Service |
c5cf8c |
MPIR_Datatype_valid_ptr(datatype_ptr, mpi_errno);
|
|
Packit Service |
c5cf8c |
if (mpi_errno != MPI_SUCCESS)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
MPIR_Datatype_committed_ptr(datatype_ptr, mpi_errno);
|
|
Packit Service |
c5cf8c |
if (mpi_errno != MPI_SUCCESS)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (HANDLE_GET_KIND(result_datatype) != HANDLE_KIND_BUILTIN) {
|
|
Packit Service |
c5cf8c |
MPIR_Datatype *datatype_ptr = NULL;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_Datatype_get_ptr(origin_datatype, datatype_ptr);
|
|
Packit Service |
c5cf8c |
MPIR_Datatype_valid_ptr(datatype_ptr, mpi_errno);
|
|
Packit Service |
c5cf8c |
if (mpi_errno != MPI_SUCCESS)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
MPIR_Datatype_committed_ptr(datatype_ptr, mpi_errno);
|
|
Packit Service |
c5cf8c |
if (mpi_errno != MPI_SUCCESS)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (HANDLE_GET_KIND(target_datatype) != HANDLE_KIND_BUILTIN) {
|
|
Packit Service |
c5cf8c |
MPIR_Datatype *datatype_ptr = NULL;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_Datatype_get_ptr(target_datatype, datatype_ptr);
|
|
Packit Service |
c5cf8c |
MPIR_Datatype_valid_ptr(datatype_ptr, mpi_errno);
|
|
Packit Service |
c5cf8c |
if (mpi_errno != MPI_SUCCESS)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
MPIR_Datatype_committed_ptr(datatype_ptr, mpi_errno);
|
|
Packit Service |
c5cf8c |
if (mpi_errno != MPI_SUCCESS)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
comm_ptr = win_ptr->comm_ptr;
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_SEND_RANK(comm_ptr, target_rank, mpi_errno);
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_OP_GACC(op, mpi_errno);
|
|
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 |
mpi_errno = MPID_Rget_accumulate(origin_addr, origin_count,
|
|
Packit Service |
c5cf8c |
origin_datatype,
|
|
Packit Service |
c5cf8c |
result_addr, result_count,
|
|
Packit Service |
c5cf8c |
result_datatype,
|
|
Packit Service |
c5cf8c |
target_rank, target_disp, target_count,
|
|
Packit Service |
c5cf8c |
target_datatype, op, win_ptr, &request_ptr);
|
|
Packit Service |
c5cf8c |
if (mpi_errno != MPI_SUCCESS)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
*request = request_ptr->handle;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* ... end of body of routine ... */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_exit:
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_RMA_EXIT(MPID_STATE_MPI_RGET_ACCUMULATE);
|
|
Packit Service |
c5cf8c |
MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
|
|
Packit Service |
c5cf8c |
return mpi_errno;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_fail:
|
|
Packit Service |
c5cf8c |
/* --BEGIN ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
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_rget_accumulate",
|
|
Packit Service |
c5cf8c |
"**mpi_rget_accumulate %p %d %D %p %d %D %d %d %d %D %O %W %p",
|
|
Packit Service |
c5cf8c |
origin_addr, origin_count, origin_datatype, result_addr,
|
|
Packit Service |
c5cf8c |
result_count, result_datatype, target_rank, target_disp,
|
|
Packit Service |
c5cf8c |
target_count, target_datatype, op, win, request);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Err_return_win(win_ptr, FCNAME, mpi_errno);
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
/* --END ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
}
|