Yet Another eXchange Tool 0.11.2
Loading...
Searching...
No Matches
xt_config.c File Reference

implementation of configuration object More...

#include <assert.h>
#include <errno.h>
#include <stdint.h>
#include <string.h>
#include <mpi.h>
#include <xt/xt_config.h>
#include <xt/xt_mpi.h>
#include "xt_config_internal.h"
#include "xt_exchanger_irecv_send.h"
#include "xt_exchanger_irecv_isend.h"
#include "xt_exchanger_mix_isend_irecv.h"
#include "xt_exchanger_irecv_isend_packed.h"
#include "xt_exchanger_irecv_isend_ddt_packed.h"
#include "xt_exchanger_neigh_alltoall.h"
#include "xt_idxlist_internal.h"
#include "xt/quicksort.h"
#include "xt/mergesort.h"
#include "xt/xt_xmap_dist_dir_bucket_gen.h"
#include "xt_xmap_dist_dir_bucket_gen_cycl_stripe.h"
#include "xt_xmap_dist_dir_bucket_gen_internal.h"
#include "core/core.h"
#include "core/ppm_xfuncs.h"
Include dependency graph for xt_config.c:

Go to the source code of this file.

Enumerations

enum  { num_exchanger = sizeof (exchanger_table) / sizeof (exchanger_table[0]) }
 
enum  { num_sort_algo = sizeof (sort_algo_table) / sizeof (sort_algo_table[0]) }
 
enum  { XT_MAX_MEM_SAVING = 1 }
 

Functions

Xt_config xt_config_new (void)
 
void xt_config_delete (Xt_config config)
 
int xt_exchanger_id_by_name (const char *name)
 
static size_t exchanger_by_function (Xt_exchanger_new exchanger_new)
 
int xt_config_get_exchange_method (Xt_config config)
 
Xt_exchanger_new xt_config_get_exchange_new_by_comm (Xt_config config, MPI_Comm comm)
 
int xt_sort_algo_id_by_name (const char *name)
 
static size_t sort_algo_by_table (const struct Xt_sort_algo_funcptr *sort_funcs)
 
int xt_config_get_sort_algorithm_id (Xt_config config)
 
void xt_config_set_sort_algorithm_by_id (Xt_config config, int algo)
 
void xt_config_set_mem_saving (Xt_config config, int memconserve)
 
int xt_config_get_mem_saving (Xt_config config)
 
Xt_xmdd_bucket_gen xt_config_get_xmdd_bucket_gen (Xt_config config)
 
void xt_config_set_xmdd_bucket_gen (Xt_config config, Xt_xmdd_bucket_gen bucket_gen_iface)
 
void xt_config_set_exchange_method (Xt_config config, int method)
 
int xt_config_get_idxvec_autoconvert_size (Xt_config config)
 
void xt_config_set_idxvec_autoconvert_size (Xt_config config, int cnvsize)
 
int xt_config_get_redist_mthread_mode (Xt_config config)
 
void xt_config_set_redist_mthread_mode (Xt_config config, int mode)
 
void xt_config_set_dist_dir_stripe_alignment (Xt_config config, int use_stripe_alignment)
 
int xt_config_get_dist_dir_stripe_alignment (Xt_config config)
 
void xt_config_set_xmap_stripe_align (Xt_config config, int use_stripe_align)
 
int xt_config_get_xmap_stripe_align (Xt_config config)
 
void xt_config_defaults_init (void)
 

Variables

static const char filename [] = "xt_config.c"
 
struct { 
 
   char   name [32] 
 
   Xt_exchanger_new   f 
 
   int   code 
 
exchanger_table [] 
 
struct { 
 
   char   name [16] 
 
