Skip to content
Snippets Groups Projects
Commit 9cd9ea47 authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Add query function for appropriate exchanger constructor.

* Because inter-communicators cannot be used with the neighbor alltoall
  exchanger, an alternative needs to be picked in that case.
parent 5ee6a795
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,7 @@
#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"
......@@ -141,6 +142,22 @@ int xt_config_get_exchange_method(Xt_config config)
Xt_abort(Xt_default_comm, buf, "xt_config.c", __LINE__);
}
Xt_exchanger_new
xt_config_get_exchange_new_by_comm(Xt_config config, MPI_Comm comm)
{
Xt_exchanger_new exchanger_new = config->exchanger_new;
#if MPI_VERSION >= 3
if (exchanger_new == xt_exchanger_neigh_alltoall_new) {
int flag;
xt_mpi_call(MPI_Comm_test_inter(comm, &flag), comm);
if (flag)
exchanger_new = xt_exchanger_mix_isend_irecv_new;
}
#else
(void)comm;
#endif
return exchanger_new;
}
void xt_config_set_exchange_method(Xt_config config, int method)
{
......
......@@ -86,6 +86,17 @@ extern struct Xt_config_ xt_default_config;
PPM_DSO_INTERNAL void
xt_config_defaults_init(void);
/**
* Get appropriate exchanger constructor.
*
* @param config configuration object
* @param comm communicator to use the constructor with
* @returns configured exchanger constructor, or a fallback if the
* configured constructor does not apply to \a comm.
*/
PPM_DSO_INTERNAL Xt_exchanger_new
xt_config_get_exchange_new_by_comm(Xt_config config, MPI_Comm comm);
/*
* Local Variables:
* c-basic-offset: 2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment