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

Data Structures

struct  _XMP_postreq_info
 
struct  _XMP_postreq
 

Typedefs

typedef struct _XMP_postreq_info _XMP_postreq_info_t
 
typedef struct _XMP_postreq _XMP_postreq_t
 

Functions

void _xmp_utofu_post_wait_initialize (void)
 
void _xmp_utofu_add_postreq (const utofu_vcq_id_t vcqid, const int tag)
 
void _xmp_utofu_post (const int node_num, const int tag)
 
void _xmp_utofu_wait_noargs (void)
 
void _xmp_utofu_wait (const int node_num, const int tag)
 
void _xmp_utofu_wait_node (const int node_num)
 

Typedef Documentation

◆ _XMP_postreq_info_t

◆ _XMP_postreq_t

typedef struct _XMP_postreq _XMP_postreq_t

Function Documentation

◆ _xmp_utofu_add_postreq()

void _xmp_utofu_add_postreq ( const utofu_vcq_id_t  vcqid,
const int  tag 
)
35 {
36  if( _postreq.num == _postreq.max_size ) {
37  _postreq.max_size *= _XMP_POSTREQ_TABLE_INCREMENT_RATIO;
38  size_t next_size = sizeof(_XMP_postreq_info_t) * _postreq.max_size;
40  if((tmp = realloc(_postreq.table, next_size)) == NULL) {
41  free(_postreq.table);
42  _XMP_fatal("add_postreq : cannot allocate memory : _postreq.table");
43  }
44  else{
45  _postreq.table = tmp;
46  }
47  }
48 
49  _postreq.table[_postreq.num].vcqid = vcqid;
50  _postreq.table[_postreq.num].tag = tag;
51  _postreq.num++;
52 }
Here is the caller graph for this function:

◆ _xmp_utofu_post()

