#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "xt/xt_core.h"
#include "xt/xt_stripe.h"
#include "xt_stripe_util.h"
#include "xt/xt_idxlist.h"
#include "xt_idxlist_internal.h"
#include "xt/xt_idxempty.h"
#include "xt/xt_idxvec.h"
#include "xt_idxvec_internal.h"
#include "xt/xt_idxstripes.h"
#include "xt_idxstripes_internal.h"
#include "xt/xt_mpi.h"
#include "xt_idxlist_unpack.h"
#include "core/core.h"
#include "core/ppm_xfuncs.h"
#include "instr.h"
Go to the source code of this file.
|
void | xt_idxlist_delete (Xt_idxlist idxlist) |
|
size_t | xt_idxlist_get_pack_size (Xt_idxlist idxlist, MPI_Comm comm) |
|
void | xt_idxlist_pack (Xt_idxlist idxlist, void *buffer, int buffer_size, int *position, MPI_Comm comm) |
|
Xt_idxlist | xt_idxlist_copy (Xt_idxlist idxlist) |
|
int | xt_idxlist_get_num_indices (Xt_idxlist idxlist) |
|
void | xt_idxlist_get_indices (Xt_idxlist idxlist, Xt_int *indices) |
|
const Xt_int * | xt_idxlist_get_indices_const (Xt_idxlist idxlist) |
|
void | xt_idxlist_get_index_stripes (Xt_idxlist idxlist, struct Xt_stripe **stripes, int *num_stripes) |
|
void | xt_idxlist_get_index_stripes_keep_buf (Xt_idxlist idxlist, struct Xt_stripe **stripes, int *num_stripes) |
|
int | xt_idxlist_get_index_at_position (Xt_idxlist idxlist, int position, Xt_int *idx) |
|
int | xt_idxlist_get_indices_at_positions (Xt_idxlist idxlist, const int *positions, int num_pos, Xt_int *indices, Xt_int undef_idx) |
|
int | xt_idxlist_get_position_of_index (Xt_idxlist idxlist, Xt_int idx, int *position) |
|
int | xt_idxlist_get_positions_of_indices (Xt_idxlist idxlist, Xt_int const *indices, int num_indices, int *positions, int single_match_only) |
|
int | xt_idxlist_get_pos_exts_of_index_stripes (Xt_idxlist idxlist, int num_stripes, const struct Xt_stripe stripes[num_stripes], int *num_ext, struct Xt_pos_ext **pos_ext, int single_match_only) |
|
int | xt_idxlist_get_position_of_index_off (Xt_idxlist idxlist, Xt_int idx, int *position, int offset) |
|
int | xt_idxlist_get_positions_of_indices_off (Xt_idxlist idxlist, const Xt_int *indices, int num_indices, int *positions, int *offsets) |
|
Xt_int | xt_idxlist_get_min_index (Xt_idxlist idxlist) |
|
Xt_int | xt_idxlist_get_max_index (Xt_idxlist idxlist) |
|
static void | get_position_in_ndim_space (Xt_int idx, unsigned ndim, Xt_int global_stride[ndim], Xt_int global_start_index, Xt_int position[ndim]) |
|
void | xt_idxlist_get_bounding_box (Xt_idxlist idxlist, unsigned ndim, const Xt_int global_size[ndim], Xt_int global_start_index, struct Xt_bounds bounds[ndim]) |
|
Xt_uid | xt_idxlist_new_uid (void) |
|
Xt_uid | xt_idxlist_get_uid (Xt_idxlist idxlist) |
|
◆ get_position_in_ndim_space()
static void get_position_in_ndim_space |
( |
Xt_int |
idx, |
|
|
unsigned |
ndim, |
|
|
Xt_int |
global_stride[ndim], |
|
|
Xt_int |
global_start_index, |
|
|
Xt_int |
position[ndim] |
|
) |
| |
|
static |
◆ xt_idxlist_copy()
generates a copy of a given index list
- Parameters
-
[in] | idxlist | index list that is to be copied |
- Returns
- copy of the given index list
Definition at line 93 of file xt_idxlist.c.
◆ xt_idxlist_delete()
destructor for an index list
- Parameters
-
[in] | idxlist | index list that is to be destroyed |
Definition at line 74 of file xt_idxlist.c.
◆ xt_idxlist_get_bounding_box()
void xt_idxlist_get_bounding_box |
( |
Xt_idxlist |
idxlist, |
|
|
unsigned |
ndim, |
|
|
const Xt_int |
global_size[ndim], |
|
|
Xt_int |
global_start_index, |
|
|
struct Xt_bounds |
bounds[ndim] |
|
) |
| |
computes an n-dimensional bounding box around the given index list
- Parameters
-
[in] | idxlist | index list |
[in] | ndim | number of dimension of the bounding box |
[in] | global_size | global size of the n-dimensional index space for which the bounding box is to be computed |
[in] | global_start_index | lowest index of the index space (typically 0 or 1) |
[out] | bounds | bounds of the bounding box |
Definition at line 332 of file xt_idxlist.c.
◆ xt_idxlist_get_index_at_position()
int xt_idxlist_get_index_at_position |
( |
Xt_idxlist |
idxlist, |
|
|
int |
position, |
|
|
Xt_int * |
index |
|
) |
| |
gets the index stored at the specified position in an index list
- Parameters
-
[in] | idxlist | index list |
[in] | position | position of the index that is to be retrieved |
[out] | index | index stored in the index list at the given position |
- Returns
- 0 if index could be retrieved
1 if position is out of range
Definition at line 158 of file xt_idxlist.c.
◆ xt_idxlist_get_index_stripes()
void xt_idxlist_get_index_stripes |
( |
Xt_idxlist |
idxlist, |
|
|
struct Xt_stripe ** |
stripes, |
|
|
int * |
num_stripes |
|
) |
| |
returns the indices stored in an index list the indices are returned in form of stripes (with stride 1)
- Parameters
-
[in] | idxlist | index list for which the indices are to be returned |
[out] | stripes | array containing the stripes (user is responsible for freeing the memory associated with the stripes) |
[out] | num_stripes | number of stripes in array "stripes" |
Definition at line 118 of file xt_idxlist.c.
◆ xt_idxlist_get_index_stripes_keep_buf()
void xt_idxlist_get_index_stripes_keep_buf |
( |
Xt_idxlist |
idxlist, |
|
|
struct Xt_stripe ** |
stripes, |
|
|
int * |
num_stripes |
|
) |
| |
◆ xt_idxlist_get_indices()
gets the indices stored in an index list
- Parameters
-
[in] | idxlist | index list for which the indices are to be returned |
[in,out] | indices | array into which the indices are written |
Definition at line 102 of file xt_idxlist.c.
◆ xt_idxlist_get_indices_at_positions()
int xt_idxlist_get_indices_at_positions |
( |
Xt_idxlist |
idxlist, |
|
|
const int * |
positions, |
|
|
int |
num_pos, |
|
|
Xt_int * |
indices, |
|
|
Xt_int |
undef_idx |
|
) |
| |
get indices stored at the specified positions in an index list
- Parameters
-
[in] | idxlist | index list |
[in] | positions | positions of the selected indices |
[in] | num_pos | number of positions |
[out] | indices | selected indices |
[in] | undef_idx | fallback value that is used if a position is invalid |
- Returns
- zero if no substitutions were necessary or
number of unresolved positions ( == number of undef values assigned to the result)
Definition at line 165 of file xt_idxlist.c.
◆ xt_idxlist_get_indices_const()
gets a pointer of the constant indices stored in an index list
- Parameters
-
[in] | idxlist | index list for which the indices are to be returned |
- Returns
- pointer to const indices array, or NULL if xt_idxlist_get_num_indices(idxlist) == 0
Definition at line 108 of file xt_idxlist.c.
◆ xt_idxlist_get_max_index()
gets the largest index stored in the index list
- Parameters
-
- Returns
- biggest index in idxlist
Definition at line 312 of file xt_idxlist.c.
◆ xt_idxlist_get_min_index()
gets the smallest index stored in the index list
- Parameters
-
- Returns
- smallest index in idxlist
Definition at line 307 of file xt_idxlist.c.
◆ xt_idxlist_get_num_indices()
int xt_idxlist_get_num_indices |
( |
Xt_idxlist |
idxlist | ) |
|
returns the number of indices stored in the given index list
- Parameters
-
[in] | idxlist | index list for which the number of indices is required |
- Returns
- number of indices in the given index list
Definition at line 98 of file xt_idxlist.c.
◆ xt_idxlist_get_pack_size()
computes the buffer size in byte that is required to pack the given index list using MPI_Pack
- Parameters
-
[in] | idxlist | index list for which the packed size needs to be computed |
[in] | comm | MPI communicator that will be used to send the buffer for which the size is computed |
- Returns
- returns an upper bound on the size in bytes of the packed index list
- See also
- xt_idxlist_pack
-
xt_idxlist_unpack
Definition at line 79 of file xt_idxlist.c.
◆ xt_idxlist_get_pos_exts_of_index_stripes()
int xt_idxlist_get_pos_exts_of_index_stripes |
( |
Xt_idxlist |
idxlist, |
|
|
int |
num_stripes, |
|
|
const struct Xt_stripe |
stripes[num_stripes], |
|
|
int * |
num_ext, |
|
|
struct Xt_pos_ext ** |
pos_ext, |
|
|
int |
single_match_only |
|
) |
| |
maps the positions of the first occurrence of the given index stripes in the stored index list
- Parameters
-
[in] | idxlist | index list in which the given index is to be searched |
[in] | num_stripes | number of stripes in the array stripes |
[in] | stripes | stripes of indices that are to be searched |
[out] | num_ext | number of extents allocated in pos_exts |
[out] | pos_ext | ranges of positions for the first occurrence of the indices from stripes in idxlist the pointee is newly allocated and must be freed by the caller |
[in] | single_match_only | if true then do not consider a previous matching position again in the next index search - this is required on the target side in order to avoid multiple writes to the same memory position |
- Returns
- 0 if every index could be found >0 number of indices which could not be found in idxlist
Definition at line 237 of file xt_idxlist.c.
◆ xt_idxlist_get_position_of_index()
int xt_idxlist_get_position_of_index |
( |
Xt_idxlist |
idxlist, |
|
|
Xt_int |
index, |
|
|
int * |
position |
|
) |
| |
gets the position of the first occurrence of the given index in the stored index list
- Parameters
-
[in] | idxlist | index list in which the given index is to be searched |
[in] | index | index that is to be searched |
[out] | position | position of the first occurrence of index in idxlist,
or -1 if there is no match |
- Returns
- 0 if index was found 1 if the index could not be found in idxlist
Definition at line 196 of file xt_idxlist.c.
◆ xt_idxlist_get_position_of_index_off()
int xt_idxlist_get_position_of_index_off |
( |
Xt_idxlist |
idxlist, |
|
|
Xt_int |
index, |
|
|
int * |
position, |
|
|
int |
offset |
|
) |
| |
gets the position of the first occurrence of the given index following the given offset in the stored index list idxlist
- Parameters
-
[in] | idxlist | index list in which the given index is to be searched |
[in] | index | index that is to be searched |
[out] | position | position of the first occurrence of index in idxlist with a position >= offset |
[in] | offset | offset in the index list from which on the search is to be conducted |
- Returns
- 0 if index was found
1 if the index could not be found in idxlist
Definition at line 264 of file xt_idxlist.c.
◆ xt_idxlist_get_positions_of_indices()
int xt_idxlist_get_positions_of_indices |
( |
Xt_idxlist |
idxlist, |
|
|
const Xt_int * |
indices, |
|
|
int |
num_indices, |
|
|
int * |
positions, |
|
|
int |
single_match_only |
|
) |
| |
gets the positions of the first occurrence of the given indices in the stored index list
- Parameters
-
[in] | idxlist | index list in which the given index is to be searched |
[in] | indices | indices that are to be searched |
[in] | num_indices | number of indices in the array "indices" |
[out] | positions | positions of the first occurrence of the indices in idxlist |
[in] | single_match_only | if true then do not consider a previous matching position again in the next index search - this is required on the target side in order to avoid multiple writes to the same memory position |
- Returns
- 0 if every index could be found >0 number of indices which could not be found in idxlist
Definition at line 203 of file xt_idxlist.c.
◆ xt_idxlist_get_positions_of_indices_off()
int xt_idxlist_get_positions_of_indices_off |
( |
Xt_idxlist |
idxlist, |
|
|
const Xt_int * |
indices, |
|
|
int |
num_indices, |
|
|
int * |
positions, |
|
|
int * |
offsets |
|
) |
| |
gets the positions of the first occurrence of the given indices following the given offsets in the stored index list
- Parameters
-
[in] | idxlist | index list in which the given index is to be searched |
[in] | indices | indices that are to be searched |
[in] | num_indices | number of indices in that array "indices" |
[out] | positions | positions of the first occurrence of the indices[i] in idxlist with positions[i] >= offsets[i] |
[in] | offsets | offsets in the index list from which on the search is to be conducted |
- Returns
- 0 if index was found
1 if the index could not be found in idxlist
Definition at line 272 of file xt_idxlist.c.
◆ xt_idxlist_get_uid()
return unique list id, where unique means no other index list will return the same id within the same task, also all valid UIDs are non-zero
- Parameters
-
[in] | idxlist | index list of which to query unique id |
- Returns
- unique id
Definition at line 425 of file xt_idxlist.c.
◆ xt_idxlist_new_uid()
Xt_uid xt_idxlist_new_uid |
( |
void |
| ) |
|
◆ xt_idxlist_pack()
void xt_idxlist_pack |
( |
Xt_idxlist |
idxlist, |
|
|
void * |
buffer, |
|
|
int |
buffer_size, |
|
|
int * |
position, |
|
|
MPI_Comm |
comm |
|
) |
| |
packs an index list into previously allocated buffer using MPI_Pack
- Parameters
-
[in] | idxlist | index list, which needs be packed into the buffer |
[in,out] | buffer | previously allocated buffer into which the index list will be packed |
[in] | buffer_size | size of buffer in bytes |
[in,out] | position | position in buffer at which the data of idxlist will be copied (position is automatically updated to the first byte after the packed data) |
[in] | comm | MPI communicator that will be used to send the buffer |
- See also
- xt_idxlist_get_pack_size
-
xt_idxlist_unpack
Definition at line 85 of file xt_idxlist.c.
◆ nextId