16#ifndef communications_included
17#define communications_included
19#include <communications_array.h>
20#include <TRUSTTabs_forward.h>
26#define MPI_ENTIER MPI_LONG
28#define MPI_ENTIER MPI_INT
33bool envoyer(
const Objet_U& t,
int source,
int cible,
int canal);
34bool envoyer(
const Objet_U& t,
int cible,
int canal);
35bool recevoir(
Objet_U& t,
int source,
int cible,
int canal);
36bool recevoir(
Objet_U& t,
int source,
int canal);
37bool envoyer_broadcast(
Objet_U& t,
int source);
39void assert_parallel(
const Objet_U& obj);
40bool is_parallel_object(
const Objet_U& obj);
41bool is_parallel_object(
const double x);
42bool is_parallel_object(
const int x);
44bool is_parallel_object(
const trustIdType x);
52bool envoyer_all_to_all(std::vector<long long>& src, std::vector<long long>& dest);
53void envoyer_all_to_all(
const DoubleTab& src, DoubleTab& dest);
54void envoyer_all_gather(
const DoubleTab& src, DoubleTab& dest);
55void envoyer_gather(
const IntTab& src, IntTab& dest,
int root);
56void envoyer_gather(
const DoubleTab& src, DoubleTab& dest,
int root);
57void envoyer_all_gather(
const IntTab& src, IntTab& dest);
58void envoyer_all_gatherv(
const DoubleTab& src, DoubleTab& dest,
const IntTab& recv_size);
60bool reverse_send_recv_pe_list(
const ArrOfInt& src_list, ArrOfInt& dest_list);
61bool comm_check_enabled();
69template<
typename _TYPE_> std::enable_if_t<std::is_arithmetic<_TYPE_>::value,
bool >
70inline envoyer(
const _TYPE_ t,
int source,
int cible,
int canal)
72 return envoyer_array<_TYPE_>(&t, 1, source, cible, canal);
76inline bool envoyer(
const long t,
int source,
int cible,
int canal) {
return envoyer_array<long>(&t, 1, source, cible, canal); }
79template<
typename _TYPE_> std::enable_if_t<std::is_arithmetic<_TYPE_>::value,
bool >
80inline envoyer(
const _TYPE_ t,
int cible,
int canal)
82 return envoyer_array<_TYPE_>(&t, 1,
Process::me(), cible, canal);
86inline bool envoyer(
const long t,
int cible,
int canal) {
return envoyer_array<long>(&t, 1,
Process::me(), cible, canal); }
89template<
typename _TYPE_> std::enable_if_t<std::is_arithmetic<_TYPE_>::value,
bool >
90inline recevoir(_TYPE_& t,
int source,
int cible,
int canal)
92 return recevoir_array<_TYPE_>(&t, 1, source, cible, canal);
96inline bool recevoir(
long& t,
int source,
int cible,
int canal) {
return recevoir_array<long>(&t, 1, source, cible, canal); }
99template<
typename _TYPE_> std::enable_if_t<std::is_arithmetic<_TYPE_>::value,
bool >
100inline recevoir(_TYPE_& t,
int source,
int canal)
102 return recevoir_array<_TYPE_>(&t, 1, source,
Process::me(), canal);
106inline bool recevoir(
long& t,
int source,
int canal) {
return recevoir_array<long>(&t, 1, source,
Process::me(), canal); }
109template<
typename _TYPE_> std::enable_if_t<std::is_arithmetic<_TYPE_>::value,
bool >
110inline envoyer_broadcast(_TYPE_& t,
int source)
112 return envoyer_broadcast_array<_TYPE_>(&t, 1, source);
116inline bool envoyer_broadcast(
long& t,
int source) {
return envoyer_broadcast_array<long>(&t, 1, source); }
122template<
typename _TYPE_> std::enable_if_t<(std::is_arithmetic<_TYPE_>::value),
void >
123inline assert_parallel(
const _TYPE_ x)
127 if (!is_parallel_object(x))
129 Cerr <<
"Fatal error in template<typename _TYPE_>assert_parallel(const _TYPE_ x). See log files" << finl;
130 Process::Journal() <<
"Error in template<typename _TYPE_>assert_parallel(const _TYPE_ x)" <<
"This processor has this value: " << x << finl;
142template<
typename _TYPE_>
: This class describes a group of processors on which
static int check_enabled()
int nproc() const
Returns the number of processors in the group *this.
virtual void all_to_all(const void *src_buffer, void *dest_buffer, int data_size) const =0
Base class for TRUST objects (Objet_U).
static const Comm_Group & current_group()
Returns a reference to the current active processor group.
static Sortie & Journal(int message_level=0)
Returns a static Sortie object used as an event journal.
static void barrier()
Synchronizes all processors in the current group (waits until all processors have reached the barrier...
static int me()
Returns the rank of the local processor in the current communication group. See Comm_Group::rank() an...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Represents a an array of int/int64/double/... values.
_SIZE_ size_array() const
TRUSTArray & inject_array(const TRUSTArray &source, _SIZE_ nb_elements=-1, _SIZE_ first_element_dest=0, _SIZE_ first_element_source=0)
void resize_array(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
N-dimensional array for N <= 4.