void _xmp_utofu_post ( const int  node_num,
const int  tag 
)
55 {
56  uint64_t taglimit = _xmp_utofu_edata_flag_sync_images;
57  if( tag < 0 || tag >= taglimit ) {
58  fprintf(stderr, "_xmp_utofu_post : tag is %d : tag must be in the range 0 <= tag < %lu\n", tag, taglimit);
60  }
61 
63 
64  if(node_num == _XMP_world_rank){
65  _xmp_utofu_add_postreq( _xmp_utofu_vcq_ids_org[node_num], tag );
66  }
67  else{
68  int ret;
69  utofu_vcq_id_t rmt_vcq_id = _xmp_utofu_vcq_ids[node_num];
70 
71  int ident_val = _num_of_puts;
72  uint64_t edata = tag;
73  unsigned long int post_flags = UTOFU_ONESIDED_FLAG_TCQ_NOTICE | UTOFU_ONESIDED_FLAG_REMOTE_MRQ_NOTICE | UTOFU_ONESIDED_FLAG_STRONG_ORDER;
74  uintptr_t cbvalue = ident_val;
75  _num_of_puts++;
76  utofu_put(_xmp_utofu_vcq_hdl, rmt_vcq_id, _lcl_stadd, _rmt_stadds[node_num],
77  sizeof(double), edata, post_flags, (void *)cbvalue);
78 
79  void *cbdata;
80  do {
81  ret = utofu_poll_tcq(_xmp_utofu_vcq_hdl, 0, &cbdata);
82  } while (ret == UTOFU_ERR_NOT_FOUND);
83  if( ret != UTOFU_SUCCESS ) {
84  _XMP_fatal("_xmp_utofu_post : utofu_put, utofu_poll_tcq not success");
85  }
86  }
87 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _xmp_utofu_post_wait_initialize()

void _xmp_utofu_post_wait_initialize ( void  )
23 {
24  _postreq.num = 0;
25  _postreq.max_size = _XMP_POSTREQ_TABLE_INITIAL_SIZE;
26  _postreq.table = malloc(sizeof(_XMP_postreq_info_t) * _postreq.max_size);
27 
28  double *token = _XMP_alloc(sizeof(double));
29  utofu_reg_mem(_xmp_utofu_vcq_hdl, token, sizeof(double), 0, &_lcl_stadd);
30  _rmt_stadds = _XMP_alloc(sizeof(utofu_stadd_t) * _XMP_world_size);
31  MPI_Allgather(&_lcl_stadd, 1, MPI_UINT64_T, _rmt_stadds, 1, MPI_UINT64_T, MPI_COMM_WORLD);
32 }
Here is the caller graph for this function:

◆ _xmp_utofu_wait()

void _xmp_utofu_wait ( const int  node_num,
const int  tag 
)
143 {
145 
146  while(1) {
147  bool table_has_postreq = remove_postreq(_xmp_utofu_vcq_ids_org[node_num], tag);
148  if(table_has_postreq) break;
149 
150  int ret;
151  struct utofu_mrq_notice notice;
152  ret = utofu_poll_mrq(_xmp_utofu_vcq_hdl, 0, &notice);
153  if( ret == UTOFU_SUCCESS ) {
154  _XMP_utofu_check_mrq_notice( &notice );
155  }
156  else if(ret != UTOFU_ERR_NOT_FOUND) {
157  _XMP_utofu_error_check( ret );
158  }
159  }
160 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _xmp_utofu_wait_noargs()

void _xmp_utofu_wait_noargs ( void  )
90 {
92 
93  while(1) {
94  if(_postreq.num > 0) {
95  _postreq.num--;
96  break;
97  }
98  int ret;
99  struct utofu_mrq_notice notice;
100  ret = utofu_poll_mrq(_xmp_utofu_vcq_hdl, 0, &notice);
101  if( ret == UTOFU_SUCCESS ) {
102  _XMP_utofu_check_mrq_notice( &notice );
103  }
104  else if(ret != UTOFU_ERR_NOT_FOUND) {
105  _XMP_utofu_error_check( ret );
106  }
107  }
108 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _xmp_utofu_wait_node()

void _xmp_utofu_wait_node ( const int  node_num)
163 {
165 
166  while(1) {
167  bool table_has_postreq = remove_postreq_node(_xmp_utofu_vcq_ids_org[node_num]);
168  if(table_has_postreq) break;
169 
170  int ret;
171  struct utofu_mrq_notice notice;
172  ret = utofu_poll_mrq(_xmp_utofu_vcq_hdl, 0, &notice);
173  if( ret == UTOFU_SUCCESS ) {
174  _XMP_utofu_check_mrq_notice( &notice );
175  }
176  else if(ret != UTOFU_ERR_NOT_FOUND) {
177  _XMP_utofu_error_check( ret );
178  }
179  }
180 }
Here is the call graph for this function:
Here is the caller graph for this function:
_XMP_postreq::num
int num
How many post requests are in table.
Definition: xmp_post_wait_fjrdma.c:19
_XMP_fatal_nomsg
void _XMP_fatal_nomsg()
Definition: xmp_util.c:48
_XMP_postreq::max_size
int max_size
Max size of table.
Definition: xmp_post_wait_fjrdma.c:20
_XMP_utofu_sync_memory
void _XMP_utofu_sync_memory(void)
Definition: xmp_coarray_utofu.c:960
_XMP_alloc
void * _XMP_alloc(size_t size)
Definition: xmp_util.c:21
_XMP_postreq_info
Definition: xmp_post_wait_fjrdma.c:12
_XMP_postreq_info_t
struct _XMP_postreq_info _XMP_postreq_info_t
_XMP_world_size
int _XMP_world_size
Definition: xmp_world.c:8
_XMP_postreq_info::tag
int tag
Definition: xmp_post_wait_fjrdma.c:14
_XMP_world_rank
int _XMP_world_rank
Definition: xmp_world.c:9
_XMP_postreq::table
_XMP_postreq_info_t * table
Table for post requests.
Definition: xmp_post_wait_fjrdma.c:18
_XMP_utofu_error_check
void _XMP_utofu_error_check(int utofu_ret)
Definition: xmp_coarray_utofu.c:6
_xmp_utofu_add_postreq
void _xmp_utofu_add_postreq(const utofu_vcq_id_t vcqid, const int tag)
Definition: xmp_post_wait_utofu.c:34
_XMP_fatal
void _XMP_fatal(char *msg)
Definition: xmp_util.c:42
_XMP_postreq_info::vcqid
utofu_vcq_id_t vcqid
Definition: xmp_post_wait_utofu.c:8
_XMP_utofu_check_mrq_notice
uint64_t _XMP_utofu_check_mrq_notice(struct utofu_mrq_notice *notice)
Definition: xmp_coarray_utofu.c:201