libxmp/libxmpf in Omni Compiler  1.3.4
xmp_coarray.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "xmp_internal.h"
#include "xmp_constant.h"
Include dependency graph for xmp_coarray.c:

Data Structures

struct  _coarray_queue_t
 

Functions

void _XMP_coarray_malloc_info_1 (const long n1, const size_t elmt_size)
 Set 1-dim coarray information. More...
 
void _XMP_coarray_malloc_info_2 (const long n1, const long n2, const size_t elmt_size)
 Set 2-dim coarray information. More...
 
void _XMP_coarray_malloc_info_3 (const long n1, const long n2, const long n3, const size_t elmt_size)
 Set 3-dim coarray information. More...
 
void _XMP_coarray_malloc_info_4 (const long n1, const long n2, const long n3, const long n4, const size_t elmt_size)
 Set 4-dim coarray information. More...
 
void _XMP_coarray_malloc_info_5 (const long n1, const long n2, const long n3, const long n4, const long n5, const size_t elmt_size)
 Set 5-dim coarray information. More...
 
void _XMP_coarray_malloc_info_6 (const long n1, const long n2, const long n3, const long n4, const long n5, const long n6, const size_t elmt_size)
 Set 6-dim coarray information. More...
 
void _XMP_coarray_malloc_info_7 (const long n1, const long n2, const long n3, const long n4, const long n5, const long n6, const long n7, const size_t elmt_size)
 Set 7-dim coarray information. More...
 
void _XMP_coarray_malloc_info_n (const long *n, const int ndims, const size_t elmt_size)
 Set n-dim coarray information. More...
 
void _XMP_coarray_malloc_image_info_1 ()
 Set 1-dim image information. More...
 
void _XMP_coarray_malloc_image_info_2 (const int i1)
 Set 2-dim image information. More...
 
void _XMP_coarray_malloc_image_info_3 (const int i1, const int i2)
 Set 3-dim image information. More...
 
void _XMP_coarray_malloc_image_info_4 (const int i1, const int i2, const int i3)
 Set 4-dim image information. More...
 
void _XMP_coarray_malloc_image_info_5 (const int i1, const int i2, const int i3, const int i4)
 Set 5-dim image information. More...
 
void _XMP_coarray_malloc_image_info_6 (const int i1, const int i2, const int i3, const int i4, const int i5)
 Set 6-dim image information. More...
 
void _XMP_coarray_malloc_image_info_7 (const int i1, const int i2, const int i3, const int i4, const int i5, const int i6)
 
void _XMP_coarray_malloc_image_info_n (const int *i, const int ndims)
 
void _XMP_coarray_set_info (_XMP_coarray_t *c)
 
void _XMP_coarray_malloc (void **coarray_desc, void *addr)
 Create coarray object and allocate coarray. More...
 
void _XMP_coarray_regmem (void **coarray_desc, void *addr)
 Create coarray object but not allocate coarray. More...
 
void _XMP_coarray_attach (_XMP_coarray_t *coarray_desc, void *addr, const size_t coarray_size)
 Attach memory to coarray. More...
 
void _XMP_coarray_detach (_XMP_coarray_t *coarray_desc)
 Detach memory from coarray. More...
 
void _XMP_coarray_rdma_coarray_set_1 (const long start1, const long length1, const long stride1)
 Set transfer 1-dim coarray information. More...
 
void _XMP_coarray_rdma_coarray_set_2 (const long start1, const long length1, const long stride1, const long start2, const long length2, const long stride2)
 Set transfer 2-dim coarray information. More...
 
void _XMP_coarray_rdma_coarray_set_3 (const long start1, const long length1, const long stride1, const long start2, const long length2, const long stride2, const long start3, const long length3, const long stride3)
 Set transfer 3-dim coarray information. More...
 
void _XMP_coarray_rdma_coarray_set_4 (const long start1, const long length1, const long stride1, const long start2, const long length2, const long stride2, const long start3, const long length3, const long stride3, const long start4, const long length4, const long stride4)
 Set transfer 4-dim coarray information. More...
 
void _XMP_coarray_rdma_coarray_set_5 (const long start1, const long length1, const long stride1, const long start2, const long length2, const long stride2, const long start3, const long length3, const long stride3, const long start4, const long length4, const long stride4, const long start5, const long length5, const long stride5)
 Set transfer 5-dim coarray information. More...
 
void _XMP_coarray_rdma_coarray_set_6 (const long start1, const long length1, const long stride1, const long start2, const long length2, const long stride2, const long start3, const long length3, const long stride3, const long start4, const long length4, const long stride4, const long start5, const long length5, const long stride5, const long start6, const long length6, const long stride6)
 Set transfer 6-dim coarray information. More...
 
void _XMP_coarray_rdma_coarray_set_7 (const long start1, const long length1, const long stride1, const long start2, const long length2, const long stride2, const long start3, const long length3, const long stride3, const long start4, const long length4, const long stride4, const long start5, const long length5, const long stride5, const long start6, const long length6, const long stride6, const long start7, const long length7, const long stride7)
 Set transfer 7-dim coarray information. More...
 
void _XMP_coarray_rdma_coarray_set_n (const int n, const long start[], const long length[], const long stride[])
 Set transfer n-dim coarray information. More...
 
void _XMP_coarray_rdma_array_set_1 (const long start1, const long length1, const long stride1, const long elmts1, const size_t elmt)
 Set transfer 1-dim array information. More...
 
void _XMP_coarray_rdma_array_set_2 (const long start1, const long length1, const long stride1, const long elmts1, const long start2, const long length2, const long stride2, const long elmts2, const size_t elmt)
 Set transfer 2-dim array information. More...
 
void _XMP_coarray_rdma_array_set_3 (const long start1, const long length1, const long stride1, const long elmts1, const long start2, const long length2, const long stride2, const long elmts2, const long start3, const long length3, const long stride3, const long elmts3, const size_t elmt)
 Set transfer 3-dim array information. More...
 
void _XMP_coarray_rdma_array_set_4 (const long start1, const long length1, const long stride1, const long elmts1, const long start2, const long length2, const long stride2, const long elmts2, const long start3, const long length3, const long stride3, const long elmts3, const long start4, const long length4, const long stride4, const long elmts4, const size_t elmt)
 Set transfer 4-dim array information. More...
 
void _XMP_coarray_rdma_array_set_5 (const long start1, const long length1, const long stride1, const long elmts1, const long start2, const long length2, const long stride2, const long elmts2, const long start3, const long length3, const long stride3, const long elmts3, const long start4, const long length4, const long stride4, const long elmts4, const long start5, const long length5, const long stride5, const long elmts5, const size_t elmt)
 Set transfer 5-dim array information. More...
 
void _XMP_coarray_rdma_array_set_6 (const long start1, const long length1, const long stride1, const long elmts1, const long start2, const long length2, const long stride2, const long elmts2, const long start3, const long length3, const long stride3, const long elmts3, const long start4, const long length4, const long stride4, const long elmts4, const long start5, const long length5, const long stride5, const long elmts5, const long start6, const long length6, const long stride6, const long elmts6, const size_t elmt)
 Set transfer 6-dim array information. More...
 
void _XMP_coarray_rdma_array_set_7 (const long start1, const long length1, const long stride1, const long elmts1, const long start2, const long length2, const long stride2, const long elmts2, const long start3, const long length3, const long stride3, const long elmts3, const long start4, const long length4, const long stride4, const long elmts4, const long start5, const long length5, const long stride5, const long elmts5, const long start6, const long length6, const long stride6, const long elmts6, const long start7, const long length7, const long stride7, const long elmts7, const size_t elmt)
 Set transfer 7-dim array information. More...
 
void _XMP_coarray_rdma_array_set_n (const int n, const long start[], const long length[], const long stride[], const long elmts[], const long distance[])
 Set transfer n-dim array information. More...
 
void _XMP_coarray_rdma_image_set_1 (const int n1)
 Set 1-dim image information. More...
 
void _XMP_coarray_rdma_image_set_2 (const int n1, const int n2)
 Set 2-dim image information. More...
 
void _XMP_coarray_rdma_image_set_3 (const int n1, const int n2, const int n3)
 Set 3-dim image information. More...
 
void _XMP_coarray_rdma_image_set_4 (const int n1, const int n2, const int n3, const int n4)
 Set 4-dim image information. More...
 
void _XMP_coarray_rdma_image_set_5 (const int n1, const int n2, const int n3, const int n4, const int n5)
 Set 5-dim image information. More...
 
void _XMP_coarray_rdma_image_set_6 (const int n1, const int n2, const int n3, const int n4, const int n5, const int n6)
 Set 6-dim image information. More...
 
void _XMP_coarray_rdma_image_set_7 (const int n1, const int n2, const int n3, const int n4, const int n5, const int n6, const int n7)
 Set 7-dim image information. More...
 
void _XMP_coarray_rdma_image_set_n (const int ndims, const int n[])
 Set n-dim image information. More...
 
void _XMP_coarray_put (void *remote_coarray, void *local_array, void *local_coarray)
 
void _XMP_coarray_get (void *remote_coarray, void *local_array, void *local_coarray)
 
void _XMP_coarray_rdma_do2 (const int rdma_code, void *remote_coarray, void *local_array, void *local_coarray, const long coarray_elmts[], const long coarray_distance[])
 
void _XMP_coarray_sync_all ()
 Execute sync_all() More...
 
void _XMP_coarray_sync_memory ()
 Execute sync_memory() More...
 
void xmp_sync_memory (const int *status)
 Execute sync_memory() More...
 
void xmp_sync_all (const int *status)
 Execute sync_all() More...
 
void xmp_sync_images (const int num, int *image_set, int *status)
 Execute sync_images() More...
 
void xmp_sync_image (int image, int *status)
 Execute sync_image() More...
 
void xmp_sync_images_all (int *status)
 Execute sync_images_all() More...
 
void _XMP_coarray_contiguous_put (const int target_rank, _XMP_coarray_t *dst_desc, const _XMP_coarray_t *src_desc, const long dst_offset, const long src_offset, const long dst_elmts, const long src_elmts)
 
void _XMP_coarray_contiguous_get (const int target_rank, _XMP_coarray_t *dst_desc, const _XMP_coarray_t *src_desc, const long dst_offset, const long src_offset, const long dst_elmts, const long src_elmts)
 
void _XMP_build_sync_images_table ()
 Build table for sync images. More...
 
void _XMP_build_coarray_queue ()
 Build queue for coarray. More...
 
void _XMP_coarray_lastly_deallocate ()
 Deallocate memory space and an object of the last coarray. More...
 
void _XMP_coarray_put_acc (void *remote_coarray, void *local_array, void *local_coarray, const int is_remote_on_acc, const int is_local_on_acc)
 
void _XMP_coarray_get_acc (void *remote_coarray, void *local_array, void *local_coarray, const int is_remote_on_acc, const int is_local_on_acc)
 
_XMP_coarray_t ** _XMP_coarray_get_list (int *num)
 

Variables

int _XMP_flag_multi_win
 

Function Documentation

◆ _XMP_build_coarray_queue()

void _XMP_build_coarray_queue ( )

Build queue for coarray.

1575 {
1576  _coarray_queue.max_size = _XMP_COARRAY_QUEUE_INITIAL_SIZE;
1577  _coarray_queue.num = 0;
1578  _coarray_queue.coarrays = malloc(sizeof(_XMP_coarray_t*) * _coarray_queue.max_size);
1579 }
Here is the caller graph for this function:

◆ _XMP_build_sync_images_table()

void _XMP_build_sync_images_table ( )

Build table for sync images.

1559 {
1560 #ifdef _XMP_GASNET
1562 #elif _XMP_FJRDMA
1564 #elif _XMP_UTOFU
1566 #elif _XMP_MPI3_ONESIDED
1568 #endif
1569 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _XMP_coarray_attach()

void _XMP_coarray_attach ( _XMP_coarray_t coarray_desc,
void *  addr,
const size_t  coarray_size 
)

Attach memory to coarray.

387 {
388  _XMP_coarray_set_info(coarray_desc);
389 
390 #ifdef _XMP_GASNET
391  //not implemented
392  _XMP_fatal("_XMP_gasnet_coarray_attach is not implemented\n");
393 #elif _XMP_FJRDMA
394  //not implemented
395  _XMP_fatal("_XMP_fjrdma_coarray_attach is not implemented\n");
396 #elif _XMP_UTOFU
397  //not implemented
398  _XMP_fatal("_XMP_utofu_coarray_attach is not implemented\n");
399 #elif _XMP_MPI3_ONESIDED
400  _XMP_mpi_coarray_attach(coarray_desc, addr, coarray_size, false);
401 #endif
402 
403  _push_coarray_queue(coarray_desc);
404 }
Here is the call graph for this function:

◆ _XMP_coarray_contiguous_get()

void _XMP_coarray_contiguous_get ( const int  target_rank,
_XMP_coarray_t dst_desc,
const _XMP_coarray_t src_desc,
const long  dst_offset,
const long  src_offset,
const long  dst_elmts,
const long  src_elmts 
)
1528 {
1529  check_target_rank(target_rank);
1530  size_t elmt_size = dst_desc->elmt_size;
1531 
1532  if(target_rank == _XMP_world_rank){
1533  _XMP_local_contiguous_copy((char *)dst_desc->real_addr+dst_offset, (char *)src_desc->real_addr+src_offset,
1534  dst_elmts, src_elmts, elmt_size);
1535  }
1536  else{
1537  _XMP_check_less_than_SIZE_MAX(dst_elmts);
1538  _XMP_check_less_than_SIZE_MAX(src_elmts);
1539 #ifdef _XMP_GASNET
1540  _XMP_gasnet_contiguous_get(target_rank, dst_desc, src_desc->addr[target_rank]+src_offset, (size_t)dst_offset,
1541  (size_t)dst_elmts, (size_t)src_elmts, elmt_size);
1542 #elif _XMP_FJRDMA
1543  _XMP_fjrdma_contiguous_get(target_rank, dst_desc, src_desc, (uint64_t)dst_offset, (uint64_t)src_offset,
1544  (size_t)dst_elmts, (size_t)src_elmts, elmt_size);
1545 #elif _XMP_UTOFU
1546  _XMP_utofu_contiguous_get(target_rank, dst_desc, src_desc, (uint64_t)dst_offset, (uint64_t)src_offset,
1547  (size_t)dst_elmts, (size_t)src_elmts, elmt_size);
1548 #elif _XMP_MPI3_ONESIDED
1549  _XMP_mpi_contiguous_get(target_rank, dst_desc, src_desc, (size_t)dst_offset, (size_t)src_offset,
1550  (size_t)dst_elmts, (size_t)src_elmts, elmt_size, false, false);
1551 #endif
1552  }
1553 }

◆ _XMP_coarray_contiguous_put()

void _XMP_coarray_contiguous_put ( const int  target_rank,
_XMP_coarray_t dst_desc,
const _XMP_coarray_t src_desc,
const long  dst_offset,
const long  src_offset,
const long  dst_elmts,
const long  src_elmts 
)
1483 {
1484  check_target_rank(target_rank);
1485  size_t elmt_size = dst_desc->elmt_size;
1486 
1487  if(target_rank == _XMP_world_rank){
1488  _XMP_local_contiguous_copy((char *)dst_desc->real_addr+dst_offset, (char *)src_desc->real_addr+src_offset,
1489  dst_elmts, src_elmts, elmt_size);
1490  }
1491  else{
1492  _XMP_check_less_than_SIZE_MAX(dst_elmts);
1493  _XMP_check_less_than_SIZE_MAX(src_elmts);
1494 #ifdef _XMP_GASNET
1495  _XMP_gasnet_contiguous_put(target_rank, dst_desc, src_desc->addr[_XMP_world_rank]+src_offset,
1496  (size_t)dst_offset, (size_t)dst_elmts, (size_t)src_elmts, elmt_size);
1497 #elif _XMP_FJRDMA
1498  _XMP_fjrdma_contiguous_put(target_rank, (uint64_t)dst_offset, (uint64_t)src_offset, dst_desc, src_desc,
1499  (size_t)dst_elmts, (size_t)src_elmts, elmt_size);
1500 #elif _XMP_UTOFU
1501  _XMP_utofu_contiguous_put(target_rank, (uint64_t)dst_offset, (uint64_t)src_offset, dst_desc, src_desc,
1502  (size_t)dst_elmts, (size_t)src_elmts, elmt_size);
1503 #elif _XMP_TCA
1504  _XMP_fatal("_XMP_tca_contiguous_put is unimplemented");
1505 #elif _XMP_MPI3_ONESIDED
1506  _XMP_mpi_contiguous_put(target_rank, dst_desc, src_desc, (size_t)dst_offset, (size_t)src_offset,
1507  (size_t)dst_elmts, (size_t)src_elmts, elmt_size, false, false);
1508 #endif
1509  }
1510 }

◆ _XMP_coarray_detach()

void _XMP_coarray_detach ( _XMP_coarray_t coarray_desc)

Detach memory from coarray.

410 {
411  _XMP_coarray_t* poped_desc = _pop_coarray_queue();
412  if(poped_desc != coarray_desc){
413  _XMP_fatal("_XMP_coarary_detach: poped coarray desc is not the same to argument");
414  }
415 
416 #ifdef _XMP_GASNET
417  //not implemented
418  _XMP_fatal("_XMP_gasnet_coarray_detach is not implemented\n");
419 #elif _XMP_FJRDMA
420  //not implemented
421  _XMP_fatal("_XMP_fjrdma_coarray_detach is not implemented\n");
422 #elif _XMP_UTOFU
423  //not implemented
424  _XMP_fatal("_XMP_utofu_coarray_detach is not implemented\n");
425 #elif _XMP_MPI3_ONESIDED
426  _XMP_mpi_coarray_detach(coarray_desc, false);
427 #endif
428 }

◆ _XMP_coarray_get()

void _XMP_coarray_get ( void *  remote_coarray,
void *  local_array,
void *  local_coarray 
)
1224 {
1225  if(_transfer_coarray_elmts == 0 || _transfer_array_elmts == 0) return;
1226 
1227  if(_transfer_coarray_elmts != _transfer_array_elmts && _transfer_coarray_elmts != 1){
1228  _XMP_fatal("Coarray Error ! transfer size is wrong.\n") ;
1229  // e.g. a[0:3] = b[0:2]:[3] is NG, but a[0:3] = b[0:1]:[3] is OK
1230  }
1231 
1232  int target_rank = 0;
1233  for(int i=0;i<_image_dims;i++)
1234  target_rank += ((_XMP_coarray_t*)remote_coarray)->distance_of_image_elmts[i] * _image_num[i];
1235 
1236  check_target_rank(target_rank);
1237 
1238  for(int i=0;i<_coarray_dims;i++){
1239  _coarray[i].elmts = ((_XMP_coarray_t*)remote_coarray)->coarray_elmts[i];
1240  _coarray[i].distance = ((_XMP_coarray_t*)remote_coarray)->distance_of_coarray_elmts[i];
1241  }
1242 
1243  int remote_coarray_is_contiguous = _check_contiguous(_coarray, _coarray_dims, _transfer_coarray_elmts);
1244  int local_array_is_contiguous = _check_contiguous(_array, _array_dims, _transfer_array_elmts);
1245 
1246  // _XMP_local_put(), _XMP_gasnet_put(), ... don't support to transfer long data size now.
1247  // _XMP_check_less_than_SIZE_MAX() checks whether the trasfer size is less than SIZE_MAX, defined in <limits.h>.
1248  size_t elmt_size = ((_XMP_coarray_t*)remote_coarray)->elmt_size;
1249  _XMP_check_less_than_SIZE_MAX(_transfer_coarray_elmts*elmt_size); // fix me
1250  _XMP_check_less_than_SIZE_MAX(_transfer_array_elmts*elmt_size); // fix me
1251 
1252  if(target_rank == _XMP_world_rank){
1253  _XMP_local_get(local_array, remote_coarray, local_array_is_contiguous, remote_coarray_is_contiguous,
1254  _array_dims, _coarray_dims, _array, _coarray, (size_t)_transfer_array_elmts, (size_t)_transfer_coarray_elmts);
1255  }
1256  else{
1257 #ifdef _XMP_GASNET
1258  _XMP_gasnet_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank,
1259  _coarray_dims, _array_dims, _coarray, _array, remote_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1260 #elif _XMP_FJRDMA
1261  _XMP_fjrdma_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1262  _coarray, _array, remote_coarray, local_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1263 #elif _XMP_UTOFU
1264  _XMP_utofu_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1265  _coarray, _array, remote_coarray, local_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1266 #elif _XMP_MPI3_ONESIDED
1267  _XMP_mpi_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1268  _coarray, _array, remote_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts,
1270 #endif
1271  }
1272 
1273  free(_coarray);
1274  free(_array);
1275  free(_image_num);
1276 }

◆ _XMP_coarray_get_acc()

void _XMP_coarray_get_acc ( void *  remote_coarray,
void *  local_array,
void *  local_coarray,
const int  is_remote_on_acc,
const int  is_local_on_acc 
)
1727 {
1728  if(_transfer_coarray_elmts == 0 || _transfer_array_elmts == 0) return;
1729 
1730  if(_transfer_coarray_elmts != _transfer_array_elmts && _transfer_coarray_elmts != 1){
1731  _XMP_fatal("Coarray Error ! transfer size is wrong.\n") ;
1732  // e.g. a[0:3] = b[0:2]:[3] is NG, but a[0:3] = b[0:1]:[3] is OK
1733  }
1734 
1735  int target_rank = 0;
1736  for(int i=0;i<_image_dims;i++)
1737  target_rank += ((_XMP_coarray_t*)remote_coarray)->distance_of_image_elmts[i] * _image_num[i];
1738  check_target_rank(target_rank);
1739 
1740  for(int i=0;i<_coarray_dims;i++){
1741  _coarray[i].elmts = ((_XMP_coarray_t*)remote_coarray)->coarray_elmts[i];
1742  _coarray[i].distance = ((_XMP_coarray_t*)remote_coarray)->distance_of_coarray_elmts[i];
1743  }
1744 
1745  int remote_coarray_is_contiguous = _check_contiguous(_coarray, _coarray_dims, _transfer_coarray_elmts);
1746  int local_array_is_contiguous = _check_contiguous(_array, _array_dims, _transfer_array_elmts);
1747 
1748  if(target_rank == _XMP_world_rank){
1749  _XMP_local_get(local_array, remote_coarray, local_array_is_contiguous, remote_coarray_is_contiguous,
1750  _array_dims, _coarray_dims, _array, _coarray, _transfer_array_elmts, _transfer_coarray_elmts);
1751  }
1752  else{
1753 #ifdef _XMP_GASNET
1754  _XMP_gasnet_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank,
1755  _coarray_dims, _array_dims, _coarray, _array, remote_coarray, local_array, _transfer_coarray_elmts, _transfer_array_elmts);
1756 #elif _XMP_FJRDMA
1757  _XMP_fjrdma_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1758  _coarray, _array, remote_coarray, local_coarray, local_array, _transfer_coarray_elmts, _transfer_array_elmts);
1759 #elif _XMP_UTOFU
1760  _XMP_utofu_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1761  _coarray, _array, remote_coarray, local_coarray, local_array, _transfer_coarray_elmts, _transfer_array_elmts);
1762 #elif _XMP_MPI3_ONESIDED
1763  _XMP_mpi_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1764  _coarray, _array, remote_coarray, local_array, _transfer_coarray_elmts, _transfer_array_elmts,
1765  is_remote_on_acc);
1766 #endif
1767  }
1768 
1769  free(_coarray);
1770  free(_array);
1771  free(_image_num);
1772 }

