16#ifndef Debog_Pb_TPP_included
17#define Debog_Pb_TPP_included
20static int msg_debog_breakpoint = 0;
21inline void debog_breakpoint() { }
22inline void debog_break_test(
int msg) {
if (msg == msg_debog_breakpoint) debog_breakpoint(); }
24template<
typename _TYPE_>
29 Cerr <<
"WARNING in Debog::verifier_gen: array has no parallel metadata. Not checked\n (message: " << msg <<
")" << finl;
31 log_file_ <<
"WARNING in Debog::verifier_gen: array has no parallel metadata. Not checked\n (message: " << msg <<
")" << finl;
33 detailed_log_file_ <<
"WARNING in Debog::verifier_gen: array has no parallel metadata. Not checked\n (message: " << msg <<
")" << finl;
55 if (n != nb_items_seq * ls)
57 Cerr <<
"Error in Debog_Pb::verifier_gen : wrong sequential size " << n <<
" (expected " << nb_items_seq * ls <<
")" << finl;
63template <
typename _TYPE_>
76 const int n = parts.
size();
78 for (
int i = 0; i < n; i++)
85 if (s0 > std::numeric_limits<int>::max())
86 Process::exit(
"Debog_Pb::verifier_partie() - case is too big to be checked with Debog_Pb!!");
87 const int sequential_size =
static_cast<int>(s0);
91 ref_part.
ref_array(cast_array, index, sequential_size * line_size);
94 index += sequential_size * line_size;
99template <
typename _TYPE_>
112 for (
int i = 0; i < size; i++)
113 if (arr.
addr()[i] != array.
addr()[i])
115 Cerr <<
"An array has a wrong status of HostDevice!" << finl;
122 static constexpr bool IS_DOUBLE = std::is_same<_TYPE_,double>::value;
132 const _TYPE_ adim1 = local_max_abs_vect(reference);
135 const _TYPE_ adim2 = mp_max_abs_vect(arr, VECT_REAL_ITEMS);
136 adim = std::max(adim1, adim2);
140 Cerr <<
"Error in Debog.cpp verifier_partie_std: seuil_absolu <= 0" << finl;
148 log_file_ <<
" OK : All values below seuil_absolu_ (" <<
seuil_absolu_ <<
") id=" << identificateur << finl;
157 _TYPE_ max_err_items_reels = 0, max_err_items_virt = 0;
161 for (
int step = 0; step < 2; step++)
164 const char * message;
168 message =
"on real item:";
173 message =
"on virtual item:";
176 const _TYPE_ *arr_ptr = arr.
addr();
182 const int i1 = i * ls;
183 const int i2 = renum[i] * ls;
184 for (
int j = 0; j < ls; j++)
186 const _TYPE_ x = arr_ptr[i1 + j];
187 const _TYPE_ y = reference[i2 + j];
191 const _TYPE_ delta = (_TYPE_)std::fabs(x - y) / adim;
192 max_err = std::max(max_err, delta);
194 if (step == 0 && !(x >= -DMAXFLOAT && x <= DMAXFLOAT))
198 detailed_log_file_ <<
" DIFF " << message <<
" reference[" << i2 + j <<
"]=" << y <<
" \tcurrent[" << i1 + j
199 <<
"]=" << x <<
" \trelative error=" << delta << finl;
207 detailed_log_file_ <<
" DIFF " << message <<
" reference[" << i2 + j <<
"]=" << y <<
" \tcurrent[" << i1 + j
208 <<
"]=" << x << finl;
219 max_err_items_reels = max_err;
221 max_err_items_virt = max_err;
224 const char * resu = 0;
225 int call_error_function = 0;
228 if (max_err_items_reels <= seuil)
230 if (max_err_items_virt <= seuil)
233 resu =
"OK REAL ONLY ";
237 call_error_function = 1;
241 resu =
"ERROR(DMAXFLT)";
246 log_file_ <<
" " << resu <<
" : Max relative error " << max_err_items_reels <<
" (max ref value=" << adim <<
") id=" << identificateur << finl;
248 log_file_ <<
" " << resu <<
" : integer field " << identificateur << finl;
252 detailed_log_file_ <<
" " << resu <<
" : Max relative error " << max_err_items_reels <<
" (max ref value=" << adim <<
") id=" << identificateur << finl;
256 if (call_error_function)
264 Cerr <<
"Error in Debog_Pb::verifier_partie_std: the array provided to store the reference value\n"
265 <<
" does not have the same size/descriptor as the source array" << finl;
269 log_file_ <<
" Return reference value (including virtual items)" << finl;
271 _TYPE_ *arr_ptr = arr_ref.
addr();
272 for (
int ibis = 0; ibis < n; ibis++)
276 const int i1 = ibis * ls;
277 const int i2 = renum[ibis] * ls;
278 for (
int j = 0; j < ls; j++)
280 const _TYPE_ y = reference[i2 + j];
288template <
typename _TYPE_>
293 Cerr <<
"WARNING in Debog::ecrire: array has no parallel metadata" << finl;
294 Cerr <<
" (message: " << msg <<
")" << finl;
303 Cerr <<
"DEBOG: writing array, message " <<
debog_msg_count_ <<
" : " << msg << finl;
305 os << num_deb << finl;
313 const int n = tab.
nb_dim();
318 for (
int i = 1; i < n; i++)
329template<
typename _TYPE_>
342 const int n = parts.
size();
343 for (
int i = 0; i < n; i++)
351template<
typename _TYPE_>
374template<
typename _TYPE_> std::enable_if_t< (std::is_convertible<_TYPE_, double>::value) || (std::is_convertible<_TYPE_, int>::value),
void >
377 static constexpr bool IS_DOUBLE = std::is_same<_TYPE_,double>::value;
388 Cerr <<
"DEBOG: writing scalar, message " <<
debog_msg_count_ <<
" : " << msg << finl;
401 const _TYPE_ adim = (_TYPE_)std::max(std::fabs(x), std::fabs(y));
402 const _TYPE_ delta = (_TYPE_)std::fabs(x - y);
407 detailed_log_file_ <<
" DIFF (double) reference=" << y <<
" \tcurrent=" << x <<
" \trelative error=" << delta / adim <<
" \t(max ref value=" << adim <<
")" << finl;
412 err = ((x - y) != 0);
413 if (err)
detailed_log_file_ <<
" DIFF (int) reference=" << y <<
" \tcurrent=" << x << finl;
420 const char *ok = (err > 0.) ?
" ERROR " :
" OK ";
423 log_file_ << ok <<
" : comparing double: reference=" << y <<
" absolute error=" << err << finl;
428 log_file_ << ok <<
" : comparing int: reference=" << y << finl;
435 log_file_ <<
" Request reference value" << finl;
This class allows to access the individual sub-parts of 'const DoubleTab' objects that have a MD_Vect...
void ecrire_gen(const char *const msg, const TRUSTVect< _TYPE_ > &arr, int num_deb=-1)
void ecrire_partie(const TRUSTVect< _TYPE_ > &arr)
SFichier write_debog_data_file_
const IntVect & find_renum_vector(const MD_Vector &, Nom &id) const
void goto_msg(const char *const msg)
EFichier debog_data_file_
EcrFicCollecte detailed_log_file_
void error_function()
methode appelee des qu'une erreur est trouvee dans l'espace reel.
std::enable_if_t<(std::is_convertible< _TYPE_, double >::value)||(std::is_convertible< _TYPE_, int >::value), void > verifier(const char *const msg, _TYPE_, _TYPE_ *refvalue=0)
void verifier_partie(const TRUSTVect< _TYPE_ > &reference, const TRUSTVect< _TYPE_ > &arr, TRUSTVect< _TYPE_ > *arr_ref=0)
void verifier_gen(const char *const msg, const TRUSTVect< _TYPE_ > &arr, TRUSTVect< _TYPE_ > *arr_ref=0)
int test_ignore_msg(const char *const msg)
void verifier_partie_std(const TRUSTVect< _TYPE_ > &reference, const TRUSTVect< _TYPE_ > &arr, TRUSTVect< _TYPE_ > *arr_ref=0)
Base class for distributed vectors parallel descriptors.
virtual trustIdType nb_items_seq_tot() const
Metadata for a distributed composite vector.
Dummy parallel descriptor used for sequential computations.
C'est le plus simple des descripteurs, utilise pour les tableaux de valeurs aux sommets,...
const MD_Vector_base & valeur() const
class Nom Une chaine de caractere pour nommer les objets de TRUST
static double mp_max(double)
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Represents a an array of int/int64/double/... values.
_SIZE_ size_array() const
DataLocation get_data_location()
void set_data_location(DataLocation flag)
: Tableau a n entrees pour n<= 4.
void ref_array(TRUSTArray< _TYPE_, _SIZE_ > &, _SIZE_ start=0, _SIZE_ sz=-1) override
_SIZE_ dimension(int d) const
_SIZE_ size_totale() const
virtual const MD_Vector & get_md_vector() const