   struct Xt_sort_algo_funcptr   func 
 
sort_algo_table [] 
 
struct Xt_config_ xt_default_config
 

Detailed Description

implementation of configuration object

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_config.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
num_exchanger 

Definition at line 121 of file xt_config.c.

◆ anonymous enum

anonymous enum
Enumerator
num_sort_algo 

Definition at line 200 of file xt_config.c.

◆ anonymous enum

anonymous enum
Enumerator
XT_MAX_MEM_SAVING 

Definition at line 258 of file xt_config.c.

Function Documentation

◆ exchanger_by_function()

static size_t exchanger_by_function ( Xt_exchanger_new exchanger_new)
inlinestatic

Definition at line 135 of file xt_config.c.

Here is the caller graph for this function:

◆ sort_algo_by_table()

static size_t sort_algo_by_table ( const struct Xt_sort_algo_funcptr * sort_funcs)
inlinestatic

Definition at line 224 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_defaults_init()

void xt_config_defaults_init ( void )
Examples
test_exchanger_parallel.c.

Definition at line 525 of file xt_config.c.

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

◆ xt_config_delete()

void xt_config_delete ( Xt_config config)

destructor of configuration objects

Parameters
[in,out]configconfiguration object to destroy

Definition at line 85 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_get_dist_dir_stripe_alignment()

int xt_config_get_dist_dir_stripe_alignment ( Xt_config config)

Definition at line 383 of file xt_config.c.

◆ xt_config_get_exchange_method()

int xt_config_get_exchange_method ( Xt_config config)

get exchanger used when the config object is passed to constructors

Parameters
[in]configconfiguration object to query
Returns
an entry from Xt_exchangers representing the method of data transfer used

Definition at line 144 of file xt_config.c.

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

◆ xt_config_get_exchange_new_by_comm()

Xt_exchanger_new xt_config_get_exchange_new_by_comm ( Xt_config config,
MPI_Comm comm )

Get appropriate exchanger constructor.

Parameters
configconfiguration object
commcommunicator to use the constructor with
Returns
configured exchanger constructor, or a fallback if the configured constructor does not apply to comm.

Definition at line 158 of file xt_config.c.

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

◆ xt_config_get_idxvec_autoconvert_size()

int xt_config_get_idxvec_autoconvert_size ( Xt_config config)

query size above which index lists of vector type will be converted

For many operations it makes sense to first compress large index vectors to stripes before continuing further computations.

Parameters
[in]configconfiguration object to query
Returns
size of vectors at which conversion happens

Definition at line 327 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_get_mem_saving()

int xt_config_get_mem_saving ( Xt_config config)

Get memory conservation parameter.

Parameters
[in]configconfiguration object to query

Definition at line 269 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_get_redist_mthread_mode()

int xt_config_get_redist_mthread_mode ( Xt_config config)

query multi-thread mode of message passing

Parameters
[in]configconfiguration object to query
Returns
a value matching one of the enum Xt_mthread_mode members above

Definition at line 340 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_get_sort_algorithm_id()

int xt_config_get_sort_algorithm_id ( Xt_config config)

query sorting algorithm suite

Parameters
[in]configconfiguration object to query
Returns
a value matching one of the enum Xt_sort_algorithm members above

Definition at line 232 of file xt_config.c.

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

◆ xt_config_get_xmap_stripe_align()

int xt_config_get_xmap_stripe_align ( Xt_config config)

Get xmap stripe alignment parameter.

Parameters
[in]configconfiguration object to query

Definition at line 399 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_get_xmdd_bucket_gen()

Xt_xmdd_bucket_gen xt_config_get_xmdd_bucket_gen ( Xt_config config)

Query configured bucket generator

Definition at line 276 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_new()

Xt_config xt_config_new ( void )

constructor for configuration object

Returns
returns a configuration object where every setting is set to the corresponding default.

Definition at line 78 of file xt_config.c.

◆ xt_config_set_dist_dir_stripe_alignment()

void xt_config_set_dist_dir_stripe_alignment ( Xt_config config,
int use_stripe_alignment )

Definition at line 374 of file xt_config.c.

Here is the call graph for this function:

◆ xt_config_set_exchange_method()

void xt_config_set_exchange_method ( Xt_config config,
int method )

set exchanger to use when the config object is passed to constructors

Parameters
[in,out]configconfiguration object to modify
methodan entry from enum Xt_exchangers to signify the desired exchanger for data transfers

Definition at line 297 of file xt_config.c.

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

◆ xt_config_set_idxvec_autoconvert_size()

void xt_config_set_idxvec_autoconvert_size ( Xt_config config,
int cnvsize )

set size above which index lists of vector type will be converted

For many operations it makes sense to first compress large index vectors to stripes before continuing further computations. This function sets the size of vectors at which this conversion happens for operations that are called with the configuration object as parameter.

Parameters
[in,out]configconfiguration object to modify
[in]cnvsizesize of vectors at which conversion happens

Definition at line 333 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_set_mem_saving()

void xt_config_set_mem_saving ( Xt_config config,
int memconserve )

Set memory conservation parameter.

Parameters
[in,out]configconfiguration object to modify
memconserveswitch on methods of memory saving currently supported values: 0 and 1

When set to 1, operations parameterized by config will aggressively try to trade memory savings for higher computational cost.

Currently, by not sorting index lists used in xmap construction.

When set to 0, use default trade-offs for space vs. time complexity.

Definition at line 263 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_set_redist_mthread_mode()

void xt_config_set_redist_mthread_mode ( Xt_config config,
int mode )

set multi-thread mode of message passing

Parameters
[in,out]configconfiguration object to modify
[in]modeone of the enum Xt_mthread_mode members above

Definition at line 347 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_set_sort_algorithm_by_id()

void xt_config_set_sort_algorithm_by_id ( Xt_config config,
int algo )

set sorting algorithm suite

Parameters
[in,out]configconfiguration object to modify
[in]algoone of the enum Xt_sort_algorithm members above

Definition at line 245 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_set_xmap_stripe_align()

void xt_config_set_xmap_stripe_align ( Xt_config config,
int use_stripe_align )

Set xmap stripe alignment parameter.

Parameters
[in,out]configconfiguration object to modify
use_stripe_align0: detect element positions one by one, 1: align full stripes to form position extents 2: automatically choose element of stripe alignment

When set to 1, the computations in the xmap constructor can be much more expensive if stripes are very short. When set to 0, use very simple algorithm that positions each element individually but will use memory proportional to the local index list sizes.

By default the xmap constructor switches automatically to stripe alignment if it appears profitable, which might be untrue if the number of resulting stripes/extents is rather high.

Definition at line 389 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_config_set_xmdd_bucket_gen()

void xt_config_set_xmdd_bucket_gen ( Xt_config config,
Xt_xmdd_bucket_gen bucket_gen_iface )

Change generator for buckets in distributed directory The default is a generator that tiles the range of indices of all index lists involved in xmap creation in 1D fashion with stripes.

Definition at line 282 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_exchanger_id_by_name()

int xt_exchanger_id_by_name ( const char * name)

map exchanger name string to method id from Xt_exchangers

Parameters
[in]namestring that is supposed to match the part of the corresponding enum after xt_exchanger_
Returns
for the string "irecv_send", the value of xt_exchanger_irecv_send will be returned, for strings matching no known exchanger, -1 will be returned

Definition at line 126 of file xt_config.c.

Here is the caller graph for this function:

◆ xt_sort_algo_id_by_name()

int xt_sort_algo_id_by_name ( const char * name)

Definition at line 215 of file xt_config.c.

Variable Documentation

◆ code

int code

Definition at line 95 of file xt_config.c.

◆ [struct]

const struct { ... } exchanger_table[]
Initial value:
= {
{ "irecv_send",
{ "irecv_isend",
{ "irecv_isend_packed",
{ "irecv_isend_ddt_packed",
{ "mix_irecv_isend",
{ "neigh_alltoall",
}
@ xt_exchanger_irecv_isend
Definition xt_config.h:77
@ xt_exchanger_irecv_send
Definition xt_config.h:76
@ xt_exchanger_irecv_isend_packed
Definition xt_config.h:78
@ xt_exchanger_irecv_isend_ddt_packed
Definition xt_config.h:81
@ xt_exchanger_neigh_alltoall
Definition xt_config.h:80
@ xt_exchanger_mix_isend_irecv
Definition xt_config.h:79
Xt_exchanger(* Xt_exchanger_new)(int nsend, int nrecv, const struct Xt_redist_msg *send_msgs, const struct Xt_redist_msg *recv_msgs, MPI_Comm comm, int tag_offset, Xt_config config)
Xt_exchanger xt_exchanger_irecv_isend_new(int nsend, int nrecv, const struct Xt_redist_msg *send_msgs, const struct Xt_redist_msg *recv_msgs, MPI_Comm comm, int tag_offset, Xt_config config)
Xt_exchanger xt_exchanger_irecv_isend_packed_new(int nsend, int nrecv, const struct Xt_redist_msg *send_msgs, const struct Xt_redist_msg *recv_msgs, MPI_Comm comm, int tag_offset, Xt_config config)
Xt_exchanger xt_exchanger_irecv_send_new(int nsend, int nrecv, const struct Xt_redist_msg *send_msgs, const struct Xt_redist_msg *recv_msgs, MPI_Comm comm, int tag_offset, Xt_config config)
Xt_exchanger xt_exchanger_mix_isend_irecv_new(int nsend, int nrecv, const struct Xt_redist_msg *send_msgs, const struct Xt_redist_msg *recv_msgs, MPI_Comm comm, int tag_offset, Xt_config config)

◆ f

Definition at line 94 of file xt_config.c.

◆ filename

const char filename[] = "xt_config.c"
static

Definition at line 76 of file xt_config.c.

◆ func

struct Xt_sort_algo_funcptr func

Definition at line 176 of file xt_config.c.

◆ name

char name[16]

Definition at line 93 of file xt_config.c.

◆ [struct]

const struct { ... } sort_algo_table[]
Initial value:
= {
{ .name = "quicksort",
.func = {
.sort_int = xt_quicksort_int,
.sort_xt_int = xt_quicksort_xt_int,
.sort_index = xt_quicksort_index,
.sort_idxpos = xt_quicksort_idxpos,
.sort_xt_int_permutation = xt_quicksort_xt_int_permutation,
.sort_int_permutation = xt_quicksort_int_permutation
},
},
{ .name = "mergesort",
.func = {
.sort_int = xt_mergesort_int,
.sort_xt_int = xt_mergesort_xt_int,
.sort_index = xt_mergesort_index,
.sort_idxpos = xt_mergesort_idxpos,
.sort_xt_int_permutation = xt_mergesort_xt_int_permutation,
.sort_int_permutation = xt_mergesort_int_permutation
},
},
}
void xt_mergesort_index(Xt_int *restrict v_idx, int n, int *restrict v_pos, int reset_pos)
Definition mergesort.c:69
void xt_mergesort_xt_int_permutation(Xt_int *a, size_t n, int *restrict permutation)
void xt_mergesort_idxpos(idxpos_type *v, size_t n)
void xt_mergesort_int_permutation(int *a, size_t n, int *permutation)
void xt_mergesort_int(int a[], size_t n)
void xt_mergesort_xt_int(Xt_int a[], size_t n)
void xt_quicksort_index(Xt_int *restrict v_idx, int n, int *restrict v_pos, int reset_pos)
Definition quicksort.c:71
void xt_quicksort_xt_int_permutation(Xt_int *a, size_t n, int *restrict permutation)
void xt_quicksort_int(int a[], size_t n)
void xt_quicksort_xt_int(Xt_int a[], size_t n)
void xt_quicksort_int_permutation(int *restrict a, size_t n, int *restrict permutation)
void xt_quicksort_idxpos(idxpos_type v[], size_t n)

◆ xt_default_config

struct Xt_config_ xt_default_config
Initial value:
= {
.exchanger_team_share = NULL,
.idxv_cnv_size = CHEAP_VECTOR_SIZE,
.sort_funcs = &sort_algo_table[XT_QUICKSORT].func,
}
static const struct @117030141027020005042111231012044123003044056005 sort_algo_table[]
@ xt_force_xmap_striping_bit_ofs
@ CHEAP_VECTOR_SIZE
#define XT_QUICKSORT
const struct Xt_xmdd_bucket_gen_ Xt_xmdd_cycl_stripe_bucket_gen_desc

Definition at line 204 of file xt_config.c.