14#include "arcane/impl/internal/VariableSynchronizerComputeList.h"
16#include "arcane/utils/ITraceMng.h"
17#include "arcane/utils/FatalErrorException.h"
18#include "arcane/utils/PlatformUtils.h"
19#include "arcane/utils/OStringStream.h"
20#include "arcane/utils/ValueConvert.h"
22#include "arcane/core/IParallelMng.h"
23#include "arcane/core/IItemFamily.h"
24#include "arcane/core/ItemPrinter.h"
26#include "arcane/impl/DataSynchronizeInfo.h"
27#include "arcane/impl/internal/VariableSynchronizer.h"
40VariableSynchronizerComputeList::
41VariableSynchronizerComputeList(VariableSynchronizer* var_sync)
42: TraceAccessor(var_sync->traceMng())
43, m_synchronizer(var_sync)
44, m_parallel_mng(var_sync->m_parallel_mng)
45, m_item_group(var_sync->m_item_group)
46, m_is_verbose(var_sync->m_is_verbose)
48 if (
auto v = Convert::Type<Int32>::tryParseFromEnvironment(
"ARCANE_DEBUG_VARIABLESYNCHRONIZERCOMPUTELIST",
true))
49 m_is_debug = (v.value() != 0);
74void VariableSynchronizerComputeList::
79 Int32
my_rank = m_parallel_mng->commRank();
80 Int32 nb_rank = m_parallel_mng->commSize();
82 m_is_verbose = traceMng()->verbosityLevel() >= 4;
86 info() <<
"Compute synchronize informations group=" << m_item_group.name()
88 <<
" group size=" << m_item_group.size()
89 <<
" is_verbose=" << m_is_verbose;
101 if (owner == A_NULL_RANK || owner >= nb_rank) {
108 info() <<
"Add entity uid=" << uid
109 <<
" lid=" <<
item_internal.localId() <<
" to the subdomain " << owner;
115 info() <<
"ERROR: The entity uid=" << uid
116 <<
" group=" << m_item_group.name() <<
" doesn't belong to "
117 <<
"any subdomain or belong to an invalid subdomain";
128 info() <<
"End compute synchronize information group=" << m_item_group.name()
129 <<
" Date=" << platform::getCurrentDateTime();
135void VariableSynchronizerComputeList::
147 info(4) <<
"VariableSynchronizer::createList() begin for group=" << m_item_group.name();
161 for (Integer i = 0; i < nb_rank; ++i) {
183 debug() <<
"communicating sub domains my=" <<
nb_comm_rank
223 <<
" begin_date=" << platform::getCurrentDateTime();
228 info() <<
"AllGather end_date=" << platform::getCurrentDateTime();
232 for (Integer index = 0, s = nb_rank; index < s; ++index) {
240 info() <<
"Get for share group " << index <<
' ' <<
nb_elem;
252 for (Integer i = 0; i <
nb_send; ++i) {
274 info() <<
"Infos before auto add: send " <<
nb_send <<
" recv " <<
nb_recv;
277 info() <<
"Ghost: " << i <<
asdi.nbItem() <<
' ' <<
asdi.rank();
281 info() <<
"Shared: " << i <<
' ' <<
asdi.nbItem() <<
' ' <<
asdi.rank();
285 for (Integer i = 0; i <
nb_send; ++i) {
293 debug() <<
"Add communication with the subdomain " <<
proc_id;
298 for (Integer i = 0; i <
nb_recv; ++i) {
306 debug() <<
"Add communication with subdomain " <<
proc_id;
312 ARCANE_FATAL(
"Problem with the number of subdomain shared ({0}) and ghosts ({1})",
327 info(4) <<
"Number of communicating processors: " <<
nb_comm_proc;
336 debug() <<
"Ghost: " << i <<
" " <<
asdi.nbItem() <<
' ' <<
asdi.rank();
340 debug() <<
"Shared: " << i <<
" " <<
asdi.nbItem() <<
' ' <<
asdi.rank();
372 uids[z] =
elem.uniqueId().asInt64();
375 info() <<
"Number of elements that will be sent to the subdomain " <<
send_proc
377 for (Integer z = 0; z <
nb_local; ++z) {
378 info() <<
"Unique id " << uids[z];
383 requests.add(pm->send(uids,
send_proc,
false));
400 debug() <<
"Creating shared entities for the subdomain " <<
recv_proc
416 info() <<
"Wait requests n=" << requests.size()
417 <<
" begin_date=" << platform::getCurrentDateTime();
422 info() <<
"Wait requests end_date=" << platform::getCurrentDateTime();
430 for (Integer i = 0, n =
sync_info->size(); i < n; ++i) {
436 info() <<
"VariableSynchronize:: end compute list group=" << m_item_group.name()
446void VariableSynchronizerComputeList::
455 Int32
my_rank = m_parallel_mng->commRank();
477 for (Integer i_comm = 0; i_comm < nb_comm_proc; ++i_comm) {
478 GhostRankInfo& ghost_info = ghost_rank_info[i_comm];
479 ShareRankInfo& share_info = share_rank_info[i_comm];
480 if (ghost_info.rank() != share_info.rank()) {
481 ARCANE_FATAL(
"Inconsistency between the subdomain numbers ghost_rank={0} share_rank={1}",
482 ghost_info.rank(), share_info.rank());
484 Integer current_proc = ghost_info.rank();
488 if (share_grp.empty() && ghost_grp.empty()) {
489 error() <<
"Shared and ghosts groups null for the subdomain " << current_proc;
493 if (current_proc == my_rank) {
494 error() <<
"Error in the communication pattern: "
495 <<
"the processor can't communicate with itself";
501 for (Integer z = 0, zs = ghost_grp.size(); z < zs; ++z) {
502 const Item& elem = items_internal[ghost_grp[z]];
503 bool is_marked = marked_elem[elem.localId()];
506 if (nb_error < max_error)
507 error() <<
"The entity " << ItemPrinter(elem) <<
" belongs to another ghost group "
508 <<
"or is owned by the subdomain.";
512 marked_elem[elem.localId()] =
true;
515 m_synchronizer->m_sync_info->add(VariableSyncInfo(share_grp, ghost_grp, current_proc));
521 if (!marked_elem[item.localId()]) {
522 if (nb_error < max_error) {
523 error() <<
"The entity " << ItemPrinter(item)
524 <<
" doesn't belong to the subdomain or any ghost group.";
533 if (nb_error >= max_error)
534 error() << nb_error <<
" total elements are incorrectly dealt with";
537 ARCANE_FATAL(
"Error while creating the exchange structures of the family={0}",
544void VariableSynchronizerComputeList::
547 DataSynchronizeInfo* sync_info = m_synchronizer->m_sync_info.get();
548 Integer nb_comm = sync_info->size();
549 info() <<
"SYNC LIST FOR GROUP : " << m_item_group.fullName() <<
" N=" << nb_comm;
551 IItemFamily* item_family = m_item_group.itemFamily();
552 ItemInfoListView items_internal(item_family);
553 for (Integer i = 0; i < nb_comm; ++i) {
554 Int32 target_rank = sync_info->targetRank(i);
555 ostr() <<
" TARGET=" << target_rank <<
'\n';
557 ostr() <<
"\t\tSHARE(lid,uid) n=" << share_ids.
size() <<
" :";
558 for (Integer z = 0, zs = share_ids.size(); z < zs; ++z) {
559 Item item = items_internal[share_ids[z]];
560 ostr() <<
" (" << item.localId() <<
"," << item.uniqueId() <<
")";
564 ostr() <<
"\t\tGHOST(lid,uid) n=" << ghost_ids.
size() <<
" :";
565 for (Integer z = 0, zs = ghost_ids.size(); z < zs; ++z) {
566 Item item = items_internal[ghost_ids[z]];
567 ostr() <<
" (" << item.localId() <<
"," << item.uniqueId() <<
")";
571 info() << ostr.str();
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Informations nécessaires pour synchroniser les entités sur un groupe.
Interface d'une famille d'entités.
virtual String fullName() const =0
Nom complet de la famille (avec celui du maillage)
Interface du gestionnaire de parallélisme pour un sous-domaine.
virtual Int32 commRank() const =0
Rang de cette instance dans le communicateur.
virtual void recv(ArrayView< char > values, Int32 rank)=0
virtual Int32 commSize() const =0
Nombre d'instance dans le communicateur.
virtual void allGather(ConstArrayView< char > send_buf, ArrayView< char > recv_buf)=0
Effectue un regroupement sur tous les processeurs. Il s'agit d'une opération collective....
virtual void waitAllRequests(ArrayView< Request > rvalues)=0
Bloque en attendant que les requêtes rvalues soient terminées.
virtual char reduce(eReduceType rt, char v)=0
Effectue la réduction de type rt sur le réel v et retourne la valeur.
Classe de base pour les entités du maillage.
Vue sur une liste pour obtenir des informations sur les entités.
Classe utilitaire pour imprimer les infos sur une entité.
Classe de base d'un élément de maillage.
constexpr Int32 localId() const
Identifiant local de l'entité dans le sous-domaine du processeur.
bool isOwn() const
true si l'entité est appartient au sous-domaine
ItemUniqueId uniqueId() const
Identifiant unique sur tous les domaines.
impl::ItemBase itemBase() const
Partie interne de l'entité.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Vue modifiable d'un tableau d'un type T.
constexpr bool empty() const noexcept
Retourne true si le tableau est vide (dimension nulle)
Vue constante d'un tableau de type T.
constexpr Integer size() const noexcept
Nombre d'éléments du tableau.
Formattage des réels avec une précision donnée.
Vecteur 1D de données avec sémantique par valeur (style STL).
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
@ Highest
Niveau le plus élevé
Int32 Integer
Type représentant un entier.