◆ _XMP_coarray_get_list()

_XMP_coarray_t** _XMP_coarray_get_list ( int *  num)
1775 {
1776  *num = _coarray_queue.num;
1777  return _coarray_queue.coarrays;
1778 }
Here is the caller graph for this function:

◆ _XMP_coarray_lastly_deallocate()

void _XMP_coarray_lastly_deallocate ( )

Deallocate memory space and an object of the last coarray.

1644 {
1645 #ifdef _XMP_GASNET
1647 #elif _XMP_FJRDMA
1649 #elif _XMP_UTOFU
1650  // _XMP_utofu_coarray_lastly_deallocate();
1651 #elif _XMP_MPI3_ONESIDED
1653 #endif
1654 
1655  _XMP_coarray_t *_last_coarray_ptr = _pop_coarray_queue();
1656  _XMP_coarray_deallocate(_last_coarray_ptr);
1657 }
Here is the call graph for this function:

◆ _XMP_coarray_malloc()

void _XMP_coarray_malloc ( void **  coarray_desc,
void *  addr 
)

Create coarray object and allocate coarray.

334 {
337  *coarray_desc = c;
338 
339  long transfer_size = _total_coarray_elmts*_elmt_size;
340  _XMP_check_less_than_SIZE_MAX(transfer_size);
341 
342 #ifdef _XMP_GASNET
343  _XMP_gasnet_coarray_malloc(*coarray_desc, addr, (size_t)transfer_size);
344 #elif _XMP_FJRDMA
345  _XMP_fjrdma_coarray_malloc(*coarray_desc, addr, (size_t)transfer_size);
346 #elif _XMP_UTOFU
347  _XMP_utofu_coarray_malloc(*coarray_desc, addr, (size_t)transfer_size);
348 #elif _XMP_MPI3_ONESIDED
349  _XMP_mpi_coarray_malloc(*coarray_desc, addr, (size_t)transfer_size, false);
350 #endif
351 
352  _push_coarray_queue(c);
353 }
Here is the call graph for this function:

◆ _XMP_coarray_malloc_image_info_1()

void _XMP_coarray_malloc_image_info_1 ( )

Set 1-dim image information.

156 {
157  _image_dims = 1;
158  _image_elmts = malloc(sizeof(int) * _image_dims);
159  _image_elmts[0] = 1;
160 }

◆ _XMP_coarray_malloc_image_info_2()

void _XMP_coarray_malloc_image_info_2 ( const int  i1)

Set 2-dim image information.

175 {
176  int total_node_size = _XMP_get_execution_nodes()->comm_size;
177 
178  _check_coarray_image(total_node_size, i1);
179 
180  _image_dims = 2;
181  _image_elmts = malloc(sizeof(int) * _image_dims);
182  _image_elmts[0] = i1;
183  _image_elmts[1] = total_node_size / i1;
184 }
Here is the call graph for this function:

◆ _XMP_coarray_malloc_image_info_3()

void _XMP_coarray_malloc_image_info_3 ( const int  i1,
const int  i2 
)

Set 3-dim image information.

190 {
191  int total_node_size = _XMP_get_execution_nodes()->comm_size;
192 
193  _check_coarray_image(total_node_size, i1*i2);
194 
195  _image_dims = 3;
196  _image_elmts = malloc(sizeof(int) * _image_dims);
197  _image_elmts[0] = i1;
198  _image_elmts[1] = i2;
199  _image_elmts[2] = total_node_size / (i1*i2);
200 }
Here is the call graph for this function:

◆ _XMP_coarray_malloc_image_info_4()

void _XMP_coarray_malloc_image_info_4 ( const int  i1,
const int  i2,
const int  i3 
)

Set 4-dim image information.

206 {
207  int total_node_size = _XMP_get_execution_nodes()->comm_size;
208 
209  _check_coarray_image(total_node_size, i1*i2*i3);
210 
211  _image_dims = 4;
212  _image_elmts = malloc(sizeof(int) * _image_dims);
213  _image_elmts[0] = i1;
214  _image_elmts[1] = i2;
215  _image_elmts[2] = i3;
216  _image_elmts[3] = total_node_size / (i1*i2*i3);
217 }
Here is the call graph for this function:

◆ _XMP_coarray_malloc_image_info_5()

void _XMP_coarray_malloc_image_info_5 ( const int  i1,
const int  i2,
const int  i3,
const int  i4 
)

Set 5-dim image information.

223 {
224  int total_node_size = _XMP_get_execution_nodes()->comm_size;
225 
226  _check_coarray_image(total_node_size, i1*i2*i3*i4);
227 
228  _image_dims = 5;
229  _image_elmts = malloc(sizeof(int) * _image_dims);
230  _image_elmts[0] = i1;
231  _image_elmts[1] = i2;
232  _image_elmts[2] = i3;
233  _image_elmts[3] = i4;
234  _image_elmts[4] = total_node_size / (i1*i2*i3*i4);
235 }
Here is the call graph for this function:

◆ _XMP_coarray_malloc_image_info_6()

void _XMP_coarray_malloc_image_info_6 ( const int  i1,
const int  i2,
const int  i3,
const int  i4,
const int  i5 
)

Set 6-dim image information.

242 {
243  int total_node_size = _XMP_get_execution_nodes()->comm_size;
244 
245  _check_coarray_image(total_node_size, i1*i2*i3*i4*i5);
246 
247  _image_dims = 6;
248  _image_elmts = malloc(sizeof(int) * _image_dims);
249  _image_elmts[0] = i1;
250  _image_elmts[1] = i2;
251  _image_elmts[2] = i3;
252  _image_elmts[3] = i4;
253  _image_elmts[4] = i5;
254  _image_elmts[5] = total_node_size / (i1*i2*i3*i4*i5);
255 }
Here is the call graph for this function:

◆ _XMP_coarray_malloc_image_info_7()

void _XMP_coarray_malloc_image_info_7 ( const int  i1,
const int  i2,
const int  i3,
const int  i4,
const int  i5,
const int  i6 
)
259 {
260  int total_node_size = _XMP_get_execution_nodes()->comm_size;
261 
262  _check_coarray_image(total_node_size, i1*i2*i3*i4*i5*i6);
263 
264  _image_dims = 7;
265  _image_elmts = malloc(sizeof(int) * _image_dims);
266  _image_elmts[0] = i1;
267  _image_elmts[1] = i2;
268  _image_elmts[2] = i3;
269  _image_elmts[3] = i4;
270  _image_elmts[4] = i5;
271  _image_elmts[5] = i6;
272  _image_elmts[6] = total_node_size / (i1*i2*i3*i4*i5*i6);
273 }
Here is the call graph for this function:

◆ _XMP_coarray_malloc_image_info_n()

