16#ifndef Schema_Comm_Vecteurs_included
17#define Schema_Comm_Vecteurs_included
19#include <TRUSTArray.h>
21enum IsExchangeBlocking
55extern bool check_comm_vector;
63 template <
typename _TYPE_>
66 template <
typename _TYPE_>
69 template <
typename _TYPE_>
74 void exchange(IsExchangeBlocking exchange_type = IsExchangeBlocking::DefaultBlocking,
const std::string kernel_name=
"noname");
80 inline void add(
int pe,
int size, ArrOfInt& procs, ArrOfInt& buf_sizes,
int align_size);
112 static ArrOfTID tmp_area_tid_;
127 void init(
int size,
bool bufferOnDevice);
141#define BLOCSIZE_INT(sz) (sz<<3)
143#define BLOCSIZE_INT(sz) (sz<<2)
144#define BLOCSIZE_TID(sz) (sz<<3)
147#define BLOCSIZE_INT(sz) (sz<<2)
150#define BLOCSIZE_DOUBLE(sz) (sz<<3)
151#define BLOCSIZE_FLOAT(sz) (sz<<2)
152#define ALIGN_SIZE(ptr,sz) ptr=sdata_.buffer_base_+((ptr-sdata_.buffer_base_+(sz-1))&(~(sz-1)))
158 int& x = buf_sizes[pe];
159 if (x == 0 && size > 0)
162 if (n > 0 && procs[n - 1] > pe)
166 x = ((x + align_size - 1) & (~(align_size - 1))) + size;
238 ALIGN_SIZE(
sdata_.buf_pointers_[pe],
sizeof(
int));
240 int *bufptr = (
int *) (
sdata_.buf_pointers_[pe]);
242 sdata_.buf_pointers_[pe] += BLOCSIZE_INT(size);
257 tmp_area_tid_.ref_data(bufptr, size);
258 return tmp_area_tid_;
265 ALIGN_SIZE(
sdata_.buf_pointers_[pe],
sizeof(
double));
267 double *bufptr = (
double *) (
sdata_.buf_pointers_[pe]);
269 sdata_.buf_pointers_[pe] += BLOCSIZE_DOUBLE(size);
272 if (check_comm_vector)
286 ALIGN_SIZE(
sdata_.buf_pointers_[pe],
sizeof(
float));
288 float *bufptr = (
float *) (
sdata_.buf_pointers_[pe]);
290 sdata_.buf_pointers_[pe] += BLOCSIZE_FLOAT(size);
297#undef BLOCSIZE_DOUBLE
Donnees statiques communes a toutes les classes Schema_Comm_Vecteur, avec destructeur pour liberer la...
int buffer_base_device_size_
void init(int size, bool bufferOnDevice)
Schema_Comm_Vecteurs_Static_Data()
~Schema_Comm_Vecteurs_Static_Data()
void add_send_area_template(int pe, int size)
static Schema_Comm_Vecteurs_Static_Data sdata_
static ArrOfDouble tmp_area_double_
int check_next_area(int pe, int byte_size) const
verifie qu'il reste au moins byte_size octets dans le buffer du processeur pe
TRUSTArray< _TYPE_ > & get_next_area_template(int pe, int array_size)
void add_recv_area_template(int pe, int size)
void end_init()
Une fois les donnees a echanger declarees avec add_send/recv_area_.
void begin_init()
Reinitialise les tailles de buffers.
static ArrOfInt tmp_area_int_
int check_buffers_full() const
Selon status_, verifie que tous les pointeurs de buffers pointent a la fin du buffer aloue pour chaqu...
static ArrOfFloat tmp_area_float_
static bool buffer_locked_
void exchange(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
void begin_comm(bool bufferOnDevice=false)
Commence un nouvel echange de donnees (les tailles de buffers doivent avoir ete initialisees avec beg...
static void CleanMyStaticViews()
void add(int pe, int size, ArrOfInt &procs, ArrOfInt &buf_sizes, int align_size)
Represents a an array of int/int64/double/... values.
void append_array(_TYPE_ valeur)
_SIZE_ size_array() const