Edit

Share via


MPI_Fetch_and_op function

Performs atomic read-modify-write on one element of data, and returns the data element before the accumulate operation.

Syntax

int MPIAPI MPI_Fetch_and_op(
  _In_  void         *origin_addr,
  _Out_ void         *result_addr,
        MPI_Datatype datatype,
        int          target_rank,
        MPI_Aint     target_disp,
        MPI_Op       op,
        MPI_Win      win
);

Parameters

  • origin_addr [in]
    initial address of buffer

  • result_addr [out]
    initial address of result buffer

  • datatype
    datatype of each entry in origin, result and target buffer

  • target_rank
    rank of target

  • target_disp
    displacement from start of window to beginning of target buffer

  • op
    reduce operation

  • win
    window object

Return value

Returns MPI_SUCCESS on success. Otherwise, the return value is an error code.

In Fortran, the return value is stored in the IERROR parameter.

Fortran

    MPI_FETCH_AND_OP(ORIGIN_ADDR, RESULT_ADDR, DATATYPE,
                TARGET_RANK, TARGET_DISP, OP, WIN, IERROR)
        <type> ORIGIN_ADDR(*), RESULT_ADDR(*)
        INTEGER(KIND=MPI_ADDRESS_KIND) TARGET_DISP
        INTEGER DATATYPE, TARGET_RANK, OP, WIN, IERROR

Remarks

Accumulate one element of type datatype from the origin buffer (origin_addr) to the buffer at offset target_disp, in the target window specified by target_rank and win, using the operation op and return in the result buffer result_addr the content of the target buffer before the accumulation.

The origin and result buffers (origin_addr and result_addr) must be disjoint. Any of the predefined operations for MPI_Reduce, as well as MPI_NO_OP or MPI_REPLACE, can be specified as op; user-defined functions cannot be used. The datatype argument must be a predefined datatype. The operation is executed atomically.

Requirements

Product

HPC Pack 2012 MS-MPI Redistributable Package, HPC Pack 2008 R2 MS-MPI Redistributable Package, HPC Pack 2008 MS-MPI Redistributable Package or HPC Pack 2008 Client Utilities

Header

Mpi.h; Mpif.h

Library

Msmpi.lib

DLL

Msmpi.dll

See also

MPI One-Sided Communications Functions