void _XMP_coarray_malloc_image_info_n ( const int *  i,
const int  ndims 
)
276 {
277  int total_node_size = _XMP_get_execution_nodes()->comm_size;
278 
279  int t = 1;
280  for (int j = 0; j < ndims-1; j++){
281  t *= i[j];
282  }
283 
284  _check_coarray_image(total_node_size, t);
285 
286  _image_dims = ndims;
287  _image_elmts = malloc(sizeof(int) * _image_dims);
288  for (int j = 0; j < ndims-1; j++){
289  _image_elmts[j] = i[j];
290  }
291  _image_elmts[ndims-1] = total_node_size / t;
292 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _XMP_coarray_malloc_info_1()

void _XMP_coarray_malloc_info_1 ( const long  n1,
const size_t  elmt_size 
)

Set 1-dim coarray information.

32 {
33  _elmt_size = elmt_size;
34  _coarray_dims = 1;
35  _coarray_elmts = malloc(sizeof(long) * _coarray_dims);
36  _coarray_elmts[0] = n1;
37  _total_coarray_elmts = n1;
38 }

◆ _XMP_coarray_malloc_info_2()

void _XMP_coarray_malloc_info_2 ( const long  n1,
const long  n2,
const size_t  elmt_size 
)

Set 2-dim coarray information.

44 {
45  _elmt_size = elmt_size;
46  _coarray_dims = 2;
47  _coarray_elmts = malloc(sizeof(long) * _coarray_dims);
48  _coarray_elmts[0] = n1;
49  _coarray_elmts[1] = n2;
50  _total_coarray_elmts = n1*n2;
51 }

◆ _XMP_coarray_malloc_info_3()

void _XMP_coarray_malloc_info_3 ( const long  n1,
const long  n2,
const long  n3,
const size_t  elmt_size 
)

Set 3-dim coarray information.

57 {
58  _elmt_size = elmt_size;
59  _coarray_dims = 3;
60  _coarray_elmts = malloc(sizeof(long) * _coarray_dims);
61  _coarray_elmts[0] = n1;
62  _coarray_elmts[1] = n2;
63  _coarray_elmts[2] = n3;
64  _total_coarray_elmts = n1*n2*n3;
65 }

◆ _XMP_coarray_malloc_info_4()

void _XMP_coarray_malloc_info_4 ( const long  n1,
const long  n2,
const long  n3,
const long  n4,
const size_t  elmt_size 
)

Set 4-dim coarray information.

72 {
73  _elmt_size = elmt_size;
74  _coarray_dims = 4;
75  _coarray_elmts = malloc(sizeof(long) * _coarray_dims);
76  _coarray_elmts[0] = n1;
77  _coarray_elmts[1] = n2;
78  _coarray_elmts[2] = n3;
79  _coarray_elmts[3] = n4;
80  _total_coarray_elmts = n1*n2*n3*n4;
81 }

◆ _XMP_coarray_malloc_info_5()

void _XMP_coarray_malloc_info_5 ( const long  n1,
const long  n2,
const long  n3,
const long  n4,
const long  n5,
const size_t  elmt_size 
)

Set 5-dim coarray information.

88 {
89  _elmt_size = elmt_size;
90  _coarray_dims = 5;
91  _coarray_elmts = malloc(sizeof(long) * _coarray_dims);
92  _coarray_elmts[0] = n1;
93  _coarray_elmts[1] = n2;
94  _coarray_elmts[2] = n3;
95  _coarray_elmts[3] = n4;
96  _coarray_elmts[4] = n5;
97  _total_coarray_elmts = n1*n2*n3*n4*n5;
98 }

◆ _XMP_coarray_malloc_info_6()

void _XMP_coarray_malloc_info_6 ( const long  n1,
const long  n2,
const long  n3,
const long  n4,
const long  n5,
const long  n6,
const size_t  elmt_size 
)

Set 6-dim coarray information.

105 {
106  _elmt_size = elmt_size;
107  _coarray_dims = 6;
108  _coarray_elmts = malloc(sizeof(long) * _coarray_dims);
109  _coarray_elmts[0] = n1;
110  _coarray_elmts[1] = n2;
111  _coarray_elmts[2] = n3;
112  _coarray_elmts[3] = n4;
113  _coarray_elmts[4] = n5;
114  _coarray_elmts[5] = n6;
115  _total_coarray_elmts = n1*n2*n3*n4*n5*n6;
116 }

◆ _XMP_coarray_malloc_info_7()

void _XMP_coarray_malloc_info_7 ( const long  n1,
const long  n2,
const long  n3,
const long  n4,
const long  n5,
const long  n6,
const long  n7,
const size_t  elmt_size 
)

Set 7-dim coarray information.

123 {
124  _elmt_size = elmt_size;
125  _coarray_dims = 7;
126  _coarray_elmts = malloc(sizeof(long) * _coarray_dims);
127  _coarray_elmts[0] = n1;
128  _coarray_elmts[1] = n2;
129  _coarray_elmts[2] = n3;
130  _coarray_elmts[3] = n4;
131  _coarray_elmts[4] = n5;
132  _coarray_elmts[5] = n6;
133  _coarray_elmts[6] = n7;
134  _total_coarray_elmts = n1*n2*n3*n4*n5*n6*n7;
135 }

◆ _XMP_coarray_malloc_info_n()

void _XMP_coarray_malloc_info_n ( const long *  n,
const int  ndims,
const size_t  elmt_size 
)

Set n-dim coarray information.

141 {
142  _elmt_size = elmt_size;
143  _coarray_dims = ndims;
144  _coarray_elmts = malloc(sizeof(long) * _coarray_dims);
145  _total_coarray_elmts = 1;
146  for (int i = 0; i < ndims; i++){
147  _coarray_elmts[i] = n[i];
148  _total_coarray_elmts *= n[i];
149  }
150 }
Here is the caller graph for this function:

◆ _XMP_coarray_put()

void _XMP_coarray_put ( void *  remote_coarray,
void *  local_array,
void *  local_coarray 
)
1161 {
1162  if(_transfer_coarray_elmts == 0 || _transfer_array_elmts == 0) return;
1163 
1164  if(_transfer_coarray_elmts != _transfer_array_elmts && _transfer_array_elmts != 1){
1165  _XMP_fatal("Coarray Error ! transfer size is wrong.\n");
1166  // e.g. a[0:3]:[3] = b[0:2] is NG, but a[0:3]:[3] = b[0:1] is OK.
1167  }
1168 
1169  int target_rank = 0;
1170  for(int i=0;i<_image_dims;i++)
1171  target_rank += ((_XMP_coarray_t*)remote_coarray)->distance_of_image_elmts[i] * _image_num[i];
1172 
1173  check_target_rank(target_rank);
1174 
1175  for(int i=0;i<_coarray_dims;i++){
1176  _coarray[i].elmts = ((_XMP_coarray_t*)remote_coarray)->coarray_elmts[i];
1177  _coarray[i].distance = ((_XMP_coarray_t*)remote_coarray)->distance_of_coarray_elmts[i];
1178  }
1179 
1180  int remote_coarray_is_contiguous = _check_contiguous(_coarray, _coarray_dims, _transfer_coarray_elmts);
1181  int local_array_is_contiguous = _check_contiguous(_array, _array_dims, _transfer_array_elmts);
1182 
1183  // _XMP_local_put(), _XMP_gasnet_put(), ... don't support to transfer long data size now.
1184  // _XMP_check_less_than_SIZE_MAX() checks whether the trasfer size is less than SIZE_MAX, defined in <limits.h>.
1185  size_t elmt_size = ((_XMP_coarray_t*)remote_coarray)->elmt_size;
1186  _XMP_check_less_than_SIZE_MAX(_transfer_coarray_elmts*elmt_size); // fix me
1187  _XMP_check_less_than_SIZE_MAX(_transfer_array_elmts*elmt_size); // fix me
1188 
1189  if(target_rank == _XMP_world_rank){
1190  _XMP_local_put(remote_coarray, local_array, remote_coarray_is_contiguous, local_array_is_contiguous,
1191  _coarray_dims, _array_dims, _coarray, _array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1192  }
1193  else{
1194 #ifdef _XMP_GASNET
1195  _XMP_gasnet_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1196  _coarray, _array, remote_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1197 #elif _XMP_FJRDMA
1198  _XMP_fjrdma_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1199  _coarray, _array, remote_coarray, local_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1200 #elif _XMP_UTOFU
1201  _XMP_utofu_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1202  _coarray, _array, remote_coarray, local_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1203 #elif _XMP_MPI3_ONESIDED
1204  _XMP_mpi_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1205  _coarray, _array, remote_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts,
1207 #endif
1208  }
1209 
1210  free(_coarray);
1211  free(_array);
1212  free(_image_num);
1213 }

◆ _XMP_coarray_put_acc()

void _XMP_coarray_put_acc ( void *  remote_coarray,
void *  local_array,
void *  local_coarray,
const int  is_remote_on_acc,
const int  is_local_on_acc 
)
1669 {
1670  if(_transfer_coarray_elmts == 0 || _transfer_array_elmts == 0) return;
1671 
1672  if(_transfer_coarray_elmts != _transfer_array_elmts && _transfer_array_elmts != 1){
1673  _XMP_fatal("Coarray Error ! transfer size is wrong.\n");
1674  // e.g. a[0:3]:[3] = b[0:2] is NG, but a[0:3]:[3] = b[0:1] is OK.
1675  }
1676 
1677  int target_rank = 0;
1678  for(int i=0;i<_image_dims;i++)
1679  target_rank += ((_XMP_coarray_t*)remote_coarray)->distance_of_image_elmts[i] * _image_num[i];
1680  check_target_rank(target_rank);
1681 
1682  for(int i=0;i<_coarray_dims;i++){
1683  _coarray[i].elmts = ((_XMP_coarray_t*)remote_coarray)->coarray_elmts[i];
1684  _coarray[i].distance = ((_XMP_coarray_t*)remote_coarray)->distance_of_coarray_elmts[i];
1685  }
1686 
1687  int remote_coarray_is_contiguous = _check_contiguous(_coarray, _coarray_dims, _transfer_coarray_elmts);
1688  int local_array_is_contiguous = _check_contiguous(_array, _array_dims, _transfer_array_elmts);
1689 
1690  if(target_rank == _XMP_world_rank){
1691  _XMP_fatal("_XMP_coarray_put_acc: local_put is unimplemented");
1692  /* _XMP_local_put(remote_coarray, local_array, remote_coarray_is_contiguous, local_array_is_contiguous, */
1693  /* _coarray_dims, _array_dims, _coarray, _array, _transfer_coarray_elmts, _transfer_array_elmts); */
1694  }
1695  else{
1696 #ifdef _XMP_GASNET
1697  _XMP_gasnet_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1698  _coarray, _array, remote_coarray, local_array, _transfer_coarray_elmts, _transfer_array_elmts);
1699 #elif _XMP_FJRDMA
1700  _XMP_fjrdma_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1701  _coarray, _array, remote_coarray, local_coarray, local_array, _transfer_coarray_elmts, _transfer_array_elmts);
1702 #elif _XMP_UTOFU
1703  _XMP_utofu_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1704  _coarray, _array, remote_coarray, local_coarray, local_array, _transfer_coarray_elmts, _transfer_array_elmts);
1705 #elif _XMP_MPI3_ONESIDED
1706  _XMP_mpi_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1707  _coarray, _array, remote_coarray, local_array, _transfer_coarray_elmts, _transfer_array_elmts,
1708  is_remote_on_acc);
1709 #endif
1710  }
1711 
1712  free(_coarray);
1713  free(_array);
1714  free(_image_num);
1715 }

◆ _XMP_coarray_rdma_array_set_1()

void _XMP_coarray_rdma_array_set_1 ( const long  start1,
const long  length1,
const long  stride1,
const long  elmts1,
const size_t  elmt 
)

Set transfer 1-dim array information.

657 {
658  _transfer_array_elmts = length1;
659  _array_dims = 1;
660  _array = malloc(sizeof(_XMP_array_section_t) * _array_dims);
661 
662  _array[0].start = start1;
663  _array[0].length = length1;
664  _array[0].stride = ((length1 == 1)? 1 : stride1);
665  _array[0].elmts = elmts1;
666  _array[0].distance = (long)elmt;
667 }

◆ _XMP_coarray_rdma_array_set_2()

void _XMP_coarray_rdma_array_set_2 ( const long  start1,
const long  length1,
const long  stride1,
const long  elmts1,
const long  start2,
const long  length2,
const long  stride2,
const long  elmts2,
const size_t  elmt 
)

Set transfer 2-dim array information.

675 {
676  _transfer_array_elmts = length1 * length2;
677  _array_dims = 2;
678  _array = malloc(sizeof(_XMP_array_section_t) * _array_dims);
679 
680  _array[0].start = start1;
681  _array[0].length = length1;
682  _array[0].stride = ((length1 == 1)? 1 : stride1);
683  _array[0].elmts = elmts1;
684  _array[0].distance = elmts2 * (long)elmt;
685 
686  _array[1].start = start2;
687  _array[1].length = length2;
688  _array[1].stride = ((length2 == 1)? 1 : stride2);
689  _array[1].elmts = elmts2;
690  _array[1].distance = (long)elmt;
691 }

◆ _XMP_coarray_rdma_array_set_3()

void _XMP_coarray_rdma_array_set_3 ( const long  start1,
const long  length1,
const long  stride1,
const long  elmts1,
const long  start2,
const long  length2,
const long  stride2,
const long  elmts2,
const long  start3,
const long  length3,
const long  stride3,
const long  elmts3,
const size_t  elmt 
)

Set transfer 3-dim array information.

700 {
701  _transfer_array_elmts = length1 * length2 * length3;
702  _array_dims = 3;
703  _array = malloc(sizeof(_XMP_array_section_t) * _array_dims);
704 
705  _array[0].start = start1;
706  _array[0].length = length1;
707  _array[0].stride = ((length1 == 1)? 1 : stride1);
708  _array[0].elmts = elmts1;
709  _array[0].distance = elmts2 * elmts3 * (long)elmt;
710 
711  _array[1].start = start2;
712  _array[1].length = length2;
713  _array[1].stride = ((length2 == 1)? 1 : stride2);
714  _array[1].elmts = elmts2;
715  _array[1].distance = elmts3 * (long)elmt;
716 
717  _array[2].start = start3;
718  _array[2].length = length3;
719  _array[2].stride = ((length3 == 1)? 1 : stride3);
720  _array[2].elmts = elmts3;
721  _array[2].distance = (long)elmt;
722 }

◆ _XMP_coarray_rdma_array_set_4()

void _XMP_coarray_rdma_array_set_4 ( const long  start1,
const long  length1,
const long  stride1,
const long  elmts1,
const long  start2,
const long  length2,
const long  stride2,
const long  elmts2,
const long  start3,
const long  length3,
const long  stride3,
const long  elmts3,
const long  start4,
const long  length4,
const long  stride4,
const long  elmts4,
const size_t  elmt 
)

Set transfer 4-dim array information.

732 {
733  _transfer_array_elmts = length1 * length2 * length3 * length4;
734  _array_dims = 4;
735  _array = malloc(sizeof(_XMP_array_section_t) * _array_dims);
736 
737  _array[0].start = start1;
738  _array[0].length = length1;
739  _array[0].stride = ((length1 == 1)? 1 : stride1);
740  _array[0].elmts = elmts1;
741  _array[0].distance = elmts2 * elmts3 * elmts4 * (long)elmt;
742 
743  _array[1].start = start2;
744  _array[1].length = length2;
745  _array[1].stride = ((length2 == 1)? 1 : stride2);
746  _array[1].elmts = elmts2;
747  _array[1].distance = elmts3 * elmts4 * (long)elmt;
748 
749  _array[2].start = start3;
750  _array[2].length = length3;
751  _array[2].stride = ((length3 == 1)? 1 : stride3);
752  _array[2].elmts = elmts3;
753  _array[2].distance = elmts4 * (long)elmt;
754 
755  _array[3].start = start4;
756  _array[3].length = length4;
757  _array[3].stride = ((length4 == 1)? 1 : stride4);
758  _array[3].elmts = elmts4;
759  _array[3].distance = (long)elmt;
760 }

