103 size_t num_stripes_alloc);
115 int * position,
int offset);
118 Xt_int const *selection_idx,
119 size_t num_selection,
int *positions,
120 int single_match_only);
142 .get_indices_at_positions = NULL,
146 .get_positions_of_indices_off = NULL,
150 .get_bounding_box = NULL,
159 struct Xt_muldiv agsmd;
191int MPI_Get_address(XT_MPI_SEND_BUF_CONST
void *location, MPI_Aint *address);
199 MPI_Aint base_address, local_size_address;
201 MPI_Get_address(&
dim_desc, &base_address);
204 enum { num_dt_components = 2 };
205 static const int block_lengths[num_dt_components] = { 2, 1 };
206 MPI_Aint displacements[num_dt_components]
207 = {0, local_size_address - base_address };
208 static const MPI_Datatype types[num_dt_components]
210 MPI_Datatype dim_desc_dt_unaligned;
212 (
int *)block_lengths, displacements,
213 (MPI_Datatype *)types,
214 &dim_desc_dt_unaligned), Xt_default_comm);
231 const struct
dim_desc dims[num_dimensions])
235 Xt_int max = local_start_index,
min = local_start_index;
236 for (
size_t i = 0; i < num_dimensions; ++i) {
238 if (dims[i].global_stride < 0)
240 (
Xt_int)(abs(dims[i].local_size) - 1)));
243 (
Xt_int)(abs(dims[i].local_size) - 1)));
259 struct
dim_desc dims[num_dimensions])
261 int asc_dim = 0, dsc_dim = 0;
262 for (
size_t i = 0; i < num_dimensions; ++i) {
264 int goes_rev_order = (dims[i].global_size < 0) ^ (dims[i].local_size < 0);
265 asc_dim += !goes_rev_order;
266 dsc_dim += goes_rev_order;
269 dims[num_dimensions - 1].global_stride =
271 isign(dims[num_dimensions - 1].local_size));
273 dims[num_dimensions - 1].agsmd
274 = xt_get_mulinv(XT_INT_ABS(dims[num_dimensions - 1].global_stride));
276 dims[num_dimensions - 1].local_stride = 1;
280 for (
size_t i = num_dimensions - 2; i != (size_t)-1; --i) {
281 dims[i].global_stride
282 = (
Xt_int)(XT_INT_ABS(dims[i+1].global_stride * dims[i+1].global_size)
284 *
isign(dims[i].local_size));
286 = abs(dims[i+1].local_stride * dims[i+1].local_size);
289 = xt_get_mulinv(XT_INT_ABS(dims[i].global_stride));
296 for (
size_t i = num_dimensions - 1; i != (size_t)-1; --i) {
298 = (
Xt_int)(dims[i].global_stride *
isign(dims[i].local_size)),
300 = (
Xt_int)(dims[i].global_size > 0 ? 0 : dims[i].global_size + 1);
302 = (
Xt_int)(local_start_index
303 + (adj_gstride * (start_ofs + dims[i].local_start)));
304 if (dims[i].local_size < 0)
306 = (
Xt_int)(local_start_index
307 + (dims[i].global_stride * (dims[i].local_size + 1)));
311 .max = mm.
max, .min = mm.
min,
320 for (
size_t i = 0; i < num_dimensions; ++i)
321 size *= abs(local_size[i]);
322 assert(size <= INT_MAX);
328 const Xt_int global_size[num_dimensions],
329 const int local_size[num_dimensions],
330 const Xt_int local_start[num_dimensions]) {
337 size_t num_dimensions_ = (size_t)num_dimensions;
341 if (num_indices > 0) {
344 + num_dimensions_ *
sizeof (idxsection->
dims[0]));
347 idxsection->
ndim = num_dimensions;
351 for (
size_t i = 0; i < num_dimensions_; ++i) {
363 result = &idxsection->
parent;
375 if (data == NULL)
return;
388 int size_header, size_dim_descs, size_xt_int;
390 xt_mpi_call(MPI_Pack_size(2, MPI_INT, comm, &size_header), comm);
393 comm, &size_dim_descs), comm);
395 return (
size_t)size_header + (size_t)size_dim_descs
396 + (
size_t)size_xt_int;
410 buffer_size, position, comm), comm);
412 buffer_size, position, comm), comm);
414 buffer, buffer_size, position, comm), comm);
425 xt_mpi_call(MPI_Unpack(buffer, buffer_size, position, &ndim, 1, MPI_INT,
428 =
xmalloc(
sizeof (*section) + (
size_t)ndim *
sizeof(section->
dims[0]));
429 xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
434 section->
ndim = ndim;
436 xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
462 INSTR_DEF(instr,
"idxsection_get_intersection_with_other_idxlist")
469 Xt_int const * sorted_dst_idx;
470 Xt_int * temp_dst_idx = NULL;
472 for (
size_t i = 1; i < num_dst_idx; ++i)
473 if (dst_idx[i] < dst_idx[i-1])
475 sorted_dst_idx = dst_idx;
478 temp_dst_idx =
xmalloc(num_dst_idx *
sizeof(*temp_dst_idx));
479 memcpy(temp_dst_idx, dst_idx, num_dst_idx *
sizeof(*temp_dst_idx));
482 sorted_dst_idx = temp_dst_idx;
484 int *pos =
xmalloc(num_dst_idx *
sizeof(*pos));
486 src_idxsection, sorted_dst_idx, num_dst_idx, pos,
false);
487 size_t num_inter_idx = num_dst_idx - num_unmatched;
493 for(
size_t i = 0, j = 0; i < num_dst_idx && j < num_inter_idx; i++)
495 inter_vec[j++] = sorted_dst_idx[i];
511#undef XT_IDXSECTION_STRIPES_ISECT_SINGLE_MATCH_ONLY
512#define NUM_DIMENSIONS 1
515#define NUM_DIMENSIONS 2
518#define NUM_DIMENSIONS 3
521#define NUM_DIMENSIONS 4
533 INSTR_DEF(instr,
"idxsection_get_idxstripes_intersection")
539 switch (idxsection->
ndim) {
542 = xt_idxsection_get_idxstripes_intersection_1(
547 = xt_idxsection_get_idxstripes_intersection_2(
552 = xt_idxsection_get_idxstripes_intersection_3(
557 = xt_idxsection_get_idxstripes_intersection_4(
562 = xt_idxsection_get_idxstripes_intersection_(
569#define XT_IDXSECTION_STRIPES_ISECT_SINGLE_MATCH_ONLY
570#define NUM_DIMENSIONS 1
573#define NUM_DIMENSIONS 2
576#define NUM_DIMENSIONS 3
579#define NUM_DIMENSIONS 4
583#undef XT_IDXSECTION_STRIPES_ISECT_SINGLE_MATCH_ONLY
590 INSTR_DEF(instr,
"idxsection_get_idxstripes_r_intersection")
596 switch (idxsection->
ndim) {
599 = xt_idxsection_get_idxstripes_intersection_sm_1(
604 = xt_idxsection_get_idxstripes_intersection_sm_2(
609 = xt_idxsection_get_idxstripes_intersection_sm_3(
614 = xt_idxsection_get_idxstripes_intersection_sm_4(
619 = xt_idxsection_get_idxstripes_intersection_sm_(
630 INSTR_DEF(instr,
"idxsection_get_intersection.part")
637 if (idxsection_src->
ndim != idxsection_dst->ndim ||
641 size_t num_dimensions = (size_t)idxsection_src->
ndim;
644 for (
size_t i = 1; i < num_dimensions; ++i)
646 != XT_INT_ABS(idxsection_dst->dims[i].global_size))
648 idxlist_src, idxlist_dst, config);
653 =
xmalloc(
sizeof (*idxsection_intersection)
654 + num_dimensions *
sizeof (idxsection_intersection->
dims[0]));
657 idxsection_intersection->
ndim = (int)num_dimensions;
660 struct dim_desc *restrict intersection_dims = idxsection_intersection->
dims;
662 *dst_dims = idxsection_dst->dims;
667 for (
size_t i = 0; i < num_dimensions; ++i) {
669 Xt_int src_start, src_end, dst_start, dst_end, local_end;
684 dst_start = dst_dims[i].local_start;
688 - dst_dims[i].local_start);
690 src_end = (
Xt_int)(src_start
692 dst_end = (
Xt_int)(dst_start
695 intersection_dims[i].local_start = (src_start > dst_start)?src_start:dst_start;
696 local_end = (src_end > dst_end)?dst_end:src_end;
701 intersection_dims[i].local_size
702 = (int)(local_end - intersection_dims[i].
local_start);
703 intersection_dims[i].global_size
714 num_dimensions, idxsection_intersection->
dims);
722 free(idxsection_intersection);
734 size_t num_dimensions = (size_t)src->
ndim;
737 sizeof (*idxsection) + num_dimensions *
sizeof (idxsection->
dims[0]));
741 memcpy(idxsection->
dims, src->
dims, num_dimensions * sizeof (src->
dims[0]));
749 size_t num_dimensions = (size_t)orig->
ndim;
756 for (
size_t i = 0; i < num_dimensions; ++i) {
758 abs_gsize = XT_INT_ABS(gsize);
759 int lsize = dd_orig[i].local_size,
760 abs_lsize = abs(lsize);
761 dd_dst[i].global_size = abs_gsize;
762 dd_dst[i].local_size = abs_lsize;
763 dd_dst[i].local_start = gsize >= 0
764 ? dd_orig[i].local_start
781 size_t num_dimensions = (size_t)((
Xt_idxsection)idxlist)->ndim;
783 sizeof (*sorted_idxsection)
784 + num_dimensions *
sizeof (sorted_idxsection->
dims[0]));
793 size_t num_dimensions = (size_t)section->
ndim;
794 for (
size_t i = 0; i < num_dimensions; ++i)
796 assert(size <= INT_MAX);
805 size_t num_dimensions,
struct dim_desc dims[num_dimensions])
808 int abs_local_size = abs(dims[0].local_size);
810 if (num_dimensions == 1)
812 if (dims[0].global_stride > 0)
813 for (
int i = 0; i < abs_local_size; ++i)
814 indices[i] = (
Xt_int)(start_index + i);
816 for (
int i = 0; i < abs_local_size; ++i)
817 indices[i] = (
Xt_int)(start_index - i);
818 return abs_local_size;
822 int indices_written = 0, overflow = 0;
823 assert(num_dimensions > 1);
824 for (
int dim_ofs = 0; dim_ofs < abs_local_size; ++dim_ofs)
826 int indices_written_temp
829 + dim_ofs * dims[0].global_stride),
830 indices + indices_written,
831 num_dimensions - 1, dims + 1);
832 overflow |= (indices_written_temp > INT_MAX - indices_written);
833 indices_written += indices_written_temp;
836 return indices_written;
847 (
size_t)section->
ndim, section->
dims);
853 INSTR_DEF(instr,
"idxsection_get_indices")
865 (
size_t)num_indices *
sizeof(*indices));
881 size_t num_dimensions = (size_t)section->
ndim;
883 size_t i = num_dimensions-1;
884 while (i != SIZE_MAX && dims[i].
local_size == 1)
887 for (i -= (i != SIZE_MAX); i != SIZE_MAX; --i)
897 return (
int)nstripes;
903 size_t num_stripes_alloc)
906 (void)num_stripes_alloc;
908 INSTR_DEF(instr,
"idxsection_get_index_stripes.part")
912 size_t num_dimensions = (size_t)section->
ndim;
915 size_t ln1dim = num_dimensions-1;
916 while (ln1dim != SIZE_MAX && dims[ln1dim].
local_size == 1)
918 ln1dim += ln1dim == SIZE_MAX;
922 assert(nstripes != 0);
926 enum { curr_local_position_auto_size=16 };
927 Xt_int curr_local_position_auto[curr_local_position_auto_size];
928 Xt_int *restrict curr_local_position;
929 if (ln1dim <= curr_local_position_auto_size) {
930 curr_local_position = curr_local_position_auto;
931 for (
size_t i = 0; i < ln1dim; ++i)
932 curr_local_position[i] = 0;
935 =
xcalloc(ln1dim,
sizeof(*curr_local_position));
937 for (
size_t i = 0; i < nstripes; ++i) {
940 stripes[i].nstrides = abs(dims[ln1dim].
local_size);
941 stripes[i].stride = dims[ln1dim].global_stride;
943 for (
size_t j = 0; j < ln1dim; ++j)
944 stripes[i].start = (
Xt_int)(stripes[i].start
945 + curr_local_position[j]
946 * dims[j].global_stride);
948 for (
size_t j = ln1dim-1; j != (size_t)-1; --j)
949 if (curr_local_position[j] < abs(dims[j].
local_size) - 1) {
950 curr_local_position[j]++;
953 curr_local_position[j] = 0;
955 assert(num_stripes_alloc >= nstripes);
956 if (curr_local_position != curr_local_position_auto)
957 free(curr_local_position);
968 if (position < 0)
return 1;
970 size_t num_dimensions = (size_t)section->
ndim;
975 for (
size_t dim = 0; dim < num_dimensions; ++dim) {
978 int curr_local_position = qr.quot;
980 if (curr_local_position >= abs(dims[dim].
local_size))
983 temp_index = (
Xt_int)(temp_index
984 + curr_local_position
998 INSTR_DEF(instr,
"idxsection_get_position_of_index.part")
1003 if (index < section->min_index_cache || index > section->
max_index_cache)
1013 int temp_position = 0;
1014 size_t num_dimensions = (size_t)section->
ndim;
1016 for (
size_t i = 0; i < num_dimensions; ++i) {
1018 XT_INT_DIV_T qr =
Xt_div(index, dims[i].agsmd,
1025 curr_global_position
1033 int curr_local_position
1034 = (int)(curr_global_position - dims[i].
local_start);
1036 int abs_local_size = abs(dims[i].
local_size);
1039 curr_local_position = abs_local_size - curr_local_position - 1;
1041 if (curr_local_position >= abs_local_size)
1044 temp_position += (int)curr_local_position * dims[i].
local_stride;
1047 *position = temp_position;
1058 const Xt_int selection_idx[],
1059 size_t num_selection,
1061 int single_match_only) {
1063 INSTR_DEF(instr,
"idxsection_get_positions_of_indices_v1.part")
1064 if (num_selection == 1)
1069 size_t num_unmatched = 0;
1071 if (!single_match_only) {
1073 for (
size_t i = 0; i < num_selection; ++i)
1078 return num_unmatched;
1083 for (
size_t i = 1; i < num_selection; ++i)
1084 if (selection_idx[i] < selection_idx[i-1])
1092 for (
size_t i = 0; i < num_selection; i++) {
1094 Xt_int curr_index = selection_idx[i];
1096 if (prev_index != curr_index) {
1101 prev_index = curr_index;
1117 for (
size_t i = 0; i < num_selection; i++) {
1118 v[i].
idx = selection_idx[i];
1123 for (
size_t i = 0; i < num_selection; i++) {
1126 if (jx != last_jx) {
1142 return num_unmatched;
1147 const Xt_int selection_idx[],
1148 size_t num_selection,
int positions[],
1149 int single_match_only) {
1151 INSTR_DEF(instr,
"idxsection_get_positions_of_indices_v2.part")
1153 if (num_selection == 1)
1155 *selection_idx, positions));
1159 Xt_int * temp_selection_idx = NULL;
1160 const Xt_int *restrict sorted_selection_idx;
1161 int * selection_pos = NULL;
1163 for (
size_t i = 1; i < num_selection; ++i)
1164 if (selection_idx[i] < selection_idx[i-1])
1167 sorted_selection_idx = selection_idx;
1172 =
xmalloc(num_selection *
sizeof(*temp_selection_idx));
1173 memcpy(temp_selection_idx, selection_idx,
1174 num_selection *
sizeof(*temp_selection_idx));
1175 selection_pos =
xmalloc(num_selection *
sizeof(*selection_pos));
1179 temp_selection_idx, num_selection, selection_pos);
1180 sorted_selection_idx = temp_selection_idx;
1205 if (!single_match_only) {
1207 if (selection_pos == NULL) {
1208 for (
size_t j = 0; i < num_selection && j < num_body_indices; ++i) {
1210 while(j < num_body_indices && body_indices[j] < sorted_selection_idx[i]) ++j;
1212 if (j >= num_body_indices)
break;
1214 positions[i] = (body_indices[j] == sorted_selection_idx[i])?(
int)j:-1;
1217 for (
size_t j = 0; i < num_selection && j < num_body_indices; ++i) {
1219 while(j < num_body_indices && body_indices[j] < sorted_selection_idx[i]) ++j;
1221 if (j >= num_body_indices)
break;
1223 positions[selection_pos[i]] = (body_indices[j] == sorted_selection_idx[i])?(
int)j:-1;
1228 Xt_int last_idx = (
Xt_int)(sorted_selection_idx[0] - 1);
1230 if (selection_pos == NULL) {
1231 for (
size_t j = 0; i < num_selection && j < num_body_indices; ++i) {
1233 while(j < num_body_indices && body_indices[j] < sorted_selection_idx[i]) ++j;
1235 if (j >= num_body_indices)
break;
1237 positions[i] = ((last_idx == sorted_selection_idx[i]) ||
1238 (body_indices[j] != sorted_selection_idx[i]))?-1:(int)j;
1240 last_idx = sorted_selection_idx[i];
1243 for (
size_t j = 0; i < num_selection && j < num_body_indices; ++i) {
1245 while(j < num_body_indices && body_indices[j] < sorted_selection_idx[i]) ++j;
1247 if (j >= num_body_indices)
break;
1249 positions[selection_pos[i]] = ((last_idx == sorted_selection_idx[i]) ||
1250 (body_indices[j] != sorted_selection_idx[i]))?-1:(int)j;
1252 last_idx = sorted_selection_idx[i];
1258 if (selection_pos == NULL)
1259 for (; i < num_selection; ++i)
1262 for (; i < num_selection; ++i)
1263 positions[selection_pos[i]] = -1;
1265 free(temp_selection_idx);
1266 free(selection_pos);
1268 size_t num_unmatched = 0;
1271 for (
size_t j = 0; j < num_selection; ++j)
1272 num_unmatched += positions[j] == -1;
1275 return num_unmatched;
1280 int position_offset,
1287 size_t num_processed = 0;
1290 int abs_local_size = abs(dims[0].
local_size);
1302 while ((num_processed < num_indices)
1303 && (indices[num_processed] < min_index))
1304 positions[num_processed++] = -1;
1315 while ((num_processed < num_indices) &&
1316 ((curr_position = (
Xt_int)(indices[num_processed] - min_index)) <
1319 positions[num_processed++] = position_offset
1320 + (int)(abs_local_size - curr_position - 1);
1327 while ((num_processed < num_indices) &&
1328 ((curr_position = (
Xt_int)(indices[num_processed] - min_index)) <
1331 positions[num_processed++] = position_offset + (int)curr_position;
1337 while ((num_processed < num_indices) &&
1338 (indices[num_processed] < index_offset + abs_global_size))
1339 positions[num_processed++] = -1;
1346 while (num_processed < num_indices) {
1350 =
Xt_div((
Xt_int)(indices[num_processed] - index_offset),
1351 dims[0].agsmd, abs_global_stride);
1355 Xt_int abs_local_position
1357 if (abs_local_position >= abs_local_size)
1360 int curr_local_position
1361 = dims[0].global_stride < 0
1363 ? (int)(abs_local_size - abs_local_position - 1)
1365 : (int)abs_local_position;
1367 = (
Xt_int)(index_offset + curr_global_position * abs_global_stride);
1371 int position_offset_ = position_offset + curr_local_position * dims[0].local_stride;
1374 curr_index_offset, position_offset_, indices + num_processed,
1375 num_indices - num_processed, positions + num_processed, ndim-1,
1380 return num_processed;
1385 const Xt_int *restrict selection_idx,
1386 size_t num_selection,
1387 int *restrict positions,
1388 int single_match_only) {
1390 INSTR_DEF(instr,
"idxsection_get_positions_of_indices_v3.part")
1391 INSTR_DEF(instr2,
"idxsection_get_positions_of_indices_recursive")
1395 if (num_selection == 1)
1402 const Xt_int * restrict sorted_selection_idx;
1403 Xt_int *temp_selection_idx = NULL;
1404 int *sorted_positions;
1405 int *selection_pos = NULL;
1407 for (
size_t i = 1; i < num_selection; ++i)
1408 if (selection_idx[i] < selection_idx[i-1])
1409 goto unsorted_selection;
1411 sorted_selection_idx = selection_idx;
1412 sorted_positions = positions;
1413 goto sorted_selection;
1417 =
xmalloc(num_selection *
sizeof(*temp_selection_idx));
1419 size_t num_sp_alloc = num_selection;
1420#if defined _CRAYC && _RELEASE_MAJOR < 9
1421 num_sp_alloc = (num_sp_alloc + _MAXVL_32 - 1) & ~(_MAXVL_32 - 1);
1423 size_t total_alloc = num_sp_alloc + num_selection;
1425 =
xmalloc(total_alloc *
sizeof(*sorted_positions));
1426 selection_pos = sorted_positions + num_sp_alloc;
1428 memcpy(temp_selection_idx, selection_idx,
1429 num_selection *
sizeof(*temp_selection_idx));
1433 temp_selection_idx, num_selection, selection_pos);
1434 sorted_selection_idx = temp_selection_idx;
1439 size_t num_processed
1442 0, sorted_selection_idx, num_selection,
1443 sorted_positions, section->
ndim,
1449 for (
size_t i = num_processed; i < num_selection; ++i)
1450 sorted_positions[i] = -1;
1453 if (single_match_only)
1454 for (
size_t i = 1; i < num_processed; ++i)
1455 if (sorted_selection_idx[i] == sorted_selection_idx[i-1])
1456 sorted_positions[i] = -1;
1459 if (sorted_selection_idx != selection_idx) {
1461 for (
size_t i = 0; i < num_selection; ++i)
1462 positions[selection_pos[i]] = sorted_positions[i];
1464 free(sorted_positions);
1465 free(temp_selection_idx);
1469 size_t num_unmatched = num_selection - num_processed;
1471 for (
size_t i = 0; i < num_processed; ++i)
1472 num_unmatched += positions[i] == -1;
1476 return num_unmatched;
1481 const Xt_int *selection_idx,
1482 size_t num_selection,
int * positions,
1483 int single_match_only) {
1485 INSTR_DEF(instr,
"idxsection_get_positions_of_indices")
1487 size_t retval = 0, num_section_indices;
1496 num_selection, positions,
1504 (((num_section_indices
1507 <= (
size_t)128 * 1024U * 1024U)
1508 && (num_section_indices <= 1000 * num_selection)))
1510 num_selection, positions,
1514 num_selection, positions,
1523 int * position,
int offset) {
1528 || temp_position < offset)
1530 *position = temp_position;
1531 return temp_position == -1;
1552 return (
int)sort_flags-(sort_flags < 3);
add versions of standard API functions not returning on error
#define xcalloc(nmemb, size)
const struct Xt_sort_algo_funcptr * sort_funcs
const struct xt_idxlist_vtable * vtable
Xt_int * index_array_cache
Xt_int global_start_index
struct Xt_idxlist_ parent
void(* sort_xt_int_permutation)(Xt_int a[], size_t n, int permutation[])
void(* sort_idxpos)(idxpos_type *v, size_t n)
void(* sort_xt_int)(Xt_int *a, size_t n)
void(* delete)(Xt_idxlist)
int MPI_Type_create_struct(int count, XT_MPI2_CONST int array_of_block_lengths[], XT_MPI2_CONST MPI_Aint array_of_displacements[], XT_MPI2_CONST MPI_Datatype array_of_types[], MPI_Datatype *newtype)
int MPI_Type_create_resized(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype)
int MPI_Type_free(MPI_Datatype *datatype)
int MPI_Type_commit(MPI_Datatype *datatype)
#define Xt_div(num, muldiv, den)
static Xt_int Xt_isign(Xt_int x)
struct Xt_config_ xt_default_config
implementation of configuration object
Xt_idxlist xt_idxempty_new(void)
const Xt_int * xt_idxlist_get_indices_const(Xt_idxlist idxlist)
Provide non-public declarations common to all index lists.
PPM_DSO_INTERNAL Xt_idxlist xt_default_isect(Xt_idxlist idxlist_src, Xt_idxlist idxlist_dst, Xt_config config)
#define xt_idxlist_get_num_indices(idxlist)
static void Xt_idxlist_init(Xt_idxlist idxlist, const struct xt_idxlist_vtable *vtable, int num_indices)
Xt_idxlist xt_idxsection_get_idxstripes_r_intersection(Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, Xt_config config)
static Xt_idxlist idxsection_copy(Xt_idxlist idxlist)
static size_t idxsection_get_positions_of_indices(Xt_idxlist body_idxlist, Xt_int const *selection_idx, size_t num_selection, int *positions, int single_match_only)
static const struct xt_idxlist_vtable idxsection_vtable
Xt_idxlist xt_idxsection_get_intersection_with_other_idxlist(Xt_idxlist src_idxsection, Xt_idxlist dst_idxlist, Xt_config config)
static struct section_aggregate setup_dims(Xt_int start, size_t num_dimensions, struct dim_desc dims[num_dimensions])
static size_t idxsection_get_positions_of_indices_v1(Xt_idxlist body_idxlist, const Xt_int selection_idx[], size_t num_selection, int positions[], int single_match_only)
static size_t idxsection_get_positions_of_indices_v2(Xt_idxlist body_idxlist, const Xt_int selection_idx[], size_t num_selection, int positions[], int single_match_only)
void xt_idxsection_initialize(void)
static void idxsection_create_index_array_cache(Xt_idxsection section)
static int idxsection_get_indices_any(Xt_int start_index, Xt_int *indices, size_t num_dimensions, struct dim_desc dims[num_dimensions])
static MPI_Datatype dim_desc_dt
void xt_idxsection_finalize(void)
static int idxsection_get_position_of_index_off(Xt_idxlist idxlist, Xt_int index, int *position, int offset)
static struct Xt_minmax get_section_minmax(size_t num_dimensions, Xt_int local_start_index, const struct dim_desc dims[num_dimensions])
static size_t idxsection_get_num_index_stripes_(Xt_idxsection section)
static int get_num_indices_from_local_sizes(size_t num_dimensions, const int local_size[num_dimensions])
static Xt_int idxsection_get_max_index(Xt_idxlist idxlist)
static void idxsection_delete(Xt_idxlist data)
Xt_idxlist xt_idxsection_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
static void idxsection_init_sorted_copy(Xt_idxsection orig, Xt_idxsection copy)
static int idxsection_get_num_indices(Xt_idxsection section)
static int idxsection_get_num_index_stripes(Xt_idxlist idxlist)
static void idxsection_pack(Xt_idxlist data, void *buffer, int buffer_size, int *position, MPI_Comm comm)
static size_t idxsection_get_pack_size(Xt_idxlist data, MPI_Comm comm)
static size_t idxsection_get_positions_of_indices_recursive(Xt_int index_offset, int position_offset, const Xt_int indices[], size_t num_indices, int positions[], int ndim, struct dim_desc dims[ndim])
static int idxsection_get_sorting(Xt_idxlist idxlist)
static int idxsection_get_index_at_position(Xt_idxlist idxlist, int position, Xt_int *index)
static size_t idxsection_get_positions_of_indices_v3(Xt_idxlist body_idxlist, const Xt_int *restrict selection_idx, size_t num_selection, int *restrict positions, int single_match_only)
static int idxsection_get_position_of_index(Xt_idxlist idxlist, Xt_int index, int *position)
static Xt_idxlist idxsection_sorted_copy(Xt_idxlist idxlist, Xt_config config)
struct Xt_idxsection_ * Xt_idxsection
Xt_idxlist xt_idxsection_get_idxstripes_intersection(Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, Xt_config config)
static void idxsection_get_index_stripes(Xt_idxlist idxlist, struct Xt_stripe *restrict stripes, size_t num_stripes_alloc)
static Xt_int idxsection_get_min_index(Xt_idxlist idxlist)
Xt_idxlist xt_idxsection_get_intersection(Xt_idxlist idxlist_src, Xt_idxlist idxlist_dst, Xt_config config)
static void idxsection_get_indices(Xt_idxlist idxlist, Xt_int *indices)
static const Xt_int * idxsection_get_indices_const(Xt_idxlist idxlist)
Xt_idxlist xt_idxsection_new(Xt_int start, int num_dimensions, const Xt_int global_size[num_dimensions], const int local_size[num_dimensions], const Xt_int local_start[num_dimensions])
struct Xt_vec_alloc xt_idxvec_alloc(int num_indices)
Xt_idxlist xt_idxvec_congeal(struct Xt_vec_alloc vec_alloc)
#define xt_mpi_call(call, comm)
void xt_assign_id_map_int(size_t n, int *restrict a, int ofs)
#define XT_SORT_FLAGS(ntrans_up, ntrans_dn)