libxmp/libxmpf in Omni Compiler  1.3.4
xmp_intrinsic_mpi.c File Reference
#include "xmp_internal.h"
Include dependency graph for xmp_intrinsic_mpi.c:

Functions

void _XMP_mpi_atomic_define (int target_rank, _XMP_coarray_t *c, size_t offset, int value, size_t elmt_size)
 
void _XMP_mpi_atomic_ref (int target_rank, _XMP_coarray_t *c, size_t offset, int *value, size_t elmt_size)
 

Function Documentation

◆ _XMP_mpi_atomic_define()

void _XMP_mpi_atomic_define ( int  target_rank,
_XMP_coarray_t c,
size_t  offset,
int  value,
size_t  elmt_size 
)
4 {
5  if(elmt_size != sizeof(int)){
6  _XMP_fatal("invalid element-size was specified for _XMP_mpi_atomic_define");
7  }
8 
9  MPI_Win win = _XMP_mpi_coarray_get_window(c, /*is_acc*/false);
10  MPI_Aint raddr = (MPI_Aint)( _XMP_mpi_coarray_get_remote_addr(c, target_rank, /*is_acc*/false) + elmt_size * offset );
11 
12  // MPI RMA is used even if the target is same to the origin because of avoiding public/private window synchronization
13  // MPI_Accumulate with MPI_REPLACE act as MPI_Put
14  MPI_Accumulate(&value, 1, MPI_INT,
15  target_rank, raddr, 1, MPI_INT,
16  MPI_REPLACE, win);
17 
18  MPI_Win_flush(target_rank, win);
19 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _XMP_mpi_atomic_ref()

void _XMP_mpi_atomic_ref ( int  target_rank,
_XMP_coarray_t c,
size_t  offset,
int *  value,
size_t  elmt_size 
)
22 {
23  if(elmt_size != sizeof(int)){
24  _XMP_fatal("invalid element-size was specified for _XMP_mpi_atomic_ref");
25  }
26 
27  MPI_Win win = _XMP_mpi_coarray_get_window(c, /*is_acc*/false);
28  MPI_Aint raddr = (MPI_Aint)( _XMP_mpi_coarray_get_remote_addr(c, target_rank, /*is_acc*/false) + elmt_size * offset );
29 
30  // MPI RMA is used even if the target is same to the origin because of avoiding public/private window synchronization
31  // MPI_Fetch_and_op or MPI_Get_accumulate with MPI_NO_OP act as MPI_Get
32  MPI_Fetch_and_op(NULL, value, MPI_INT,
33  target_rank, raddr,
34  MPI_NO_OP, win);
35 
36  MPI_Win_flush(target_rank, win);
37 }
Here is the call graph for this function:
Here is the caller graph for this function:
_XMP_mpi_coarray_get_remote_addr
char * _XMP_mpi_coarray_get_remote_addr(const _XMP_coarray_t *desc, const int target_rank, const bool is_acc)
Definition: xmp_coarray_mpi.c:140
_XMP_mpi_coarray_get_window
MPI_Win _XMP_mpi_coarray_get_window(const _XMP_coarray_t *desc, bool is_acc)
Definition: xmp_coarray_mpi.c:111
_XMP_fatal
void _XMP_fatal(char *msg)
Definition: xmp_util.c:42