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

Functions

int _XMP_coarray_get_total_elmts (void *coarray_desc)
 
void _XMP_coarray_attach_acc (_XMP_coarray_t *coarray_desc, void *addr, const size_t coarray_size)
 Attach memory to coarray. More...
 
void _XMP_coarray_detach_acc (_XMP_coarray_t *coarray_desc)
 Detach memory from coarray. More...
 
void _XMP_coarray_malloc_acc (void **coarray_desc, void *addr)
 
void _XMP_coarray_contiguous_put_acc (const int target_image, 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 int is_dst_on_acc, const int is_src_on_acc)
 
void _XMP_coarray_contiguous_get_acc (const int target_image, _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 int is_dst_on_acc, const int is_src_on_acc)
 

Function Documentation

◆ _XMP_coarray_attach_acc()

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

Attach memory to coarray.

24 {
25  _XMP_coarray_set_info(coarray_desc);
26 
27 #ifdef _XMP_MPI3_ONESIDED
28  _XMP_mpi_coarray_attach(coarray_desc, addr, coarray_size, true);
29 #else
30  _XMP_fatal("_XMP_coarray_attach_acc is unavailable");
31 #endif
32 }
Here is the call graph for this function:

◆ _XMP_coarray_contiguous_get_acc()

void _XMP_coarray_contiguous_get_acc ( const int  target_image,
_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 int  is_dst_on_acc,
const int  is_src_on_acc 
)
131 {
132  int target_rank = target_image;
133  size_t elmt_size = dst_desc->elmt_size;
134 
135  if(!is_dst_on_acc || !is_src_on_acc){
136  _XMP_fatal("device to host and host to device put are umimplemented");
137  }
138 
139  if(target_rank == _XMP_world_rank){
140 #ifdef _XMP_MPI3_ONESIDED
141  _XMP_mpi_contiguous_get(target_rank, dst_desc, src_desc, dst_offset, src_offset,
142  dst_elmts, src_elmts, elmt_size, is_dst_on_acc, is_src_on_acc);
143 #else
144  _XMP_fatal("local_contiguous_copy is unimplemented");
145 #endif
146  /* _XMP_local_contiguous_copy((char *)dst_desc->real_addr+dst_offset, (char *)src_desc->real_addr+src_offset, */
147  /* dst_elmts, src_elmts, elmt_size); */
148  }
149  else{
150 #ifdef _XMP_TCA
151  /* _XMP_tca_contiguous_get(target_rank, dst_offset, src_offset, dst_desc, src_desc, */
152  /* dst_elmts, src_elmts, elmt_size); */
153  _XMP_fatal("_XMP_tca_contiguous_get is unimplemented");
154 #elif _XMP_MPI3_ONESIDED
155  _XMP_mpi_contiguous_get(target_rank, dst_desc, src_desc, dst_offset, src_offset,
156  dst_elmts, src_elmts, elmt_size, is_dst_on_acc, is_src_on_acc);
157 #else
158  _XMP_fatal("_XMP_coarray_contiguous_get_acc is unavailable");
159 #endif
160  }
161 }
Here is the call graph for this function:

◆ _XMP_coarray_contiguous_put_acc()

void _XMP_coarray_contiguous_put_acc ( const int  target_image,
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 int  is_dst_on_acc,
const int  is_src_on_acc 
)
81 {
82  int target_rank = target_image;
83  size_t elmt_size = dst_desc->elmt_size;
84 
85  if(!is_dst_on_acc || !is_src_on_acc){
86  _XMP_fatal("device to host and host to device put are umimplemented");
87  }
88 
89  if(target_rank == _XMP_world_rank){
90 #ifdef _XMP_MPI3_ONESIDED
91  _XMP_mpi_contiguous_put(target_rank, dst_desc, src_desc, dst_offset, src_offset,
92  dst_elmts, src_elmts, elmt_size, is_dst_on_acc, is_src_on_acc);
93 #else
94  _XMP_fatal("local_contiguous_copy is unimplemented");
95 #endif
96  //_XMP_local_contiguous_copy((char *)dst_desc->real_addr+dst_offset, (char *)src_desc->real_addr+src_offset,
97  //dst_elmts, src_elmts, elmt_size);
98  }
99  else{
100 #ifdef _XMP_TCA
101  _XMP_tca_contiguous_put(target_rank, dst_offset, src_offset, dst_desc, src_desc,
102  dst_elmts, src_elmts, elmt_size);
103 #elif _XMP_MPI3_ONESIDED
104  _XMP_mpi_contiguous_put(target_rank, dst_desc, src_desc, dst_offset, src_offset,
105  dst_elmts, src_elmts, elmt_size, is_dst_on_acc, is_src_on_acc);
106 #else
107  _XMP_fatal("_XMP_coarray_contiguous_put_acc is unavailable");
108 #endif
109  }
110 }
Here is the call graph for this function:

◆ _XMP_coarray_detach_acc()

void _XMP_coarray_detach_acc ( _XMP_coarray_t coarray_desc)

Detach memory from coarray.

38 {
39 #ifdef _XMP_MPI3_ONESIDED
40  _XMP_mpi_coarray_detach(coarray_desc, true);
41 #else
42  _XMP_fatal("_XMP_coarray_detach_acc is unavailable");
43 #endif
44 }
Here is the call graph for this function:

◆ _XMP_coarray_get_total_elmts()

int _XMP_coarray_get_total_elmts ( void *  coarray_desc)
10 {
11  _XMP_coarray_t* c = (_XMP_coarray_t*)coarray_desc;
12 
13  int total_coarray_elmts = 1;
14  for(int i = 0; i < c->coarray_dims; i++){
15  total_coarray_elmts *= c->coarray_elmts[i];
16  }
17  return total_coarray_elmts;
18 }
Here is the caller graph for this function:

◆ _XMP_coarray_malloc_acc()

void _XMP_coarray_malloc_acc ( void **  coarray_desc,
void *  addr 
)
47 {
48  _XMP_coarray_t* c = *coarray_desc;
49 
50  int total_coarray_elmts = _XMP_coarray_get_total_elmts(c);
51 
52 #ifdef _XMP_TCA
53  _XMP_tca_malloc(*coarray_desc, addr, total_coarray_elmts * c->elmt_size);
54 #elif _XMP_MPI3_ONESIDED
55  _XMP_mpi_coarray_malloc(*coarray_desc, addr, total_coarray_elmts * c->elmt_size, true);
56 #else
57  _XMP_fatal("_XMP_coarray_malloc_acc is unavailable");
58 #endif
59 }
Here is the call graph for this function:
_XMP_tca_malloc
void _XMP_tca_malloc(_XMP_coarray_t *coarray_desc, void **addr, const size_t coarray_size)
Definition: xmp_coarray_tca.c:107
_XMP_coarray_get_total_elmts
int _XMP_coarray_get_total_elmts(void *coarray_desc)
Definition: xmp_coarray_acc.c:9
xmp_coarray::elmt_size
size_t elmt_size
Definition: xmp_data_struct.h:339
_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_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_tca_contiguous_put
void _XMP_tca_contiguous_put(const int target_rank, const size_t dst_offset, const size_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_tca.c:142
_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_coarray::coarray_dims
int coarray_dims
Definition: xmp_data_struct.h:342
xmp_coarray
Definition: xmp_data_struct.h:328
_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_fatal
void _XMP_fatal(char *msg)
Definition: xmp_util.c:42
xmp_coarray::coarray_elmts
long * coarray_elmts
Definition: xmp_data_struct.h:345