Yet Another eXchange Tool 0.11.0
Loading...
Searching...
No Matches
Functions | Variables
xt_idxlist.c File Reference
#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_config_internal.h"
#include "xt_idxlist_unpack.h"
#include "core/core.h"
#include "core/ppm_xfuncs.h"
#include "instr.h"
Include dependency graph for xt_idxlist.c:

Go to the source code of this file.

Functions

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)
 
Xt_idxlist xt_idxlist_sorted_copy (Xt_idxlist idxlist)
 
Xt_idxlist xt_idxlist_sorted_copy_custom (Xt_idxlist idxlist, Xt_config config)
 
int xt_idxlist_get_num_indices (Xt_idxlist idxlist)
 
void xt_idxlist_get_indices (Xt_idxlist idxlist, Xt_int *indices)
 
const Xt_intxt_idxlist_get_indices_const (Xt_idxlist idxlist)
 
int xt_idxlist_get_num_index_stripes (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, size_t num_stripes_alloc)
 
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_pos_exts_of_index_stripes_custom (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, Xt_config config)
 
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)
 
int xt_idxlist_get_sorting (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)
 
bool xt_idxlist_is_stripe_conversion_profitable_ (Xt_idxlist idxlist, Xt_config config)
 
int xt_idxlist_is_stripe_conversion_profitable (Xt_idxlist idxlist, Xt_config config)
 

Variables

static Xt_uid nextId = UINT64_C(1)
 

Detailed Description

Author
Jörg Behrens behre.nosp@m.ns@d.nosp@m.krz.d.nosp@m.e Moritz Hanke hanke.nosp@m.@dkr.nosp@m.z.de Thomas Jahns jahns.nosp@m.@dkr.nosp@m.z.de

Definition in file xt_idxlist.c.

Function Documentation

◆ 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

Definition at line 365 of file xt_idxlist.c.

Here is the caller graph for this function:

◆ xt_idxlist_copy()

Xt_idxlist xt_idxlist_copy ( Xt_idxlist  idxlist)

generates a copy of a given index list

Parameters
[in]idxlistindex list that is to be copied
Returns
copy of the given index list

Definition at line 94 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_delete()

void xt_idxlist_delete ( Xt_idxlist  idxlist)

destructor for an index list

Parameters
[in]idxlistindex list that is to be destroyed

Definition at line 75 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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]idxlistindex list
[in]ndimnumber of dimension of the bounding box
[in]global_sizeglobal size of the n-dimensional index space for which the bounding box is to be computed
[in]global_start_indexlowest index of the index space (typically 0 or 1)
[out]boundsbounds of the bounding box
Remarks
the behaviour of the routine is undefined in case the given index space does not fit the indices
global_size has to be positive

Definition at line 379 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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]idxlistindex list
[in]positionposition of the index that is to be retrieved
[out]indexindex 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 176 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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

Parameters
[in]idxlistindex list for which the indices are to be returned
[out]stripesarray containing the stripes (user is responsible for freeing the memory associated with the stripes)
[out]num_stripesnumber of stripes in array "stripes"

Definition at line 135 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_get_index_stripes_keep_buf()

void xt_idxlist_get_index_stripes_keep_buf ( Xt_idxlist  idxlist,
struct Xt_stripe stripes,
size_t  num_stripes_alloc 
)

Definition at line 147 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_get_indices()

void xt_idxlist_get_indices ( Xt_idxlist  idxlist,
Xt_int indices 
)

gets the indices stored in an index list

Parameters
[in]idxlistindex list for which the indices are to be returned
[in,out]indicesarray into which the indices are written

Definition at line 113 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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]idxlistindex list
[in]positionspositions of the selected indices
[in]num_posnumber of positions
[out]indicesselected indices
[in]undef_idxfallback 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 183 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_get_indices_const()

const Xt_int * xt_idxlist_get_indices_const ( Xt_idxlist  idxlist)

gets a pointer of the constant indices stored in an index list

Parameters
[in]idxlistindex 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 119 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_get_max_index()

Xt_int xt_idxlist_get_max_index ( Xt_idxlist  idxlist)

gets the largest index stored in the index list

Parameters
[in]idxlistindex list
Returns
biggest index in idxlist

Definition at line 354 of file xt_idxlist.c.

Here is the caller graph for this function:

◆ xt_idxlist_get_min_index()

Xt_int xt_idxlist_get_min_index ( Xt_idxlist  idxlist)

gets the smallest index stored in the index list

Parameters
[in]idxlistindex list
Returns
smallest index in idxlist

Definition at line 349 of file xt_idxlist.c.

Here is the caller graph for this function:

◆ xt_idxlist_get_num_index_stripes()

int xt_idxlist_get_num_index_stripes ( Xt_idxlist  idxlist)

returns the number of stripes needed to represent the indices stored in an index list

Parameters
[in]idxlistindex list for which to query the number of stripes
Returns
num_stripes number of stripes in array "stripes"

Definition at line 129 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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]idxlistindex list for which the number of indices is required
Returns
number of indices in the given index list

Definition at line 109 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_get_pack_size()

