100 {
"irecv_isend_packed",
102 {
"irecv_isend_ddt_packed",
103#ifdef XT_ENABLE_DDT_EXCHANGER
108 xt_exchanger_irecv_isend_ddt_packed },
112#ifdef XT_CAN_USE_MPI_NEIGHBOR_ALLTOALL
117 xt_exchanger_neigh_alltoall },
147 if (eentry != SIZE_MAX)
149 static const char fmt[]
150 =
"error: unexpected exchanger function (%p)!";
151 char buf[
sizeof (fmt) + 3*
sizeof(
void *)];
152 sprintf(buf, fmt, (
void *)exchanger_new);
153 Xt_abort(Xt_default_comm, buf,
filename, __LINE__);
160#ifdef XT_CAN_USE_MPI_NEIGHBOR_ALLTOALL
163 xt_mpi_call(MPI_Comm_test_inter(comm, &flag), comm);
170 return exchanger_new;
177 { .name =
"quicksort",
187 { .name =
"mergesort",
205 .exchanger_team_share = NULL,
235 if (eentry != SIZE_MAX)
237 static const char fmt[]
238 =
"error: unexpected exchanger function (%p)!";
239 char buf[
sizeof (fmt) + 3*
sizeof(
void *)];
240 sprintf(buf, fmt, (
void *)sort_funcs);
241 Xt_abort(Xt_default_comm, buf,
filename, __LINE__);
250 static const char fmt[]
251 =
"error: user-requested exchanger code (%d) does not exist!";
252 char buf[
sizeof (fmt) + 3*
sizeof(
int)];
253 sprintf(buf, fmt, algo);
254 Xt_abort(Xt_default_comm, buf,
filename, __LINE__);
288 *gen = *bucket_gen_iface;
297 static const char fmt[]
298 =
"error: user-requested exchanger code (%d) does not exist!";
299 char buf[
sizeof (fmt) + 3*
sizeof(
int)];
300 const char *msg = buf;
309 if (default_entry == SIZE_MAX) {
310 msg =
"error: invalid default exchanger constructor!";
313 fprintf(stderr,
"warning: %s exchanger unavailable, using "
320 sprintf(buf, fmt, method);
322 Xt_abort(Xt_default_comm, msg,
filename, __LINE__);
350 Xt_abort(Xt_default_comm,
351 "error: automatic opening of OpenMP parallel regions requested,"
352 " but OpenMP is not configured.\n",
filename, __LINE__);
355 int thread_support_provided = MPI_THREAD_SINGLE;
356 xt_mpi_call(MPI_Query_thread(&thread_support_provided), Xt_default_comm);
357 if (thread_support_provided != MPI_THREAD_MULTIPLE)
358 Xt_abort(Xt_default_comm,
359 "error: automatic opening of OpenMP parallel regions requested,"
360 "\n but MPI is not running in thread-safe mode.\n",
371 if (use_stripe_alignment < 0 || use_stripe_alignment > 2)
372 Xt_abort(Xt_default_comm,
373 "error: invalid value passed to "
374 "xt_config_set_dist_dir_stripe_alignment.\n",
filename, __LINE__);
445 const char *config_env = getenv(
"XT_CONFIG_DEFAULT_EXCHANGE_METHOD");
448 if (exchanger_id != -1)
451 fprintf(stderr,
"warning: Unexpected value "
452 "for XT_CONFIG_DEFAULT_EXCHANGE_METHOD=%s\n", config_env);
454 config_env = getenv(
"XT_CONFIG_DEFAULT_IDXVEC_AUTOCONVERT_SIZE");
459 if (!strcmp(config_env,
"INT_MAX")) {
461 endptr = (
char *)config_env + 7;
463 v = strtol(config_env, &endptr, 0);
464 if ((errno == ERANGE && (v == LONG_MAX || v == LONG_MIN))
465 || (errno != 0 && v == 0)) {
466 perror(
"failed to parse value of "
467 "XT_CONFIG_DEFAULT_IDXVEC_AUTOCONVERT_SIZE environment variable");
468 }
else if (endptr == config_env) {
469 fputs(
"malformed value of XT_CONFIG_DEFAULT_IDXVEC_AUTOCONVERT_SIZE"
470 " environment variable, no digits were found\n",
472 }
else if (v < 1 || v > INT_MAX) {
473 fprintf(stderr,
"value of XT_CONFIG_DEFAULT_IDXVEC_AUTOCONVERT_SIZE"
474 " environment variable (%ld) out of range [1,%d]\n",
479 config_env = getenv(
"XT_CONFIG_DEFAULT_MULTI_THREAD_MODE");
482 long v = strtol(config_env, &endptr, 0);
483 if (endptr != config_env) {
484 if ((errno == ERANGE && (v == LONG_MAX || v == LONG_MIN))
485 || (errno != 0 && v == 0)) {
486 perror(
"failed to parse value of "
487 "XT_CONFIG_DEFAULT_MULTI_THREAD_MODE environment variable");
488 goto dont_set_mt_mode;
490 fprintf(stderr,
"numeric value of XT_CONFIG_DEFAULT_MULTI_THREAD_MODE"
491 " environment variable (%ld) out of range [0,%d]\n",
493 goto dont_set_mt_mode;
494 }
else if (*endptr) {
495 fprintf(stderr,
"trailing text '%s' found after numeric value (%*s) in "
496 "XT_CONFIG_DEFAULT_MULTI_THREAD_MODE environment variable\n",
497 endptr, (
int)(endptr-config_env), config_env);
498 goto dont_set_mt_mode;
501 if (!strcasecmp(config_env,
"XT_MT_OPENMP")) {
503 fputs(
"multi-threaded operation requested via "
504 "XT_CONFIG_DEFAULT_MULTI_THREAD_MODE, but OpenMP support is not"
505 " compiled in!\n", stderr);
506 goto dont_set_mt_mode;
510 }
else if (!strcasecmp(config_env,
"XT_MT_NONE")) {
513 fputs(
"unexpected value of XT_CONFIG_DEFAULT_MULTI_THREAD_MODE"
514 " environment variable, unrecognized text or numeral\n",
516 goto dont_set_mt_mode;
523 config_env = getenv(
"XT_CONFIG_DEFAULT_SORT_ALGORITHM");
526 long v = strtol(config_env, &endptr, 0);
527 if (endptr != config_env) {
528 if ((errno == ERANGE && (v == LONG_MAX || v == LONG_MIN))
529 || (errno != 0 && v == 0)) {
530 perror(
"failed to parse value of "
531 "XT_CONFIG_DEFAULT_SORT_ALGORITHM environment variable");
532 goto dont_set_sort_algorithm;
534 fprintf(stderr,
"numeric value of XT_CONFIG_DEFAULT_SORT_ALGORITHM"
535 " environment variable (%ld) out of range [0,%d]\n",
537 goto dont_set_mt_mode;
538 }
else if (*endptr) {
539 fprintf(stderr,
"trailing text '%s' found after numeric value (%*s) in "
540 "XT_CONFIG_DEFAULT_SORT_ALGORITHM environment variable\n",
541 endptr, (
int)(endptr-config_env), config_env);
542 goto dont_set_mt_mode;
545 if (!strcasecmp(config_env,
"QUICKSORT")) {
547 }
else if (!strcasecmp(config_env,
"MERGESORT")) {
550 fputs(
"unexpected value of XT_CONFIG_DEFAULT_SORT_ALGORITHM"
551 " environment variable, unrecognized text or numeral\n",
553 goto dont_set_sort_algorithm;
558dont_set_sort_algorithm:;
560 config_env = getenv(
"XT_CONFIG_DEFAULT_DIST_DIR_STRIPE_ALIGNMENT");
565 if (!strcmp(config_env,
"auto")) {
567 endptr = (
char *)config_env + 4;
568 }
else if (!strcmp(config_env,
"one_by_one")) {
570 endptr = (
char *)config_env + 10;
571 }
else if (!strcmp(config_env,
"always")) {
573 endptr = (
char *)config_env + 6;
575 v = strtol(config_env, &endptr, 0);
576 if ((errno == ERANGE && (v == LONG_MAX || v == LONG_MIN))
577 || (errno != 0 && v == 0)) {
578 perror(
"failed to parse value of "
579 "XT_CONFIG_DEFAULT_DIST_DIR_STRIPE_ALIGNMENT environment variable");
580 }
else if (endptr == config_env) {
581 fputs(
"malformed value of XT_CONFIG_DEFAULT_DIST_DIR_STRIPE_ALIGNMENT\n"
582 " environment variable, no digits or symbolic constant found\n",
584 }
else if (v < 0 || v > 2) {
585 fprintf(stderr,
"value of XT_CONFIG_DEFAULT_DIST_DIR_STRIPE_ALIGNMENT"
586 " environment variable (%ld) out of range [0,2]\n", v);
void xt_mergesort_index(Xt_int *restrict v_idx, int n, int *restrict v_pos, int reset_pos)
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)
add versions of standard API functions not returning on error
void xt_quicksort_index(Xt_int *restrict v_idx, int n, int *restrict v_pos, int reset_pos)
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)
const struct Xt_sort_algo_funcptr * sort_funcs
Xt_exchanger_new exchanger_new
const struct Xt_xmdd_bucket_gen_ * xmdd_bucket_gen
void(* sort_int)(int *a, size_t n)
void xt_config_defaults_init(void)
static const struct @3 exchanger_table[]
static const char filename[]
int xt_sort_algo_id_by_name(const char *name)
int xt_config_get_dist_dir_stripe_alignment(Xt_config config)
void xt_config_set_dist_dir_stripe_alignment(Xt_config config, int use_stripe_alignment)
Xt_xmdd_bucket_gen xt_config_get_xmdd_bucket_gen(Xt_config config)
Xt_config xt_config_new(void)
void xt_config_set_xmdd_bucket_gen(Xt_config config, Xt_xmdd_bucket_gen bucket_gen_iface)
Xt_exchanger_new xt_config_get_exchange_new_by_comm(Xt_config config, MPI_Comm comm)
static const struct @5 sort_algo_table[]
struct Xt_config_ xt_default_config
struct Xt_sort_algo_funcptr func
static size_t sort_algo_by_table(const struct Xt_sort_algo_funcptr *sort_funcs)
static size_t exchanger_by_function(Xt_exchanger_new exchanger_new)
opaque configuration object for settings where the default needs to be overridden
void xt_config_set_idxvec_autoconvert_size(Xt_config config, int cnvsize)
void xt_config_set_redist_mthread_mode(Xt_config config, int mode)
int xt_exchanger_id_by_name(const char *name)
void xt_config_delete(Xt_config config)
void xt_config_set_exchange_method(Xt_config config, int method)
void xt_config_set_sort_algorithm_by_id(Xt_config config, int algo)
int xt_config_get_mem_saving(Xt_config config)
void xt_config_set_mem_saving(Xt_config config, int memconserve)
@ xt_exchanger_irecv_isend
@ xt_exchanger_irecv_send
@ xt_exchanger_irecv_isend_packed
@ xt_exchanger_mix_isend_irecv
int xt_config_get_sort_algorithm_id(Xt_config config)
int xt_config_get_redist_mthread_mode(Xt_config config)
int xt_config_get_idxvec_autoconvert_size(Xt_config config)
int xt_config_get_exchange_method(Xt_config config)
implementation of configuration object
#define XT_CONFIG_GET_FORCE_NOSORT(config)
@ xt_force_dist_dir_striping_bit_ofs
@ xt_mthread_mode_bit_ofs
#define XT_CONFIG_SET_DIST_DIR_STRIPING(config, v)
#define XT_CONFIG_UNSET_FORCE_NOSORT(config)
#define XT_CONFIG_SET_FORCE_NOSORT(config)
#define XT_CONFIG_GET_DIST_DIR_STRIPING(config)
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_ddt_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_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)
Xt_exchanger xt_exchanger_neigh_alltoall_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)
Provide non-public declarations common to all index lists.
#define xt_mpi_call(call, comm)
const struct Xt_xmdd_bucket_gen_ Xt_xmdd_cycl_stripe_bucket_gen_desc
Default bucket generator for creation of distributed directories.
Default bucket generator for creation of distributed directories.