78 _XMP_fatal(
"broadcast failed, cannot find the source node");
83 int acc_nodes_size = 1;
84 int from_dim = from_nodes->
dim;
85 int from_lower, from_upper, from_stride;
88 if(inherit_info == NULL){
89 for (
int i = 0; i < from_dim; i++) {
91 if(inherit_info != NULL){
92 if(inherit_info[i].shrink ==
true)
94 size = inherit_info[i].
upper - inherit_info[i].
lower + 1;
95 if(size == 0)
continue;
99 if (va_arg(args,
int) == 1) {
100 root += (acc_nodes_size * rank);
103 from_lower = va_arg(args,
int) - 1;
104 from_upper = va_arg(args,
int) - 1;
105 from_stride = va_arg(args,
int);
109 _XMP_fatal(
"multiple source nodes indicated in bcast directive");
112 root += (acc_nodes_size * (from_lower));
115 acc_nodes_size *= size;
121 for (
int i = 0; i < inherit_node_dim; i++) {
123 if(inherit_info[i].shrink)
126 int size = inherit_info[i].
upper - inherit_info[i].
lower + 1;
136 int is_astrisk = va_arg(args,
int);
137 if (is_astrisk == 1){
138 int rank = from_nodes->
info[i].
rank;
139 root += (acc_nodes_size * rank);
142 from_lower = va_arg(args,
int) - 1;
143 from_upper = va_arg(args,
int) - 1;
147 if(from_lower != from_upper)
148 _XMP_fatal(
"multiple source nodes indicated in bcast directive");
150 root += (acc_nodes_size * (from_lower - inherit_info[i].
lower));
153 acc_nodes_size *= size;
160 MPI_Ibcast(addr, count*datatype_size, MPI_BYTE, root,
161 *((MPI_Comm *)bcast_nodes->
comm), &async->
reqs[async->
nreqs]);
166 MPI_Bcast(addr, count*datatype_size, MPI_BYTE, root,
167 *((MPI_Comm *)bcast_nodes->
comm));
Definition: xmp_data_struct.h:458
int nreqs
Definition: xmp_data_struct.h:460
MPI_Request * reqs
Definition: xmp_data_struct.h:464
int size
Definition: xmp_data_struct.h:32
int rank
Definition: xmp_data_struct.h:35
Definition: xmp_data_struct.h:20
int lower
Definition: xmp_data_struct.h:23
int upper
Definition: xmp_data_struct.h:24
int is_member
Definition: xmp_data_struct.h:46
_XMP_comm_t * comm
Definition: xmp_data_struct.h:53
int dim
Definition: xmp_data_struct.h:47
struct _XMP_nodes_type * inherit_nodes
Definition: xmp_data_struct.h:57
_XMP_nodes_info_t info[1]
Definition: xmp_data_struct.h:60
_XMP_nodes_inherit_info_t * inherit_info
Definition: xmp_data_struct.h:59
void _XMP_fatal(char *msg)
Definition: xmp_util.c:42
#define _XMP_M_COUNT_TRIPLETi(l_, u_, s_)
Definition: xmp_gpu_func.hpp:25
_Bool xmp_is_async()
Definition: xmp_async.c:20
#define _XMP_RETURN_IF_SINGLE
Definition: xmp_internal.h:37
_XMP_async_comm_t * _XMP_get_current_async()
Definition: xmp_async.c:205