size_t xt_idxlist_get_pack_size ( Xt_idxlist  idxlist,
MPI_Comm  comm 
)

computes the buffer size in byte that is required to pack the given index list using MPI_Pack

Parameters
[in]idxlistindex list for which the packed size needs to be computed
[in]commMPI 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
Remarks
You need to provide the same buffer for all related calls of xt_idxlist_get_pack_size , xt_idxlist_pack and xt_idxlist_unpack
See also
xt_idxlist_pack
xt_idxlist_unpack

Definition at line 80 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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]idxlistindex list in which the given index is to be searched
[in]num_stripesnumber of stripes in the array stripes
[in]stripesstripes of indices that are to be searched
[out]num_extnumber of extents allocated in pos_exts
[out]pos_extranges 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_onlyif 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 262 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_get_pos_exts_of_index_stripes_custom()

int xt_idxlist_get_pos_exts_of_index_stripes_custom ( 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,
Xt_config  config 
)

Definition at line 275 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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]idxlistindex list in which the given index is to be searched
[in]indexindex that is to be searched
[out]positionposition 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 214 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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]idxlistindex list in which the given index is to be searched
[in]indexindex that is to be searched
[out]positionposition of the first occurrence of index in idxlist with a position >= offset
[in]offsetoffset 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 306 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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]idxlistindex list in which the given index is to be searched
[in]indicesindices that are to be searched
[in]num_indicesnumber of indices in the array "indices"
[out]positionspositions of the first occurrence of the indices in idxlist
[in]single_match_onlyif 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 221 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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]idxlistindex list in which the given index is to be searched
[in]indicesindices that are to be searched
[in]num_indicesnumber of indices in that array "indices"
[out]positionspositions of the first occurrence of the indices[i] in idxlist with positions[i] >= offsets[i]
[in]offsetsoffsets 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
Remarks
a call to xt_idxlist_get_position_of_index_off with offset = NULL is the same as a call to xt_idxlist_get_positions_of_indices

Definition at line 314 of file xt_idxlist.c.

◆ xt_idxlist_get_sorting()

int xt_idxlist_get_sorting ( Xt_idxlist  idxlist)

Inquires if the indices in a list follow some order.

Parameters
[in]idxlistindex list to query for sort
Returns
1 iff sorted in ascending order 0 iff unsorted and no other value applies -1 iff sorted in descending order 2 iff the index list is empty 3 iff the list contains 1 index or more and all values are identical

Definition at line 359 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_get_uid()

Xt_uid xt_idxlist_get_uid ( Xt_idxlist  idxlist)

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]idxlistindex list of which to query unique id
Returns
unique id

Definition at line 472 of file xt_idxlist.c.

◆ xt_idxlist_is_stripe_conversion_profitable()

int xt_idxlist_is_stripe_conversion_profitable ( Xt_idxlist  idxlist,
Xt_config  config 
)

Heuristic to tell if stripe conversion is profitable for an index list.

Parameters
[in]idxlistindex list to query for conversion potential
[in]configcustom configuration parameters
Returns
non-zero if conversion is assumed profitable, 0 if not

Definition at line 495 of file xt_idxlist.c.

Here is the call graph for this function:

◆ xt_idxlist_is_stripe_conversion_profitable_()

bool xt_idxlist_is_stripe_conversion_profitable_ ( Xt_idxlist  idxlist,
Xt_config  config 
)

Definition at line 479 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_new_uid()

Xt_uid xt_idxlist_new_uid ( void  )

Definition at line 454 of file xt_idxlist.c.

Here is the caller graph for this function:

◆ 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]idxlistindex list, which needs be packed into the buffer
[in,out]bufferpreviously allocated buffer into which the index list will be packed
[in]buffer_sizesize of buffer in bytes
[in,out]positionposition in buffer at which the data of idxlist will be copied (position is automatically updated to the first byte after the packed data)
[in]commMPI communicator that will be used to send the buffer
Remarks
The provided buffer needs to have a size that is sufficient for the index list. You can determine the required size using xt_idxlist_get_pack_size .
You need to provide the same buffer for all related calls of xt_idxlist_get_pack_size , xt_idxlist_pack and xt_idxlist_unpack
See also
xt_idxlist_get_pack_size
xt_idxlist_unpack

Definition at line 86 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_sorted_copy()

Xt_idxlist xt_idxlist_sorted_copy ( Xt_idxlist  idxlist)

generates a sorted copy of a given index list

Parameters
[in]idxlistindex list that is to be copied
Returns
copy of the given index list with all indices sorted from lowest to highest

Definition at line 99 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxlist_sorted_copy_custom()

Xt_idxlist xt_idxlist_sorted_copy_custom ( Xt_idxlist  idxlist,
Xt_config  config 
)

generates a sorted copy of a given index list

Parameters
[in]idxlistindex list that is to be copied
[in]configcustom configuration parameters
Returns
copy of the given index list with all indices sorted from lowest to highest

Definition at line 104 of file xt_idxlist.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ nextId

Xt_uid nextId = UINT64_C(1)
static

Definition at line 448 of file xt_idxlist.c.