47#define TOKEN_PASTE2_(a,b) a##b
48#define TOKEN_PASTE2(a,b) TOKEN_PASTE2_(a,b)
49#define TOKEN_PASTE3_(a,b,c) a##b##c
50#define TOKEN_PASTE3(a,b,c) TOKEN_PASTE3_(a,b,c)
53#define XT_GENERATE_EXT_DATATYPE \
54 TOKEN_PASTE3(generate_,XT_EXT_TAG,_datatype)
55#define XT_GENERATE_EXT_MSG_INFOS \
56 TOKEN_PASTE3(generate_,XT_EXT_TAG,_msg_infos)
57#define XT_REDIST_P2P_EXT_NEW \
58 TOKEN_PASTE3(xt_redist_p2p_,XT_EXT_TAG,_new)
59#define XT_REDIST_P2P_EXT_CUSTOM_NEW \
60 TOKEN_PASTE3(xt_redist_p2p_,XT_EXT_TAG,_custom_new)
66 const int psum_ext_size[],
67 void **work_buf,
size_t *work_buf_size,
70 if (num_transfer_pos_ext > 0)
73 size_t size_dt_stripes, num_dt_stripes = 0;
76 dt_stripes_init_size = 8,
77 dt_stripes_init_alloc = dt_stripes_init_size *
sizeof (*dt_stripes),
79 if (*work_buf_size < dt_stripes_init_alloc) {
80 dt_stripes =
xrealloc(*work_buf, dt_stripes_init_alloc);
81 size_dt_stripes = dt_stripes_init_size;
83 dt_stripes = *work_buf;
84 size_dt_stripes = *work_buf_size /
sizeof (*dt_stripes);
88 =
pos2disp(transfer_pos_ext[0].start,
89 num_ext, psum_ext_size);
92 struct Xt_pos_ext current_pos_ext = transfer_pos_ext[i];
93 if (num_dt_stripes >= size_dt_stripes) {
97 size_dt_stripes *
sizeof (*dt_stripes));
102 num_ext, psum_ext_size,
106 int pos_remaining = current_pos_ext.
start
107 - psum_ext_size[search_start_ext];
109 = base_ext.start + pos_remaining * base_ext.stride;
110 int isign_mask_current_pos_ext_size =
isign_mask(current_pos_ext.
size);
117 derived_ext.size =
imin(abs(current_pos_ext.
size),
118 (~isign_mask_current_pos_ext_size
119 & (base_ext.size - pos_remaining))
120 | (isign_mask_current_pos_ext_size
121 & (pos_remaining + 1)));
125 dt_stripes[num_dt_stripes++] = derived_ext;
127 += (~isign_mask_current_pos_ext_size & -derived_ext.size)
128 | (isign_mask_current_pos_ext_size & derived_ext.size);
129 current_pos_ext.
start += derived_ext.size;
130 }
while ((abs(current_pos_ext.
size) > 0)
131 & (num_dt_stripes < size_dt_stripes));
134 if (abs(current_pos_ext.
size) > 0)
137 }
while (++i < num_transfer_pos_ext);
141 *work_buf = dt_stripes;
142 *work_buf_size = size_dt_stripes *
sizeof (*dt_stripes);
146 return MPI_DATATYPE_NULL;
158 int *restrict psum_ext_size
159 =
xmalloc(((
size_t)num_ext + 1) *
sizeof (psum_ext_size[0]));
161 for (
size_t i = 0; i < (size_t)num_ext; ++i) {
162 psum_ext_size[i] = accum;
163 accum += extents[i].size;
165 psum_ext_size[num_ext] = accum;
173 const struct Xt_pos_ext *curr_transfer_pos_ext
175 int curr_num_transfer_pos_ext
180 curr_transfer_pos_ext,
181 num_ext, extents, psum_ext_size,
200 MPI_Datatype datatype)
203 num_dst_ext, dst_extents, datatype,
213 MPI_Datatype datatype,
224 size_t nmsg = (size_t)nrecv + (
size_t)nsend;
226 *send_msgs = msgs, *recv_msgs = msgs + nsend;
244 nsend, nrecv, send_msgs, recv_msgs, comm, &config_);
#define xrealloc(ptr, size)
static int isign_mask(int x)
static int imin(int a, int b)
struct Xt_config_ xt_default_config
struct Xt_config_ * Xt_config
struct Xt_xmap_ * Xt_xmap
struct Xt_redist_ * Xt_redist
MPI_Comm xt_mpi_comm_smart_dup(MPI_Comm comm, int *tag_offset)
void xt_mpi_comm_smart_dedup(MPI_Comm *comm, int tag_offset)
static void xt_destroy_mpi_strp_prs_params(struct Xt_mpi_strp_prs_params *params)
static void xt_init_mpi_strp_prs_params(struct Xt_mpi_strp_prs_params *params, MPI_Datatype old_type, MPI_Comm comm)
#define XT_EXT_STRIDE_MASK_PREP
static int pos2disp2(int pos, int num_ext, const int psum_ext_size[], int start_ext)
static int pos2disp(int pos, int num_ext, const int psum_ext_size[])
#define XT_MPI_PARSE_STRIPE
#define XT_EXT_STRIDE_MASK
#define XT_GENERATE_EXT_MSG_INFOS
#define XT_REDIST_P2P_EXT_CUSTOM_NEW
#define XT_REDIST_P2P_EXT_NEW
#define XT_GENERATE_EXT_DATATYPE
Xt_redist xt_redist_single_array_base_custom_new(int nsend, int nrecv, const struct Xt_redist_msg send_msgs[], const struct Xt_redist_msg recv_msgs[], MPI_Comm comm, Xt_config config)
int xt_xmap_iterator_next(Xt_xmap_iter iter)
struct Xt_xmap_iter_ * Xt_xmap_iter
Xt_xmap_iter xt_xmap_get_out_iterator(Xt_xmap xmap)
int xt_xmap_iterator_get_num_transfer_pos_ext(Xt_xmap_iter iter)
void xt_xmap_iterator_delete(Xt_xmap_iter iter)
int xt_xmap_get_num_destinations(Xt_xmap xmap)
int xt_xmap_iterator_get_rank(Xt_xmap_iter iter)
int xt_xmap_get_num_sources(Xt_xmap xmap)
const struct Xt_pos_ext * xt_xmap_iterator_get_transfer_pos_ext(Xt_xmap_iter iter)
Xt_xmap_iter xt_xmap_get_in_iterator(Xt_xmap xmap)
MPI_Comm xt_xmap_get_communicator(Xt_xmap xmap)