16#ifndef TRUSTVect_TPP_included
17#define TRUSTVect_TPP_included
26template<
typename _TYPE_,
typename _SIZE_>
37template<
typename _TYPE_,
typename _SIZE_>
44template<
typename _TYPE_,
typename _SIZE_>
50template<
typename _TYPE_,
typename _SIZE_>
51template<
typename _SCALAR_TYPE_>
54 assert ( (std::is_scalar<_SCALAR_TYPE_>::value) );
55 ajoute_alpha_v(*
this, alpha, y, opt);
60template<
typename _TYPE_,
typename _SIZE_>
66template<
typename _TYPE_,
typename _SIZE_>
77template<
typename _TYPE_,
typename _SIZE_>
90template<
typename _TYPE_,
typename _SIZE_>
101template<
typename _TYPE_,
typename _SIZE_>
106 Cerr <<
"Resize of a distributed array is forbidden!" << finl;
122template<
typename _TYPE_,
typename _SIZE_>
129template<
typename _TYPE_,
typename _SIZE_>
142template<
typename _TYPE_,
typename _SIZE_>
158template<
typename _TYPE_,
typename _SIZE_>
161 assert(std::string(
typeid(*this).name()).find(
"TRUSTVect") != std::string::npos);
162 assert(std::string(
typeid(v).name()).find(
"TRUSTArray") != std::string::npos);
165 if (opt != RESIZE_OPTIONS::NOCOPY_NOINIT)
inject_array(v);
170template<
typename _TYPE_,
typename _SIZE_>
182template<
typename _TYPE_,
typename _SIZE_>
193 allocateOnDevice(*
this);
194 if (opt != RESIZE_OPTIONS::NOCOPY_NOINIT)
203template<
typename _TYPE_,
typename _SIZE_>
212template<
typename _TYPE_,
typename _SIZE_>
222template<
typename _TYPE_,
typename _SIZE_>
231template<
typename _TYPE_,
typename _SIZE_>
235 Process::exit(
"ERROR: from_tid_to_int() not implemented for parallel vect/tab!!");
240template<
typename _TYPE_,
typename _SIZE_>
244 Process::exit(
"ERROR: ref_as_big() not implemented for parallel vect/tab!!");
249template<
typename _TYPE_,
typename _SIZE_>
253 Process::exit(
"ERROR: ref_as_small() not implemented for parallel vect/tab!!");
262template<
typename _TYPE_,
typename _SIZE_>
281template<
typename _TYPE_,
typename _SIZE_>
288 assert( (!std::is_same<_SIZE_, trustIdType>::value) );
294template<
typename _TYPE_,
typename _SIZE_>
300template<
typename _TYPE_,
typename _SIZE_>
312 Process::exit(
"echange_espace_virtuel() called on big array or array of int!");
317 Process::exit(
"echange_espace_virtuel() called on big array or array of TID!");
322 Process::exit(
"echange_espace_virtuel() called on big array or array of double!");
327 Process::exit(
"echange_espace_virtuel() called on big array or array of float!");
333 Process::exit(
"start_echange_espace_virtuel_async(const std::string kernel_name) called on big array or array of int!");
338 Process::exit(
"start_echange_espace_virtuel_async(const std::string kernel_name) called on big array or array of TID!");
343 Process::exit(
"start_echange_espace_virtuel_async(const std::string kernel_name) called on big array or array of double!");
348 Process::exit(
"start_echange_espace_virtuel_async(const std::string kernel_name) called on big array or array of float!");
354 Process::exit(
"finish_echange_espace_virtuel_async(const std::string kernel_name) called on big array or array of int!");
359 Process::exit(
"finish_echange_espace_virtuel_async(const std::string kernel_name) called on big array or array of TID!");
364 Process::exit(
"finish_echange_espace_virtuel_async(const std::string kernel_name) called on big array or array of double!");
369 Process::exit(
"finish_echange_espace_virtuel_async(const std::string kernel_name) called on big array or array of float!");
376template<
typename _TYPE_,
typename _SIZE_>
381 os << (int)-1 << finl;
385template<
typename _TYPE_,
typename _SIZE_>
394template<
typename _TYPE_,
typename _SIZE_>
403 resize(sz, RESIZE_OPTIONS::NOCOPY_NOINIT);
407 Cerr <<
"Error in TRUSTVect::lit(Entree & is): array has already a structure with incorrect size" << finl;
418 const _SIZE_ sz_max = 128000;
419 _SIZE_ buffer_size = std::min(sz,sz_max);
421 while(sz>buffer_size)
423 is.
get(tmp.
addr(), buffer_size);
437 if (!std::is_same<_TYPE_,int>::value)
442 is >> it_communs_tot;
448template<
typename _TYPE_,
typename _SIZE_>
449template<
typename _SCALAR_TYPE_>
452 ajoute_alpha_v(*
this, alpha, y, opt);
455template<
typename _TYPE_,
typename _SIZE_>
456template<
typename _SCALAR_TYPE_>
462template<
typename _TYPE_,
typename _SIZE_>
463template<
typename _SCALAR_TYPE_>
466 ajoute_operation_speciale_generic<TYPE_OPERATION_VECT_SPEC::SQUARE_,_TYPE_>(*
this,alpha,y,opt);
Sert a relire ancinne structure parallele.
virtual int get(int *ob, std::streamsize n)
virtual bool validate(trustIdType sz_array, int line_size) const
virtual int get_nb_items_reels() const
: Cette classe est un OWN_PTR mais l'objet pointe est partage entre plusieurs
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
static bool is_sequential()
void from_tid_to_int(TRUSTArray< int, int > &out) const
void attach_array(const TRUSTArray &a, _SIZE_ start=0, _SIZE_ size=-1)
void resize_array_(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ size_array() const
virtual void ref_array(TRUSTArray &, _SIZE_ start=0, _SIZE_ sz=-1)
TRUSTArray & inject_array(const TRUSTArray &source, _SIZE_ nb_elements=-1, _SIZE_ first_element_dest=0, _SIZE_ first_element_source=0)
void ref_as_big(TRUSTArray< _TYPE_, trustIdType > &out) const
void ref_as_small(TRUSTArray< _TYPE_, int > &out) const
bool isDataOnDevice() const
TRUSTArray & operator=(const TRUSTArray &)
virtual void ref_data(_TYPE_ *ptr, _SIZE_ size)
Sortie & printOn(Sortie &os) const override
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
void ref_as_small(TRUSTVect< _TYPE_, int > &out) const
virtual void finish_echange_espace_virtuel_async(const std::string kernel_name)
_SIZE_ size_totale() const
void copy(const TRUSTArray< _TYPE_, int > &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
TRUSTVect & operator=(const TRUSTVect &)
virtual void lit(Entree &, bool resize_and_read=1)
virtual void jump(Entree &)
void ref_as_big(TRUSTVect< _TYPE_, trustIdType > &out) const
void copy_(const TRUSTVect &v, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
virtual void set_md_vector(const MD_Vector &)
_SIZE_ size_reelle() const
virtual void start_echange_espace_virtuel_async(const std::string kernel_name)
_SIZE_ size_reelle_ok() const
void from_tid_to_int(TRUSTVect< int, int > &out) const
void ref_array(TRUSTArray< _TYPE_, _SIZE_ > &, _SIZE_ start=0, _SIZE_ sz=-1) override
void resize_vect_(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
void ajoute_carre(_SCALAR_TYPE_ alpha, const TRUSTVect &y, Mp_vect_options opt=VECT_ALL_ITEMS)
virtual void ecrit(Sortie &) const
void ajoute(_SCALAR_TYPE_ alpha, const TRUSTVect &y, Mp_vect_options opt=VECT_ALL_ITEMS)
void set_line_size_(int n)
void ajoute_sans_ech_esp_virt(_SCALAR_TYPE_ alpha, const TRUSTVect &y, Mp_vect_options opt=VECT_REAL_ITEMS)
void ref_data(_TYPE_ *ptr, _SIZE_ new_size) override
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
virtual const MD_Vector & get_md_vector() const
void ajoute_produit_scalaire(_SCALAR_TYPE_ alpha, const TRUSTVect &x, const TRUSTVect &y, Mp_vect_options opt=VECT_ALL_ITEMS)
virtual void ref(const TRUSTVect &)
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
void resize_tab(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) override