◆ _XMP_coarray_rdma_array_set_5()

void _XMP_coarray_rdma_array_set_5 ( const long  start1,
const long  length1,
const long  stride1,
const long  elmts1,
const long  start2,
const long  length2,
const long  stride2,
const long  elmts2,
const long  start3,
const long  length3,
const long  stride3,
const long  elmts3,
const long  start4,
const long  length4,
const long  stride4,
const long  elmts4,
const long  start5,
const long  length5,
const long  stride5,
const long  elmts5,
const size_t  elmt 
)

Set transfer 5-dim array information.

771 {
772  _transfer_array_elmts = length1 * length2 * length3 * length4 * length5;
773  _array_dims = 5;
774  _array = malloc(sizeof(_XMP_array_section_t) * _array_dims);
775 
776  _array[0].start = start1;
777  _array[0].length = length1;
778  _array[0].stride = ((length1 == 1)? 1 : stride1);
779  _array[0].elmts = elmts1;
780  _array[0].distance = elmts2 * elmts3 * elmts4 * elmts5 * (long)elmt;
781 
782  _array[1].start = start2;
783  _array[1].length = length2;
784  _array[1].stride = ((length2 == 1)? 1 : stride2);
785  _array[1].elmts = elmts2;
786  _array[1].distance = elmts3 * elmts4 * elmts5 * (long)elmt;
787 
788  _array[2].start = start3;
789  _array[2].length = length3;
790  _array[2].stride = ((length3 == 1)? 1 : stride3);
791  _array[2].elmts = elmts3;
792  _array[2].distance = elmts4 * elmts5 * (long)elmt;
793 
794  _array[3].start = start4;
795  _array[3].length = length4;
796  _array[3].stride = ((length4 == 1)? 1 : stride4);
797  _array[3].elmts = elmts4;
798  _array[3].distance = elmts5 * (long)elmt;
799 
800  _array[4].start = start5;
801  _array[4].length = length5;
802  _array[4].stride = ((length5 == 1)? 1 : stride5);
803  _array[4].elmts = elmts5;
804  _array[4].distance = (long)elmt;
805 }

◆ _XMP_coarray_rdma_array_set_6()

void _XMP_coarray_rdma_array_set_6 ( const long  start1,
const long  length1,
const long  stride1,
const long  elmts1,
const long  start2,
const long  length2,
const long  stride2,
const long  elmts2,
const long  start3,
const long  length3,
const long  stride3,
const long  elmts3,
const long  start4,
const long  length4,
const long  stride4,
const long  elmts4,
const long  start5,
const long  length5,
const long  stride5,
const long  elmts5,
const long  start6,
const long  length6,
const long  stride6,
const long  elmts6,
const size_t  elmt 
)

Set transfer 6-dim array information.

817 {
818  _transfer_array_elmts = length1 * length2 * length3 * length4 * length5 * length6;
819  _array_dims = 6;
820  _array = malloc(sizeof(_XMP_array_section_t) * _array_dims);
821 
822  _array[0].start = start1;
823  _array[0].length = length1;
824  _array[0].stride = ((length1 == 1)? 1 : stride1);
825  _array[0].elmts = elmts1;
826  _array[0].distance = elmts2 * elmts3 * elmts4 * elmts5 * elmts6 * (long)elmt;
827 
828  _array[1].start = start2;
829  _array[1].length = length2;
830  _array[1].stride = ((length2 == 1)? 1 : stride2);
831  _array[1].elmts = elmts2;
832  _array[1].distance = elmts3 * elmts4 * elmts5 * elmts6 * (long)elmt;
833 
834  _array[2].start = start3;
835  _array[2].length = length3;
836  _array[2].stride = ((length3 == 1)? 1 : stride3);
837  _array[2].elmts = elmts3;
838  _array[2].distance = elmts4 * elmts5 * elmts6 * (long)elmt;
839 
840  _array[3].start = start4;
841  _array[3].length = length4;
842  _array[3].stride = ((length4 == 1)? 1 : stride4);
843  _array[3].elmts = elmts4;
844  _array[3].distance = elmts5 * elmts6 * (long)elmt;
845 
846  _array[4].start = start5;
847  _array[4].length = length5;
848  _array[4].stride = ((length5 == 1)? 1 : stride5);
849  _array[4].elmts = elmts5;
850  _array[4].distance = elmts6 * (long)elmt;
851 
852  _array[5].start = start6;
853  _array[5].length = length6;
854  _array[5].stride = ((length6 == 1)? 1 : stride6);
855  _array[5].elmts = elmts6;
856  _array[5].distance = (long)elmt;
857 }

◆ _XMP_coarray_rdma_array_set_7()

void _XMP_coarray_rdma_array_set_7 ( const long  start1,
const long  length1,
const long  stride1,
const long  elmts1,
const long  start2,
const long  length2,
const long  stride2,
const long  elmts2,
const long  start3,
const long  length3,
const long  stride3,
const long  elmts3,
const long  start4,
const long  length4,
const long  stride4,
const long  elmts4,
const long  start5,
const long  length5,
const long  stride5,
const long  elmts5,
const long  start6,
const long  length6,
const long  stride6,
const long  elmts6,
const long  start7,
const long  length7,
const long  stride7,
const long  elmts7,
const size_t  elmt 
)

Set transfer 7-dim array information.

870 {
871  _transfer_array_elmts = length1 * length2 * length3 * length4 * length5 * length6 * length7;
872  _array_dims = 7;
873  _array = malloc(sizeof(_XMP_array_section_t) * _array_dims);
874 
875  _array[0].start = start1;
876  _array[0].length = length1;
877  _array[0].stride = ((length1 == 1)? 1 : stride1);
878  _array[0].elmts = elmts1;
879  _array[0].distance = elmts2 * elmts3 * elmts4 * elmts5 * elmts6 * elmts7 * (long)elmt;
880 
881  _array[1].start = start2;
882  _array[1].length = length2;
883  _array[1].stride = ((length2 == 1)? 1 : stride2);
884  _array[1].elmts = elmts2;
885  _array[1].distance = elmts3 * elmts4 * elmts5 * elmts6 * elmts7 * (long)elmt;
886 
887  _array[2].start = start3;
888  _array[2].length = length3;
889  _array[2].stride = ((length3 == 1)? 1 : stride3);
890  _array[2].elmts = elmts3;
891  _array[2].distance = elmts4 * elmts5 * elmts6 * elmts7 * (long)elmt;
892 
893  _array[3].start = start4;
894  _array[3].length = length4;
895  _array[3].stride = ((length4 == 1)? 1 : stride4);
896  _array[3].elmts = elmts4;
897  _array[3].distance = elmts5 * elmts6 * elmts7 * (long)elmt;
898 
899  _array[4].start = start5;
900  _array[4].length = length5;
901  _array[4].stride = ((length5 == 1)? 1 : stride5);
902  _array[4].elmts = elmts5;
903  _array[4].distance = elmts6 * elmts7 * (long)elmt;
904 
905  _array[5].start = start6;
906  _array[5].length = length6;
907  _array[5].stride = ((length6 == 1)? 1 : stride6);
908  _array[5].elmts = elmts6;
909  _array[5].distance = elmts7 * (long)elmt;
910 
911  _array[6].start = start7;
912  _array[6].length = length7;
913  _array[6].stride = ((length7 == 1)? 1 : stride7);
914  _array[6].elmts = elmts7;
915  _array[6].distance = (long)elmt;
916 }

◆ _XMP_coarray_rdma_array_set_n()

void _XMP_coarray_rdma_array_set_n ( const int  n,
const long  start[],
const long  length[],
const long  stride[],
const long  elmts[],
const long  distance[] 
)

Set transfer n-dim array information.

924 {
925  _transfer_array_elmts = 1;
926  _array_dims = n;
927  _array = malloc(sizeof(_XMP_array_section_t) * _array_dims);
928 
929  for (int i = 0; i < n; i++){
930  _transfer_array_elmts *= length[i];
931  _array[i].start = start[i];
932  _array[i].length = length[i];
933  _array[i].stride = ((length[i] == 1)? 1 : stride[i]);
934  _array[i].elmts = elmts[i];
935  _array[i].distance = distance[i];
936  }
937 }

◆ _XMP_coarray_rdma_coarray_set_1()

void _XMP_coarray_rdma_coarray_set_1 ( const long  start1,
const long  length1,
const long  stride1 
)

Set transfer 1-dim coarray information.

435 {
436  _transfer_coarray_elmts = length1;
437  _coarray_dims = 1;
438  _coarray = malloc(sizeof(_XMP_array_section_t) * _coarray_dims);
439 
440  _coarray[0].start = start1;
441  _coarray[0].length = length1;
442  _coarray[0].stride = ((length1 == 1)? 1 : stride1);
443 }

◆ _XMP_coarray_rdma_coarray_set_2()

void _XMP_coarray_rdma_coarray_set_2 ( const long  start1,
const long  length1,
const long  stride1,
const long  start2,
const long  length2,
const long  stride2 
)

Set transfer 2-dim coarray information.

450 {
451  _transfer_coarray_elmts = length1 * length2;
452  _coarray_dims = 2;
453  _coarray = malloc(sizeof(_XMP_array_section_t) * _coarray_dims);
454 
455  _coarray[0].start = start1;
456  _coarray[0].length = length1;
457  _coarray[0].stride = ((length1 == 1)? 1 : stride1);
458 
459  _coarray[1].start = start2;
460  _coarray[1].length = length2;
461  _coarray[1].stride = ((length2 == 1)? 1 : stride2);
462 }

◆ _XMP_coarray_rdma_coarray_set_3()

void _XMP_coarray_rdma_coarray_set_3 ( const long  start1,
const long  length1,
const long  stride1,
const long  start2,
const long  length2,
const long  stride2,
const long  start3,
const long  length3,
const long  stride3 
)

Set transfer 3-dim coarray information.

470 {
471  _transfer_coarray_elmts = length1 * length2 * length3;
472  _coarray_dims = 3;
473  _coarray = malloc(sizeof(_XMP_array_section_t) * _coarray_dims);
474 
475  _coarray[0].start = start1;
476  _coarray[0].length = length1;
477  _coarray[0].stride = ((length1 == 1)? 1 : stride1);
478 
479  _coarray[1].start = start2;
480  _coarray[1].length = length2;
481  _coarray[1].stride = ((length2 == 1)? 1 : stride2);
482 
483  _coarray[2].start = start3;
484  _coarray[2].length = length3;
485  _coarray[2].stride = ((length3 == 1)? 1 : stride3);
486 }

◆ _XMP_coarray_rdma_coarray_set_4()

void _XMP_coarray_rdma_coarray_set_4 ( const long  start1,
const long  length1,
const long  stride1,
const long  start2,
const long  length2,
const long  stride2,
const long  start3,
const long  length3,
const long  stride3,
const long  start4,
const long  length4,
const long  stride4 
)

Set transfer 4-dim coarray information.

495 {
496  _transfer_coarray_elmts = length1 * length2 * length3 * length4;
497  _coarray_dims = 4;
498  _coarray = malloc(sizeof(_XMP_array_section_t) * _coarray_dims);
499 
500  _coarray[0].start = start1;
501  _coarray[0].length = length1;
502  _coarray[0].stride = ((length1 == 1)? 1 : stride1);
503 
504  _coarray[1].start = start2;
505  _coarray[1].length = length2;
506  _coarray[1].stride = ((length2 == 1)? 1 : stride2);
507 
508  _coarray[2].start = start3;
509  _coarray[2].length = length3;
510  _coarray[2].stride = ((length3 == 1)? 1 : stride3);
511 
512  _coarray[3].start = start4;
513  _coarray[3].length = length4;
514  _coarray[3].stride = ((length4 == 1)? 1 : stride4);
515 }

