Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Performs a remote atomic compare and swap operation.
Syntax
int MPIAPI MPI_Compare_and_swap(
_In_ void *origin_addr,
_In_ void *compare_addr,
_Out_ void *result_addr,
MPI_Datatype datatype,
int target_rank,
MPI_Aint target_disp,
MPI_Win win
);
Parameters
origin_addr [in]
initial address of buffercompare_addr [in]
initial address of comparebufferresult_addr [out]
initial address of result bufferdatatype
datatype of each entry in all bufferstarget_rank
rank of targettarget_disp
displacement from start of window to beginning of target bufferwin
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_COMPARE_AND_SWAP(ORIGIN_ADDR, COMPARE_ADDR, RESULT_ADDR,
DATATYPE, TARGET_RANK, TARGET_DISP, WIN, IERROR)
<type> ORIGIN_ADDR(*), COMPARE_ADDR(*), RESULT_ADDR(*)
INTEGER(KIND=MPI_ADDRESS_KIND) TARGET_DISP
INTEGER DATATYPE, TARGET_RANK, WIN, IERROR
Remarks
This function compares one element of type datatype in the compare buffer compare_addr with the buffer at offset target_disp in the target window specified by target_rank and win and replaces the value at the target with the value in the origin buffer origin_addr if the compare buffer and the target buffer are identical. The original value at the target is returned in the buffer result_addr. The parameter datatype must belong to one of the following categories of predefined datatypes: C integer, Fortran integer, Logical, Multi-language types, or Byte. The origin and result buffers (origin_addr and result_addr) must be disjoint.
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 |