◆ _XMP_coarray_rdma_coarray_set_5()

void _XMP_coarray_rdma_coarray_set_5 ( const long  start1,
const long  length1,
const long  stride1,
const long  start2,
const long  length2,
const long  stride2,
const long  start3,
const long  length3,
const long  stride3,
const long  start4,
const long  length4,
const long  stride4,
const long  start5,
const long  length5,
const long  stride5 
)

Set transfer 5-dim coarray information.

525 {
526  _transfer_coarray_elmts = length1 * length2 * length3 * length4 * length5;
527  _coarray_dims = 5;
528  _coarray = malloc(sizeof(_XMP_array_section_t) * _coarray_dims);
529 
530  _coarray[0].start = start1;
531  _coarray[0].length = length1;
532  _coarray[0].stride = ((length1 == 1)? 1 : stride1);
533 
534  _coarray[1].start = start2;
535  _coarray[1].length = length2;
536  _coarray[1].stride = ((length2 == 1)? 1 : stride2);
537 
538  _coarray[2].start = start3;
539  _coarray[2].length = length3;
540  _coarray[2].stride = ((length3 == 1)? 1 : stride3);
541 
542  _coarray[3].start = start4;
543  _coarray[3].length = length4;
544  _coarray[3].stride = ((length4 == 1)? 1 : stride4);
545 
546  _coarray[4].start = start5;
547  _coarray[4].length = length5;
548  _coarray[4].stride = ((length5 == 1)? 1 : stride5);
549 }

◆ _XMP_coarray_rdma_coarray_set_6()

void _XMP_coarray_rdma_coarray_set_6 ( const long  start1,
const long  length1,
const long  stride1,
const long  start2,
const long  length2,
const long  stride2,
const long  start3,
const long  length3,
const long  stride3,
const long  start4,
const long  length4,
const long  stride4,
const long  start5,
const long  length5,
const long  stride5,
const long  start6,
const long  length6,
const long  stride6 
)

Set transfer 6-dim coarray information.

560 {
561  _transfer_coarray_elmts = length1 * length2 * length3 * length4 * length5 * length6;
562  _coarray_dims = 6;
563  _coarray = malloc(sizeof(_XMP_array_section_t) * _coarray_dims);
564 
565  _coarray[0].start = start1;
566  _coarray[0].length = length1;
567  _coarray[0].stride = ((length1 == 1)? 1 : stride1);
568 
569  _coarray[1].start = start2;
570  _coarray[1].length = length2;
571  _coarray[1].stride = ((length2 == 1)? 1 : stride2);
572 
573  _coarray[2].start = start3;
574  _coarray[2].length = length3;
575  _coarray[2].stride = ((length3 == 1)? 1 : stride3);
576 
577  _coarray[3].start = start4;
578  _coarray[3].length = length4;
579  _coarray[3].stride = ((length4 == 1)? 1 : stride4);
580 
581  _coarray[4].start = start5;
582  _coarray[4].length = length5;
583  _coarray[4].stride = ((length5 == 1)? 1 : stride5);
584 
585  _coarray[5].start = start6;
586  _coarray[5].length = length6;
587  _coarray[5].stride = ((length6 == 1)? 1 : stride6);
588 }

◆ _XMP_coarray_rdma_coarray_set_7()

void _XMP_coarray_rdma_coarray_set_7 ( const long  start1,
const long  length1,
const long  stride1,
const long  start2,
const long  length2,
const long  stride2,
const long  start3,
const long  length3,
const long  stride3,
const long  start4,
const long  length4,
const long  stride4,
const long  start5,
const long  length5,
const long  stride5,
const long  start6,
const long  length6,
const long  stride6,
const long  start7,
const long  length7,
const long  stride7 
)

Set transfer 7-dim coarray information.

600 {
601  _transfer_coarray_elmts = length1 * length2 * length3 * length4 * length5 * length6 * length7;
602  _coarray_dims = 7;
603  _coarray = malloc(sizeof(_XMP_array_section_t) * _coarray_dims);
604 
605  _coarray[0].start = start1;
606  _coarray[0].length = length1;
607  _coarray[0].stride = ((length1 == 1)? 1 : stride1);
608 
609  _coarray[1].start = start2;
610  _coarray[1].length = length2;
611  _coarray[1].stride = ((length2 == 1)? 1 : stride2);
612 
613  _coarray[2].start = start3;
614  _coarray[2].length = length3;
615  _coarray[2].stride = ((length3 == 1)? 1 : stride3);
616 
617  _coarray[3].start = start4;
618  _coarray[3].length = length4;
619  _coarray[3].stride = ((length4 == 1)? 1 : stride4);
620 
621  _coarray[4].start = start5;
622  _coarray[4].length = length5;
623  _coarray[4].stride = ((length5 == 1)? 1 : stride5);
624 
625  _coarray[5].start = start6;
626  _coarray[5].length = length6;
627  _coarray[5].stride = ((length6 == 1)? 1 : stride6);
628 
629  _coarray[6].start = start7;
630  _coarray[6].length = length7;
631  _coarray[6].stride = ((length7 == 1)? 1 : stride7);
632 }

◆ _XMP_coarray_rdma_coarray_set_n()

void _XMP_coarray_rdma_coarray_set_n ( const int  n,
const long  start[],
const long  length[],
const long  stride[] 
)

Set transfer n-dim coarray information.

639 {
640  _transfer_coarray_elmts = 1;
641  _coarray_dims = n;
642  _coarray = malloc(sizeof(_XMP_array_section_t) * _coarray_dims);
643 
644  for (int i = 0; i < n; i++){
645  _transfer_coarray_elmts *= length[i];
646  _coarray[i].start = start[i];
647  _coarray[i].length = length[i];
648  _coarray[i].stride = ((length[i] == 1)? 1 : stride[i]);
649  }
650 }

◆ _XMP_coarray_rdma_do2()

void _XMP_coarray_rdma_do2 ( const int  rdma_code,
void *  remote_coarray,
void *  local_array,
void *  local_coarray,
const long  coarray_elmts[],
const long  coarray_distance[] 
)
1280 {
1281  if(_transfer_coarray_elmts == 0 || _transfer_array_elmts == 0) return;
1282 
1283  if(rdma_code == _XMP_N_COARRAY_GET){
1284  if(_transfer_coarray_elmts != _transfer_array_elmts && _transfer_coarray_elmts != 1)
1285  _XMP_fatal("Coarray Error ! transfer size is wrong.\n") ;
1286  // e.g. a[0:3] = b[0:2]:[3] is NG, but a[0:3] = b[0:1]:[3] is OK
1287  }
1288  else if(rdma_code == _XMP_N_COARRAY_PUT){
1289  if(_transfer_coarray_elmts != _transfer_array_elmts && _transfer_array_elmts != 1)
1290  _XMP_fatal("Coarray Error ! transfer size is wrong.\n");
1291  // e.g. a[0:3]:[3] = b[0:2] is NG, but a[0:3]:[3] = b[0:1] is OK.
1292  }
1293 
1294  int target_rank = 0;
1295  for(int i=0;i<_image_dims;i++)
1296  target_rank += ((_XMP_coarray_t*)remote_coarray)->distance_of_image_elmts[i] * _image_num[i];
1297 
1298  check_target_rank(target_rank);
1299 
1300  for(int i=0;i<_coarray_dims;i++){
1301  _coarray[i].elmts = coarray_elmts[i];
1302  _coarray[i].distance = coarray_distance[i];
1303  }
1304 
1305  int remote_coarray_is_contiguous = _check_contiguous(_coarray, _coarray_dims, _transfer_coarray_elmts);
1306  int local_array_is_contiguous = _check_contiguous(_array, _array_dims, _transfer_array_elmts);
1307 
1308  // _XMP_local_put(), _XMP_gasnet_put(), ... don't support to transfer long data size now.
1309  // _XMP_check_less_than_SIZE_MAX() checks whether the trasfer size is less than SIZE_MAX, defined in <limits.h>.
1310  size_t elmt_size = ((_XMP_coarray_t*)remote_coarray)->elmt_size;
1311  _XMP_check_less_than_SIZE_MAX(_transfer_coarray_elmts*elmt_size); // fix me
1312  _XMP_check_less_than_SIZE_MAX(_transfer_array_elmts*elmt_size); // fix me
1313 
1314  if(rdma_code == _XMP_N_COARRAY_PUT){
1315  if(target_rank == _XMP_world_rank){
1316  _XMP_local_put(remote_coarray, local_array, remote_coarray_is_contiguous, local_array_is_contiguous,
1317  _coarray_dims, _array_dims, _coarray, _array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1318  }
1319  else{
1320 #ifdef _XMP_GASNET
1321  _XMP_gasnet_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1322  _coarray, _array, remote_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1323 #elif _XMP_FJRDMA
1324  _XMP_fjrdma_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1325  _coarray, _array, remote_coarray, local_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1326 #elif _XMP_UTOFU
1327  _XMP_utofu_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1328  _coarray, _array, remote_coarray, local_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1329 #elif _XMP_MPI3_ONESIDED
1330  _XMP_mpi_put(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1331  _coarray, _array, remote_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts,
1333 #endif
1334  }
1335  }
1336  else if(rdma_code == _XMP_N_COARRAY_GET){
1337  if(target_rank == _XMP_world_rank){
1338  _XMP_local_get(local_array, remote_coarray, local_array_is_contiguous, remote_coarray_is_contiguous,
1339  _array_dims, _coarray_dims, _array, _coarray, (size_t)_transfer_array_elmts, (size_t)_transfer_coarray_elmts);
1340  }
1341  else{
1342 #ifdef _XMP_GASNET
1343  _XMP_gasnet_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank,
1344  _coarray_dims, _array_dims, _coarray, _array, remote_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1345 #elif _XMP_FJRDMA
1346  _XMP_fjrdma_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1347  _coarray, _array, remote_coarray, local_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1348 #elif _XMP_UTOFU
1349  _XMP_utofu_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1350  _coarray, _array, remote_coarray, local_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts);
1351 #elif _XMP_MPI3_ONESIDED
1352  _XMP_mpi_get(remote_coarray_is_contiguous, local_array_is_contiguous, target_rank, _coarray_dims, _array_dims,
1353  _coarray, _array, remote_coarray, local_array, (size_t)_transfer_coarray_elmts, (size_t)_transfer_array_elmts,
1355 #endif
1356  }
1357  }
1358  else{
1359  _XMP_fatal("Unexpected Operation !!");
1360  }
1361 
1362  free(_coarray);
1363  free(_array);
1364  free(_image_num);
1365 }

◆ _XMP_coarray_rdma_image_set_1()

void _XMP_coarray_rdma_image_set_1 ( const int  n1)

Set 1-dim image information.

943 {
944  _image_dims = 1;
945  _image_num = malloc(sizeof(int) * _image_dims);
946  _image_num[0] = n1;
947 }

◆ _XMP_coarray_rdma_image_set_2()

void _XMP_coarray_rdma_image_set_2 ( const int  n1,
const int  n2 
)

Set 2-dim image information.

953 {
954  _image_dims = 2;
955  _image_num = malloc(sizeof(int) * _image_dims);
956  _image_num[0] = n1;
957  _image_num[1] = n2;
958 }

◆ _XMP_coarray_rdma_image_set_3()

void _XMP_coarray_rdma_image_set_3 ( const int  n1,
const int  n2,
const int  n3 
)

Set 3-dim image information.

964 {
965  _image_dims = 3;
966  _image_num = malloc(sizeof(int) * _image_dims);
967  _image_num[0] = n1;
968  _image_num[1] = n2;
969  _image_num[2] = n3;
970 }

◆ _XMP_coarray_rdma_image_set_4()

void _XMP_coarray_rdma_image_set_4 ( const int  n1,
const int  n2,
const int  n3,
const int  n4 
)

Set 4-dim image information.

976 {
977  _image_dims = 4;
978  _image_num = malloc(sizeof(int) * _image_dims);
979  _image_num[0] = n1;
980  _image_num[1] = n2;
981  _image_num[2] = n3;
982  _image_num[3] = n4;
983 }

◆ _XMP_coarray_rdma_image_set_5()

void _XMP_coarray_rdma_image_set_5 ( const int  n1,
const int  n2,
const int  n3,
const int  n4,
const int  n5 
)

Set 5-dim image information.

990 {
991  _image_dims = 5;
992  _image_num = malloc(sizeof(int) * _image_dims);
993  _image_num[0] = n1;
994  _image_num[1] = n2;
995  _image_num[2] = n3;
996  _image_num[3] = n4;
997  _image_num[4] = n5;
998 }

◆ _XMP_coarray_rdma_image_set_6()

void _XMP_coarray_rdma_image_set_6 ( const int  n1,
const int  n2,
const int  n3,
const int  n4,
const int  n5,
const int  n6 
)

Set 6-dim image information.

1005 {
1006  _image_dims = 6;
1007  _image_num = malloc(sizeof(int) * _image_dims);
1008  _image_num[0] = n1;
1009  _image_num[1] = n2;
1010  _image_num[2] = n3;
1011  _image_num[3] = n4;
1012  _image_num[4] = n5;
1013  _image_num[5] = n6;
1014 }

◆ _XMP_coarray_rdma_image_set_7()

void _XMP_coarray_rdma_image_set_7 ( const int  n1,
const int  n2,
const int  n3,
const int  n4,
const int  n5,
const int  n6,
const int  n7 
)

Set 7-dim image information.

1021 {
1022  _image_dims = 7;
1023  _image_num = malloc(sizeof(int) * _image_dims);
1024  _image_num[0] = n1;
1025  _image_num[1] = n2;
1026  _image_num[2] = n3;
1027  _image_num[3] = n4;
1028  _image_num[4] = n5;
1029  _image_num[5] = n6;
1030  _image_num[6] = n7;
1031 }

◆ _XMP_coarray_rdma_image_set_n()

void _XMP_coarray_rdma_image_set_n ( const int  ndims,
const int  n[] 
)

Set n-dim image information.

1037 {
1038  _image_dims = ndims;
1039  _image_num = malloc(sizeof(int) * _image_dims);
1040 
1041  for (int i = 0; i < ndims; i++){
1042  _image_num[i] = n[i];
1043  }
1044 }

◆ _XMP_coarray_regmem()

void _XMP_coarray_regmem ( void **  coarray_desc,
void *  addr 
)

Create coarray object but not allocate coarray.

360 {
363  *coarray_desc = c;
364 
365  long transfer_size = _total_coarray_elmts*_elmt_size;
366  _XMP_check_less_than_SIZE_MAX(transfer_size);
367 
368 #if _XMP_GASNET
369  //not implemented
370  _XMP_fatal("_XMP_coarray_regmem_do is not supported over GASNet.\n");
371 #elif _XMP_FJRDMA
372  _XMP_fjrdma_regmem(*coarray_desc, addr, (size_t)transfer_size);
373 #elif _XMP_UTOFU
374  _XMP_utofu_regmem(*coarray_desc, addr, (size_t)transfer_size);
375 #elif _XMP_MPI3_ONESIDED
376  _XMP_mpi_coarray_regmem(*coarray_desc, addr, (size_t)transfer_size, false);
377 #endif
378 
379  _push_coarray_queue(c);
380 }
Here is the call graph for this function:

◆ _XMP_coarray_set_info()

void _XMP_coarray_set_info ( _XMP_coarray_t c)
298 {
299  long *distance_of_coarray_elmts = _XMP_alloc(sizeof(long) * _coarray_dims);
300 
301  for(int i=0;i<_coarray_dims-1;i++){
302  long distance = 1;
303  for(int j=i+1;j<_coarray_dims;j++){
304  distance *= _coarray_elmts[j];
305  }
306  distance_of_coarray_elmts[i] = distance * _elmt_size;
307  }
308  distance_of_coarray_elmts[_coarray_dims-1] = _elmt_size;
309 
310  int *distance_of_image_elmts = _XMP_alloc(sizeof(int) * _image_dims);
311  for(int i=_image_dims-1;i>=1;i--){
312  int distance = 1;
313  for(int j=0;j<i;j++){
314  distance *= _image_elmts[j];
315  }
316  distance_of_image_elmts[i] = distance;
317  }
318  distance_of_image_elmts[0] = 1;
319 
320  c->elmt_size = _elmt_size;
321  c->coarray_dims = _coarray_dims;
322  c->coarray_elmts = _coarray_elmts;
323  c->image_dims = _image_dims;
324  c->distance_of_coarray_elmts = distance_of_coarray_elmts;
325  c->distance_of_image_elmts = distance_of_image_elmts;
326 
327  free(_image_elmts); // Note: Do not free() _coarray_elmts.
328 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _XMP_coarray_sync_all()

void _XMP_coarray_sync_all ( )

Execute sync_all()

1372 {
1373 #ifdef _XMP_GASNET
1375 #elif _XMP_FJRDMA
1377 #elif _XMP_UTOFU
1379 #elif _XMP_MPI3_ONESIDED
1381 #endif
1382 }
Here is the call graph for this function:

◆ _XMP_coarray_sync_memory()

void _XMP_coarray_sync_memory ( )

Execute sync_memory()

1388 {
1389 #ifdef _XMP_GASNET
1391 #elif _XMP_FJRDMA
1393 #elif _XMP_UTOFU
1395 #elif _XMP_TCA
1397 #elif _XMP_MPI3_ONESIDED
1399 #endif
1400 }
Here is the call graph for this function:

◆ xmp_sync_all()

void xmp_sync_all ( const int *  status)

Execute sync_all()

1424 {
1425 #ifdef _XMP_GASNET
1427 #elif _XMP_FJRDMA
1429 #elif _XMP_UTOFU
1431 #elif _XMP_MPI3_ONESIDED
1433 #endif
1434 }
Here is the call graph for this function:

◆ xmp_sync_image()

void xmp_sync_image ( int  image,
int *  status 
)

Execute sync_image()

1456 {
1457  xmp_sync_images(1, &image, status);
1458 }
Here is the call graph for this function:

◆ xmp_sync_images()

void xmp_sync_images ( const int  num,
int *  image_set,
int *  status 
)

Execute sync_images()

1440 {
1441 #ifdef _XMP_GASNET
1442  _XMP_gasnet_sync_images(num, image_set, status);
1443 #elif _XMP_FJRDMA
1444  _XMP_fjrdma_sync_images(num, image_set, status);
1445 #elif _XMP_UTOFU
1446  _XMP_utofu_sync_images(num, image_set, status);
1447 #elif _XMP_MPI3_ONESIDED
1448  _XMP_mpi_sync_images(num, image_set, status);
1449 #endif
1450 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xmp_sync_images_all()

void xmp_sync_images_all ( int *  status)

Execute sync_images_all()

1464 {
1465  _XMP_fatal("Not implement xmp_sync_images_all()");
1466 }
Here is the call graph for this function:

◆ xmp_sync_memory()

void xmp_sync_memory ( const int *  status)

Execute sync_memory()

1406 {
1407 #ifdef _XMP_GASNET
1409 #elif _XMP_FJRDMA
1411 #elif _XMP_UTOFU
1413 #elif _XMP_TCA
1415 #elif _XMP_MPI3_ONESIDED
1417 #endif
1418 }
Here is the call graph for this function:

Variable Documentation

◆ _XMP_flag_multi_win

int _XMP_flag_multi_win
_XMP_utofu_sync_all
void _XMP_utofu_sync_all(void)
Definition: xmp_coarray_utofu.c:975
_XMP_gasnet_sync_memory
void _XMP_gasnet_sync_memory()
Execute sync_memory.
Definition: xmp_coarray_gasnet.c:830
_XMP_utofu_coarray_malloc
void _XMP_utofu_coarray_malloc(_XMP_coarray_t *coarray_desc, void **addr, const size_t coarray_size)
Definition: xmp_coarray_utofu.c:232
_XMP_fjrdma_sync_all
void _XMP_fjrdma_sync_all()
Execute sync_all.
Definition: xmp_coarray_fjrdma.c:1350
_XMP_utofu_contiguous_put
void _XMP_utofu_contiguous_put(const int target_rank, const uint64_t dst_offset, const uint64_t src_offset, const _XMP_coarray_t *dst_desc, const _XMP_coarray_t *src_desc, const size_t dst_elmts, const size_t src_elmts, const size_t elmt_size)
Definition: xmp_coarray_utofu.c:444
xmp_coarray::distance_of_coarray_elmts
long * distance_of_coarray_elmts
Definition: xmp_data_struct.h:349
_XMP_utofu_sync_memory
void _XMP_utofu_sync_memory(void)
Definition: xmp_coarray_utofu.c:960
_XMP_fjrdma_sync_memory
void _XMP_fjrdma_sync_memory()
Execute sync_memory.
Definition: xmp_coarray_fjrdma.c:1338
xmp_coarray::addr
char ** addr
Definition: xmp_data_struct.h:329
_XMP_alloc
void * _XMP_alloc(size_t size)
Definition: xmp_util.c:21
_XMP_array_section::length
long length
Definition: xmp_data_struct.h:377
_XMP_gasnet_coarray_malloc
void _XMP_gasnet_coarray_malloc(_XMP_coarray_t *coarray_desc, void **addr, const size_t coarray_size)
Definition: xmp_coarray_gasnet.c:794
_coarray_queue_t::num
int num
How many coarrays are in this queue.
Definition: xmp_coarray.c:20
_XMP_fjrdma_get
void _XMP_fjrdma_get(const int src_contiguous, const int dst_contiguous, const int target_rank, const int src_dims, const int dst_dims, const _XMP_array_section_t *src_info, const _XMP_array_section_t *dst_info, const _XMP_coarray_t *src_desc, const _XMP_coarray_t *dst_desc, void *dst, const size_t src_elmts, const size_t dst_elmts)
Definition: xmp_coarray_fjrdma.c:2114
xmp_coarray::real_addr
char * real_addr
Definition: xmp_data_struct.h:336
_XMP_mpi_coarray_lastly_deallocate
void _XMP_mpi_coarray_lastly_deallocate(bool is_acc)
Deallocate memory region when calling _XMP_coarray_lastly_deallocate()
Definition: xmp_coarray_mpi.c:216
_XMP_utofu_put
void _XMP_utofu_put(const int dst_contiguous, const int src_contiguous, const int target_rank, const int dst_dims, const int src_dims, const _XMP_array_section_t *dst_info, const _XMP_array_section_t *src_info, const _XMP_coarray_t *dst_desc, const _XMP_coarray_t *src_desc, void *src, const size_t dst_elmts, const size_t src_elmts)
Definition: xmp_coarray_utofu.c:625
xmp_coarray::elmt_size
size_t elmt_size
Definition: xmp_data_struct.h:339
xmp_coarray::distance_of_image_elmts
int * distance_of_image_elmts
Definition: xmp_data_struct.h:357
_XMP_mpi_put
void _XMP_mpi_put(const int dst_contiguous, const int src_contiguous, const int org_target_rank, const int dst_dims, const int src_dims, const _XMP_array_section_t *dst_info, const _XMP_array_section_t *src_info, const _XMP_coarray_t *dst_desc, const void *src, const int dst_elmts, const int src_elmts, const int is_dst_on_acc)
Definition: xmp_coarray_mpi.c:424
_XMP_mpi_sync_memory
void _XMP_mpi_sync_memory()
Execute sync_memory.
Definition: xmp_coarray_mpi.c:542
_XMP_mpi_contiguous_put
void _XMP_mpi_contiguous_put(const int org_target_rank, const _XMP_coarray_t *dst_desc, const _XMP_coarray_t *src_desc, const size_t dst_offset, const size_t src_offset, const size_t dst_elmts, const size_t src_elmts, const size_t elmt_size, const bool is_dst_on_acc, const bool is_src_on_acc)
Definition: xmp_coarray_mpi.c:327
_XMP_gasnet_build_sync_images_table
void _XMP_gasnet_build_sync_images_table()
Build table and Initialize for sync images.
Definition: xmp_coarray_gasnet.c:1600
_XMP_gasnet_contiguous_put
void _XMP_gasnet_contiguous_put()
_XMP_mpi_coarray_detach
void _XMP_mpi_coarray_detach(_XMP_coarray_t *coarray_desc, const bool is_acc)
Definition: xmp_coarray_mpi.c:910
_XMP_world_rank
int _XMP_world_rank
Definition: xmp_world.c:9
_XMP_gasnet_coarray_lastly_deallocate
void _XMP_gasnet_coarray_lastly_deallocate()
Deallocate memory region when calling _XMP_coarray_lastly_deallocate()
Definition: xmp_coarray_gasnet.c:784
_XMP_mpi_coarray_malloc
void _XMP_mpi_coarray_malloc(_XMP_coarray_t *coarray_desc, void **addr, const size_t coarray_size, bool is_acc)
Definition: xmp_coarray_mpi.c:237
_XMP_mpi_sync_all
void _XMP_mpi_sync_all()
Execute sync_all.
Definition: xmp_coarray_mpi.c:603
xmp_coarray::coarray_dims
int coarray_dims
Definition: xmp_data_struct.h:342
_XMP_utofu_contiguous_get
void _XMP_utofu_contiguous_get(const int target_rank, const _XMP_coarray_t *dst_desc, const _XMP_coarray_t *src_desc, const uint64_t dst_offset, const uint64_t src_offset, const size_t dst_elmts, const size_t src_elmts, const size_t elmt_size)
Definition: xmp_coarray_utofu.c:729
_XMP_N_INT_FALSE
#define _XMP_N_INT_FALSE
Definition: xmp_constant.h:5
_XMP_local_get
void _XMP_local_get(void *, const _XMP_coarray_t *, const int, const int, const int, const int, const _XMP_array_section_t *, const _XMP_array_section_t *, const size_t, const size_t)
Definition: xmp_coarray_local.c:597
_XMP_array_section::start
long start
Definition: xmp_data_struct.h:376
_XMP_fjrdma_build_sync_images_table
void _XMP_fjrdma_build_sync_images_table()
Build table and Initialize for sync images.
Definition: xmp_coarray_fjrdma.c:2148
_XMP_gasnet_sync_all
void _XMP_gasnet_sync_all()
Execute sync_all.
Definition: xmp_coarray_gasnet.c:846
_XMP_tca_sync_memory
void _XMP_tca_sync_memory()
Execute sync_memory.
Definition: xmp_coarray_tca.c:177
_XMP_mpi_get
void _XMP_mpi_get(const int src_contiguous, const int dst_contiguous, const int org_target_rank, const int src_dims, const int dst_dims, const _XMP_array_section_t *src_info, const _XMP_array_section_t *dst_info, const _XMP_coarray_t *src_desc, void *dst, const int src_elmts, const int dst_elmts, const int is_src_on_acc)
Definition: xmp_coarray_mpi.c:483
_XMP_fjrdma_contiguous_put
void _XMP_fjrdma_contiguous_put(const int target_rank, const uint64_t dst_offset, const uint64_t src_offset, const _XMP_coarray_t *dst_desc, const _XMP_coarray_t *src_desc, const size_t dst_elmts, const size_t src_elmts, const size_t elmt_size)
Definition: xmp_coarray_fjrdma.c:1616
_XMP_gasnet_sync_images
void _XMP_gasnet_sync_images(const int num, int image_set[num], int *status)
Execute sync images.
Definition: xmp_coarray_gasnet.c:1677
_XMP_fjrdma_regmem
void _XMP_fjrdma_regmem(_XMP_coarray_t *coarray_desc, void *addr, const size_t coarray_size)
Definition: xmp_coarray_fjrdma.c:1567
_XMP_N_COARRAY_PUT
#define _XMP_N_COARRAY_PUT
Definition: xmp_constant.h:112
_XMP_mpi_coarray_regmem
void _XMP_mpi_coarray_regmem(_XMP_coarray_t *coarray_desc, void *real_addr, const size_t coarray_size, bool is_acc)
Definition: xmp_coarray_mpi.c:1157
xmp_coarray
Definition: xmp_data_struct.h:328
_XMP_mpi_sync_images
void _XMP_mpi_sync_images(const int num, const int *image_set, int *status)
Execute sync images.
Definition: xmp_coarray_mpi.c:1080
xmp_sync_images
void xmp_sync_images(const int num, int *image_set, int *status)
Execute sync_images()
Definition: xmp_coarray.c:1439
_XMP_mpi_coarray_attach
void _XMP_mpi_coarray_attach(_XMP_coarray_t *coarray_desc, void *addr, const size_t coarray_size, const bool is_acc)
Definition: xmp_coarray_mpi.c:864
_XMP_mpi_contiguous_get
void _XMP_mpi_contiguous_get(const int org_target_rank, const _XMP_coarray_t *dst_desc, const _XMP_coarray_t *src_desc, const size_t dst_offset, const size_t src_offset, const size_t dst_elmts, const size_t src_elmts, const size_t elmt_size, const bool is_dst_on_acc, const bool is_src_on_acc)
Definition: xmp_coarray_mpi.c:377
_XMP_coarray_set_info
void _XMP_coarray_set_info(_XMP_coarray_t *c)
Definition: xmp_coarray.c:297
_XMP_gasnet_put
void _XMP_gasnet_put(const int dst_contiguous, const int src_contiguous, const int target_rank, const int dst_dims, const int src_dims, const _XMP_array_section_t *dst_info, const _XMP_array_section_t *src_info, const _XMP_coarray_t *dst_desc, const void *src, const size_t dst_elmts, const size_t src_elmts)
Definition: xmp_coarray_gasnet.c:1095
_XMP_fjrdma_coarray_lastly_deallocate
void _XMP_fjrdma_coarray_lastly_deallocate()
Deallocate memory region when calling _XMP_coarray_lastly_deallocate()
Definition: xmp_coarray_fjrdma.c:1593
_XMP_utofu_get
void _XMP_utofu_get(const int src_contiguous, const int dst_contiguous, const int target_rank, const int src_dims, const int dst_dims, const _XMP_array_section_t *src_info, const _XMP_array_section_t *dst_info, const _XMP_coarray_t *src_desc, const _XMP_coarray_t *dst_desc, void *dst, const size_t src_elmts, const size_t dst_elmts)
Definition: xmp_coarray_utofu.c:929
_XMP_utofu_build_sync_images_table
void _XMP_utofu_build_sync_images_table(void)
Definition: xmp_coarray_utofu.c:983
_XMP_gasnet_contiguous_get
void _XMP_gasnet_contiguous_get()
_XMP_fatal
void _XMP_fatal(char *msg)
Definition: xmp_util.c:42
_XMP_array_section::stride
long stride
Definition: xmp_data_struct.h:378
_XMP_fjrdma_contiguous_get
void _XMP_fjrdma_contiguous_get(const int target_rank, const _XMP_coarray_t *dst_desc, const _XMP_coarray_t *src_desc, const uint64_t dst_offset, const uint64_t src_offset, const size_t dst_elmts, const size_t src_elmts, const size_t elmt_size)
Definition: xmp_coarray_fjrdma.c:1911
xmp_coarray::coarray_elmts
long * coarray_elmts
Definition: xmp_data_struct.h:345
_XMP_fjrdma_put
void _XMP_fjrdma_put(const int dst_contiguous, const int src_contiguous, const int target_rank, const int dst_dims, const int src_dims, const _XMP_array_section_t *dst_info, const _XMP_array_section_t *src_info, const _XMP_coarray_t *dst_desc, const _XMP_coarray_t *src_desc, void *src, const size_t dst_elmts, const size_t src_elmts)
Definition: xmp_coarray_fjrdma.c:1866
_XMP_N_COARRAY_GET
#define _XMP_N_COARRAY_GET
Definition: xmp_constant.h:111
_XMP_array_section::distance
long distance
Definition: xmp_data_struct.h:380
_XMP_array_section
Definition: xmp_data_struct.h:375
_XMP_fjrdma_coarray_malloc
void _XMP_fjrdma_coarray_malloc(_XMP_coarray_t *coarray_desc, void **addr, const size_t coarray_size)
Definition: xmp_coarray_fjrdma.c:1553
_XMP_local_put
void _XMP_local_put(_XMP_coarray_t *, const void *, const int, const int, const int, const int, const _XMP_array_section_t *, const _XMP_array_section_t *, const size_t, const size_t)
Definition: xmp_coarray_local.c:563
_coarray_queue_t::max_size
size_t max_size
Max size of queue.
Definition: xmp_coarray.c:19
_XMP_check_less_than_SIZE_MAX
void _XMP_check_less_than_SIZE_MAX(const long s)
Definition: xmp_coarray_utils.c:9
_XMP_utofu_sync_images
void _XMP_utofu_sync_images(const int num, int *image_set, int *status)
Definition: xmp_coarray_utofu.c:1065
_XMP_array_section::elmts
long elmts
Definition: xmp_data_struct.h:379
_XMP_fjrdma_sync_images
void _XMP_fjrdma_sync_images(const int num, int *image_set, int *status)
Execute sync images.
Definition: xmp_coarray_fjrdma.c:2251
_XMP_gasnet_get
void _XMP_gasnet_get(const int src_contiguous, const int dst_contiguous, const int target_rank, const int src_dims, const int dst_dims, const _XMP_array_section_t *src_info, const _XMP_array_section_t *dst_info, const _XMP_coarray_t *src_desc, const void *dst, const size_t src_elmts, const size_t dst_elmts)
Definition: xmp_coarray_gasnet.c:1430
_coarray_queue_t::coarrays
_XMP_coarray_t ** coarrays
pointer of coarrays
Definition: xmp_coarray.c:21
_XMP_utofu_regmem
void _XMP_utofu_regmem(_XMP_coarray_t *coarray_desc, void *addr, const size_t coarray_size)
Definition: xmp_coarray_utofu.c:238
_XMP_get_execution_nodes
void * _XMP_get_execution_nodes(void)
Definition: xmp_nodes_stack.c:46
_XMP_local_contiguous_copy
void _XMP_local_contiguous_copy(char *dst, const char *src, const size_t dst_elmts, const size_t src_elmts, const size_t elmt_size)
Definition: xmp_coarray_utils.c:79
_XMP_mpi_build_sync_images_table
void _XMP_mpi_build_sync_images_table()
Build table and Initialize for sync images.
Definition: xmp_coarray_mpi.c:951
xmp_coarray::image_dims
int image_dims
Definition: xmp_data_struct.h:354