#include <reference_manager.h>
Inheritance diagram for ReferenceManager< Ref >:

Public Member Functions | |
| void | AttachDuoDistributedVector (void *v, ContenerTableauRefAtome< Ref > *c) |
| request attaching a given duodistributed vecotr with a given contener c | |
| void | AttachVector (double *v, ContenerTableauRefAtome< Ref > *c) |
| request attaching a given vector v with a given contener c | |
| ReferenceManager (MPI_Comm c) | |
| ContenerTableauRefAtome< Ref > & | RequestCreationSubSet (char *name) |
| the contener of subsets of atoms may only be created through refmanager | |
| void | UpdateRefSubSets () |
| function that start the updating process of all attached structures | |
| virtual | ~ReferenceManager () |
Protected Member Functions | |
| void | AdjustSizeRecvBuffers (std::map< int, std::vector< double > > &recv_buffer, std::map< int, std::vector< int > > &recv_buffer2) |
| in exchanging attached values this function set correct size to buffers | |
| void | AnalyseSubSets () |
| analyse the sent atoms to compute the mask needed to exchange attached values | |
| void | BuildSendingBuffers (std::map< int, std::vector< double > > &send_buffer, std::map< int, std::vector< int > > &send_buffer2) |
| in exchanging attached values this function build sending buffers | |
| void | CheckSubSetsCardinal () |
| check the saved cardinals of the subsets | |
| void | ClearSTL () |
| clear all internal structures (based on STL) | |
| void | CreationExchangedAtomsInSubSets () |
| create in the subsets the atoms locally created by migration process | |
| void | DecodeBuffers (std::map< int, std::vector< double > > &recv_buffer, std::map< int, std::vector< int > > &recv_buffer2) |
| in exchanging attached values this function decode the sended buffers | |
| void | ExchangeSubSetAttachedValues () |
| perform real value exchange communication | |
| void | ExchangeSubSetsMasks () |
| perform the exchange to let know the ownership mask of migrated atoms | |
| void | PrintBilanToScreen () |
| print bilan for concerned conteneur : used only to debug | |
Protected Attributes | |
| std::map< int, std::vector< void * > > | attached_duo |
| attached duos that need to be updated as well as the conteners | |
| std::map< Ref, std::map< int, std::vector< double > >, typename Ref::RefComparator > | attached_values |
| attached values (we won't send complete vector) | |
| std::map< Ref, std::map< int, std::vector< int > >, typename Ref::RefComparator > | attached_values_duo |
| attached values in the duodistributed vector | |
| std::map< int, std::vector< double * > > | attached_vectors |
| attached vectors that need to be updated as well as the conteners | |
| std::map< Ref, int, typename Ref::RefComparator > | concerned_conteneurs_recv |
| mapping between received atoms and the mask giving ownership to each subsets in chrage | |
| std::map< Ref, int, typename Ref::RefComparator > | concerned_conteneurs_sent |
| mapping between sent atoms and the mask giving ownership to each subsets in chrage | |
| std::vector< ContenerTableauRefAtome< Ref > * > | conteneurs |
| contener in charge (management of atom subsets ) | |
| bool | have_changed |
| flag to notify if updating of attached references needed | |
| std::map< Ref, Ref, typename Ref::RefComparator > | moved |
| mapping between moved atoms old ref and new ref | |
| std::map< int, std::vector< Ref > > | newatoms |
| new atoms generated by migration (received) | |
| int | rank |
| std::map< Ref, int, typename Ref::RefComparator > | sent |
| mapping between sent atom ref and new proc owner | |
| std::map< int, std::vector< Ref > > | sent_byproc |
| inverse mapping : sent atoms sorted by receiving processors | |
| std::vector< std::map< Ref, int, typename Ref::RefComparator > > | trous |
| holes created by migration in subsets conteners | |
| MPI_Comm | worldCom |
Definition at line 51 of file reference_manager.h.
| virtual ReferenceManager< Ref >::~ReferenceManager | ( | ) | [inline, virtual] |
Definition at line 55 of file reference_manager.h.
00055 { 00056 for (unsigned int i = 0 ; i < conteneurs.size(); ++i) 00057 if (conteneurs[i]) 00058 delete conteneurs[i]; 00059 };
| ReferenceManager< Ref >::ReferenceManager | ( | MPI_Comm | c | ) | [inline] |
Definition at line 61 of file reference_manager.h.
00061 :have_changed(false),worldCom(c){ 00062 if (worldCom != MPI_COMM_NULL) 00063 MPI_Comm_rank(worldCom,&rank); 00064 };
| void ReferenceManager< Ref >::AdjustSizeRecvBuffers | ( | std::map< int, std::vector< double > > & | recv_buffer, | |
| std::map< int, std::vector< int > > & | recv_buffer2 | |||
| ) | [inline, protected] |
in exchanging attached values this function set correct size to buffers
Definition at line 573 of file reference_manager.cpp.
References ReferenceManager< Ref >::attached_duo, ReferenceManager< Ref >::attached_vectors, ReferenceManager< Ref >::concerned_conteneurs_recv, ReferenceManager< Ref >::conteneurs, DBG_INFO, DUMP, ReferenceManager< Ref >::newatoms, and PROC_INVALID.
Referenced by ReferenceManager< Ref >::ExchangeSubSetAttachedValues().
00574 { 00575 int proc,size; 00576 //pour le calcul de la taille du packet par processeur (de reception) 00577 std::map<int,int> buffer_size; 00578 std::map<int,int> buffer_size2; 00579 00580 00581 /****************************************************************/ 00582 //partie reception 00583 /****************************************************************/ 00584 00585 //boucle sur les sous-ensembles 00586 int nb = conteneurs.size(); 00587 for (int subset = 0; subset < nb ; ++subset){ 00588 //boucle sur les vecteurs attachés 00589 std::vector<double *> & attached = attached_vectors[subset]; 00590 std::vector<void *> & attached_duo_ = attached_duo[subset]; 00591 00592 // je parcours les atomes envoyés sur les autres processeurs 00593 typename map<int,vector<Ref> >::iterator it = newatoms.begin(); 00594 typename map<int,vector<Ref> >::iterator last = newatoms.end(); 00595 00596 //boucle sur mes processeurs qui m'envoient 00597 for (it = newatoms.begin();it != last ; ++it){ 00598 proc = (*it).first; 00599 if (proc == PROC_INVALID) continue; 00600 size = (*it).second.size(); 00601 vector<Ref> & atoms = (*it).second; 00602 00603 Ref at; 00604 int mask; 00605 //loop over received atoms 00606 for (int i = 0; i < size ; ++i){ 00607 at = atoms[i]; 00608 if (!at.IsValid())continue; 00609 mask = concerned_conteneurs_recv[at]; 00610 00611 DUMP("atome " << i << " index " << at << " mask = " << mask << " from " << proc,DBG_INFO); 00612 00613 if ((mask & (1<<subset))==0) 00614 continue; 00615 00616 //sinon la taille du buffer de reception est augmentee du nombre de vecteur attachés 00617 DUMP("adding " << attached.size() << " to buffer from " << proc,DBG_INFO); 00618 buffer_size[proc] += attached.size(); 00619 DUMP("adding " << attached_duo_.size() << " to buffer from " << proc,DBG_INFO); 00620 buffer_size2[proc] += attached_duo_.size(); 00621 } 00622 } 00623 } 00624 00625 00626 //set the sizes 00627 std::map<int,int>::iterator it = buffer_size.begin(); 00628 std::map<int,int>::iterator last = buffer_size.end(); 00629 00630 while (it != last){ 00631 int proc = (*it).first; 00632 recv_buffer[proc].resize((*it).second); 00633 ++it; 00634 } 00635 00636 it = buffer_size2.begin(); 00637 last = buffer_size2.end(); 00638 00639 while (it != last){ 00640 int proc = (*it).first; 00641 recv_buffer2[proc].resize((*it).second); 00642 ++it; 00643 } 00644 00645 00646 }
| void ReferenceManager< Ref >::AnalyseSubSets | ( | ) | [inline, protected] |
analyse the sent atoms to compute the mask needed to exchange attached values
Definition at line 1026 of file reference_manager.cpp.
References ReferenceManager< Ref >::concerned_conteneurs_sent, ReferenceManager< Ref >::conteneurs, DBG_ALL, DBG_ERROR, DBG_INFO, DUMP, FATAL, ReferenceManager< Ref >::moved, PROC_INVALID, ReferenceManager< Ref >::sent, ReferenceManager< Ref >::trous, and ReferenceManager< Ref >::worldCom.
Referenced by ReferenceManager< Ref >::UpdateRefSubSets().
01026 { 01027 //bool testing = false; 01028 01029 //parcours des conteneur dont j'ai la charge 01030 int nb = conteneurs.size(); 01031 trous.resize(nb); 01032 01033 for (int subset = 0; subset < nb ; ++subset){ 01034 DUMP("analysing subset " << subset << " with name " << conteneurs[subset]->name,DBG_INFO); 01035 int compteur_atoms_implique = 0; 01036 if (trous[subset].empty() == false) FATAL("probleme : la liste des trous n'est pas vide au demarrage"); 01037 int nbElems = conteneurs[subset]->nbElem(); 01038 //sauvegarde l'etat du conteneur pour verifier la coherence apres migration 01039 #ifdef DEBUG_REFERENCEMANAGER 01040 conteneurs[subset]->save_global_size(worldCom); 01041 #endif 01042 DUMP("Analysing subset " << subset << "/" << nb << "(" << nbElems << " - " << &conteneurs[subset] << ")",DBG_INFO); 01043 for (int j = 0 ; j < nbElems ; ++j){ 01044 // attention ceci est une reference pas un objet que l'on a copie 01045 Ref at = conteneurs[subset]->Get(j); 01046 //si je suis deja sur un atome non local je continue 01047 if (!at.IsLocal()) continue; 01048 // si l'atome a change de processeur je l'invalide 01049 //et je lui note le nouveau proc .. des fois qu'il en 01050 // ai besoin 01051 DUMP("testing atom " << at,DBG_ALL); 01052 if (sent.count(at)>0){ 01053 if (sent[at] == PROC_INVALID) continue; 01054 //testing = true; 01055 DUMP("invalidating atom in subset " << subset << " numero " << j 01056 << " old position = " << at << " sent to proc " << sent[at],DBG_INFO); 01057 conteneurs[subset]->Get(j).SetAway(sent[at]); 01058 if (conteneurs[subset]->Get(j).IsLocal()){ 01059 FATAL("forcement aussi si meme ca ca marche pas ou va le monde"); 01060 } 01061 if (trous[subset].count(at) != 0) FATAL("it seems that the atome " << at << " is present two times " 01062 << "in subset " << subset << " " << conteneurs[subset]->name); 01063 trous[subset][at] = j; 01064 int mask = 1 << subset; 01065 ++compteur_atoms_implique; 01066 //si c un atome non valide issue de forwarding je fixe le masque a 0 01067 //mais je le laisse car il est compte il faut donc envoyer aussi 01068 if (!conteneurs[subset]->Get(j).IsValid()){ 01069 FATAL("pourkoi il passe la ce con"); 01070 mask = 0; 01071 } 01072 if (concerned_conteneurs_sent.count(at) == 0) 01073 concerned_conteneurs_sent[at] = mask; 01074 else 01075 concerned_conteneurs_sent[at] |= mask; 01076 } 01077 //si l'atome a bouge je met a jour sa ref 01078 else if (moved.count(at)>0){ 01079 //testing = true; 01080 DUMP("moving atom in subset " << subset << " numero " << j << " from position " << at << " to position " << moved[at],DBG_INFO); 01081 conteneurs[subset]->Get(j) = moved[at]; 01082 } 01083 } 01084 DUMP("end subset " << subset,DBG_INFO); 01085 DUMP("in subset " << conteneurs[subset]->name << " i notified " << compteur_atoms_implique 01086 << " over " << nbElems << " in total",DBG_ERROR); 01087 } 01088 01089 #ifdef DEBUG_REFERENCEMANAGER 01090 //pour le debug 01091 if (testing) 01092 for (int subset = 0; subset < nb ; ++subset){ 01093 int nbElems = conteneurs[subset]->nbElem(); 01094 DUMP("Analysing subset " << subset << "/" << nb << "(" << nbElems << " - " << &conteneurs[i] << ")"); 01095 for (int j = 0 ; j < nbElems ; ++j){ 01096 Ref at1 = conteneurs[subset]->Get(j); 01097 if (!at1.IsLocal()) continue; 01098 for (int k = j+1 ; k < nbElems ; ++k){ 01099 Ref at2 = conteneurs[subset]->Get(k); 01100 if (!at2.IsLocal()) continue; 01101 01102 if (at1.index_atome == at2.index_atome){ 01103 FATAL("houston on a un probleme : in subset " << subset << " indexes " << j << " and " 01104 << k << " refers to the same atom " << at1.index_atome); 01105 } 01106 } 01107 } 01108 } 01109 #endif 01110 }
| void ReferenceManager< Ref >::AttachDuoDistributedVector | ( | void * | v, | |
| ContenerTableauRefAtome< Ref > * | c | |||
| ) | [inline] |
request attaching a given duodistributed vecotr with a given contener c
Definition at line 1114 of file reference_manager.cpp.
References ReferenceManager< Ref >::attached_duo, ReferenceManager< Ref >::conteneurs, DBG_INFO_STARTUP, and DUMP.
01114 { 01115 int nb = conteneurs.size(); 01116 int i=0; 01117 for (i = 0; i < nb ; ++i){ 01118 if (conteneurs[i] == c){ 01119 DUMP("attaching duo * " << v << " to subset " << i,DBG_INFO_STARTUP); 01120 attached_duo[i].push_back(v); 01121 break; 01122 } 01123 } 01124 if (i == nb) 01125 DUMP("attaching double * " << v << " did not found its subset",DBG_INFO_STARTUP); 01126 01127 }
| void ReferenceManager< Ref >::AttachVector | ( | double * | v, | |
| ContenerTableauRefAtome< Ref > * | c | |||
| ) | [inline] |
request attaching a given vector v with a given contener c
Definition at line 1131 of file reference_manager.cpp.
References ReferenceManager< Ref >::attached_vectors, ReferenceManager< Ref >::conteneurs, DBG_INFO, DUMP, and FATAL.
01131 { 01132 int nb = conteneurs.size(); 01133 int i=0; 01134 for (i = 0; i < nb ; ++i){ 01135 if (conteneurs[i] == c){ 01136 DUMP("attaching double * " << v << " to subset " << i,DBG_INFO); 01137 attached_vectors[i].push_back(v); 01138 break; 01139 } 01140 } 01141 if (i == nb) 01142 FATAL("attaching double * " << v << " did not found its subset"); 01143 01144 01145 }
| void ReferenceManager< Ref >::BuildSendingBuffers | ( | std::map< int, std::vector< double > > & | send_buffer, | |
| std::map< int, std::vector< int > > & | send_buffer2 | |||
| ) | [inline, protected] |
in exchanging attached values this function build sending buffers
Definition at line 650 of file reference_manager.cpp.
References ReferenceManager< Ref >::attached_duo, ReferenceManager< Ref >::attached_vectors, ReferenceManager< Ref >::concerned_conteneurs_sent, ReferenceManager< Ref >::conteneurs, DBG_INFO, DUMP, PROC_INVALID, ReferenceManager< Ref >::sent_byproc, and ReferenceManager< Ref >::trous.
Referenced by ReferenceManager< Ref >::ExchangeSubSetAttachedValues().
00651 { 00652 00653 00654 // char temp[256]; 00655 // sprintf(temp,"%d",my_proc_id); 00656 // std::string output_file = ""; output_file += temp ; 00657 // output_file += "bugdemerdesend.log"; 00658 // std::ofstream fout(output_file.c_str(),ios_base::out); 00659 00660 int proc, size; 00661 /****************************************************************/ 00662 //partie envoi 00663 /****************************************************************/ 00664 00665 00666 std::map<Ref,std::map<int,std::vector<int> >,typename Ref::RefComparator> attached_values_duo_check; 00667 00668 //boucle sur les sous-ensembles 00669 int nb = conteneurs.size(); 00670 for (int subset = 0; subset < nb ; ++subset){ 00671 // je parcours les atomes envoyés sur les autres processeurs 00672 typename map<int,vector<Ref> >::iterator it = sent_byproc.begin(); 00673 typename map<int,vector<Ref> >::iterator last = sent_byproc.end(); 00674 00675 //boucle sur mes processeurs qui m'envoient 00676 for (it = sent_byproc.begin();it != last ; ++it){ 00677 proc = (*it).first; 00678 if (proc == PROC_INVALID) continue; 00679 size = (*it).second.size(); 00680 vector<Ref> & atoms = (*it).second; 00681 00682 Ref at; 00683 int mask; 00684 //boucle sur les atomes envoyes 00685 for (int i = 0; i < size ; ++i){ 00686 // je skip les atomes qui sont pas dans le groupe actuel 00687 at = atoms[i]; 00688 if (!at.IsValid())continue; 00689 mask = concerned_conteneurs_sent[at]; 00690 00691 // if (proc == 7) fout << "atome " << i << " ref : " << at << " mask = " << mask << std::endl; 00692 00693 if ((mask & (1<<subset))==0) 00694 continue; 00695 00696 DUMP("atome " << i << " index " << at << " mask = " << mask << " from " << proc,DBG_INFO); 00697 00698 00699 00700 //sinon je dois stocker les informations relatives aux atomes envoyes 00701 int index_in_subset = trous[subset][at]; 00702 //boucle sur les vecteurs attachés 00703 std::vector<double *> & attached = attached_vectors[subset]; 00704 std::vector<void *> & attached_duo_ = attached_duo[subset]; 00705 00706 00707 DUMP("first manage " << attached.size() << " vectors attached to subset " << subset,DBG_INFO); 00708 for (unsigned int v = 0; v < attached.size();++v){ 00709 double * vector = attached[v]; 00710 send_buffer[proc].push_back(vector[index_in_subset]); 00711 DUMP("adding " << vector[index_in_subset] << " to send buffer for " << proc,DBG_INFO); 00712 } 00713 00714 DUMP("now manage " << attached_duo_.size() << " duo vectors attached to subset " << subset,DBG_INFO); 00715 for (unsigned int v = 0; v < attached_duo_.size();++v){ 00716 DuoDistributedVecteur * duo = (DuoDistributedVecteur*)attached_duo_[v]; 00717 DUMP("treating trou " << index_in_subset << " created by moving on proc " << proc << " for subset " 00718 << conteneurs[subset]->name << " duo " << duo << " for proc " << proc,DBG_INFO); 00719 DUMP("adding " << duo->GetNeighbor(index_in_subset) << " to send buffer2 for " << proc << " with mask = " << mask 00720 << "at position in buffer " << send_buffer2[proc].size(),DBG_INFO); 00721 send_buffer2[proc].push_back(duo->GetNeighbor(index_in_subset)); 00722 // if (proc == 7) fout << "attached value atom " << i << " attached duo " << v << " subset " 00723 // << subset << " : " << send_buffer2[proc][send_buffer2[proc].size()-1] << std::endl; 00724 attached_values_duo_check[at][subset].push_back(send_buffer2[proc][send_buffer2[proc].size()-1]); 00725 duo->sendAtom(index_in_subset,proc); 00726 } 00727 } 00728 } 00729 } 00730 00731 // fout.close(); 00732 00733 //bilan pour controle sur la preparation des buffers 00734 std::map<int,std::map<int,int> > cpt_sent; 00735 std::map<int,std::map<int,int> > cpt_sent_brut; 00736 { 00737 typename std::map<Ref,std::map<int,std::vector<int> >,typename Ref::RefComparator>::iterator it = attached_values_duo_check.begin(); 00738 typename std::map<Ref,std::map<int,std::vector<int> >,typename Ref::RefComparator>::iterator last = attached_values_duo_check.end(); 00739 00740 while (it != last){ 00741 Ref at = (*it).first; 00742 int nb = conteneurs.size(); 00743 for (int subset = 0; subset < nb ; ++subset){ 00744 if (((*it).second).count(subset) == 0) continue; 00745 std::map<int,int> & map = cpt_sent[subset]; 00746 std::vector<int> & v = ((*it).second)[subset]; 00747 for (unsigned int i = 0 ; i < v.size(); ++i){ 00748 int value = v[i]; 00749 if (map.count(value) == 0 ) map[value] = 0; 00750 ++map[value]; 00751 } 00752 } 00753 ++it; 00754 } 00755 } 00756 00757 00758 00759 { 00760 std::map<int,std::vector<int> >::iterator it = send_buffer2.begin(); 00761 std::map<int,std::vector<int> >::iterator last = send_buffer2.end(); 00762 00763 while (it != last){ 00764 int proc = (*it).first; 00765 std::vector<int> & v = (*it).second; 00766 std::map<int,int> & map = cpt_sent_brut[proc]; 00767 for (unsigned int i = 0 ; i < v.size() ; ++i){ 00768 int value = v[i]; 00769 if (map.count(value) == 0 )map[value] = 0; 00770 ++map[value]; 00771 } 00772 ++it; 00773 } 00774 } 00775 00776 00777 DUMP("BEGIN *********************************",DBG_INFO); 00778 { 00779 std::map<int,std::map<int,int> >::iterator it = cpt_sent_brut.begin(); 00780 std::map<int,std::map<int,int> >::iterator last = cpt_sent_brut.end(); 00781 while (it != last){ 00782 std::map<int,int>::iterator it2 = (*it).second.begin(); 00783 std::map<int,int>::iterator last2 = (*it).second.end(); 00784 while (it2 != last2){ 00785 DUMP("bilan sent brut for proc " << (*it).first << 00786 " for dist owner stored " << (*it2).first << 00787 " quantity :" << (*it2).second,DBG_INFO); 00788 ++it2; 00789 } 00790 ++it; 00791 } 00792 00793 it = cpt_sent.begin(); 00794 last = cpt_sent.end(); 00795 while (it != last){ 00796 std::map<int,int>::iterator it2 = (*it).second.begin(); 00797 std::map<int,int>::iterator last2 = (*it).second.end(); 00798 while (it2 != last2){ 00799 DUMP("bilan sent for subset " << (*it).first << 00800 " for dist owner stored " << (*it2).first << 00801 " quantity :" << (*it2).second,DBG_INFO); 00802 ++it2; 00803 } 00804 ++it; 00805 } 00806 } 00807 DUMP("END *********************************",DBG_INFO); 00808 00809 }
| void ReferenceManager< Ref >::CheckSubSetsCardinal | ( | ) | [inline, protected] |
check the saved cardinals of the subsets
Definition at line 1018 of file reference_manager.cpp.
References ReferenceManager< Ref >::conteneurs, and ReferenceManager< Ref >::worldCom.
Referenced by ReferenceManager< Ref >::UpdateRefSubSets().
01018 { 01019 int nb = conteneurs.size(); 01020 for (int subset = 0; subset < nb ; ++subset){ 01021 conteneurs[subset]->check_parallel_coherence(worldCom); 01022 } 01023 }
| void ReferenceManager< Ref >::ClearSTL | ( | ) | [inline, protected] |
clear all internal structures (based on STL)
Definition at line 176 of file reference_manager.cpp.
References ReferenceManager< Ref >::attached_values, ReferenceManager< Ref >::attached_values_duo, ReferenceManager< Ref >::concerned_conteneurs_recv, ReferenceManager< Ref >::concerned_conteneurs_sent, ReferenceManager< Ref >::moved, ReferenceManager< Ref >::newatoms, ReferenceManager< Ref >::sent, ReferenceManager< Ref >::sent_byproc, and ReferenceManager< Ref >::trous.
Referenced by ReferenceManager< Ref >::UpdateRefSubSets().
00176 { 00177 concerned_conteneurs_sent.clear(); 00178 concerned_conteneurs_recv.clear(); 00179 trous.clear(); 00180 moved.clear(); 00181 sent.clear(); 00182 sent_byproc.clear(); 00183 newatoms.clear(); 00184 attached_values.clear(); 00185 attached_values_duo.clear(); 00186 }
| void ReferenceManager< Ref >::CreationExchangedAtomsInSubSets | ( | ) | [inline, protected] |
create in the subsets the atoms locally created by migration process
Definition at line 926 of file reference_manager.cpp.
References ReferenceManager< Ref >::attached_duo, ReferenceManager< Ref >::attached_values, ReferenceManager< Ref >::attached_values_duo, ReferenceManager< Ref >::attached_vectors, ReferenceManager< Ref >::concerned_conteneurs_recv, ReferenceManager< Ref >::conteneurs, DBG_ERROR, DBG_INFO, DBG_INFO_STARTUP, DUMP, and ReferenceManager< Ref >::trous.
Referenced by ReferenceManager< Ref >::UpdateRefSubSets().
00926 { 00927 00928 00929 DUMP("creation of atoms in concerned subsets",DBG_INFO_STARTUP); 00930 00931 //je parcours les atomes crés sur ce processeur 00932 typename map<Ref,int,typename Ref::RefComparator>::iterator it = concerned_conteneurs_recv.begin(); 00933 typename map<Ref,int,typename Ref::RefComparator>::iterator last = concerned_conteneurs_recv.end(); 00934 00935 std::map<int,int> compteur_atoms_created; 00936 00937 for (it = concerned_conteneurs_recv.begin();it != last ; ++it){ 00938 int mask = (*it).second; 00939 Ref at = (*it).first; 00940 if (!at.IsValid()) continue; 00941 DUMP("mask = " << mask,DBG_INFO); 00942 //parcours des conteneur dont j'ai la charge 00943 int nb = conteneurs.size(); 00944 double * vector; 00945 00946 00947 for (int subset = 0; subset < nb ; ++subset){ 00948 if ((mask & (1<<subset))==0) 00949 continue; 00950 00951 ++compteur_atoms_created[subset]; 00952 00953 // je regarde si il y a des trous que je peux boucher 00954 std::map<Ref,int,typename Ref::RefComparator> & trous_subset = trous[subset]; 00955 int new_index; 00956 00957 if (trous_subset.size() > 0){ 00958 DUMP("j'utilise un trou pour mettre ma nouvelle reference ",DBG_INFO); 00959 typename std::map<Ref,int,typename Ref::RefComparator>::iterator first_entry = trous_subset.begin(); 00960 Ref oldat = (*first_entry).first; 00961 new_index = (*first_entry).second; 00962 conteneurs[subset]->Get(new_index) = at; 00963 trous_subset.erase(oldat); 00964 } 00965 else{ 00966 DUMP("ma nouvelle reference est placee a la fin",DBG_INFO); 00967 //sinon j'ajoute l'atome par la voie standard ie au bout du vecteur 00968 new_index = conteneurs[subset]->nbElem(); 00969 conteneurs[subset]->Ajouter(at); 00970 } 00971 00972 DUMP("treating(creation atom) subset number " << subset << " new atome at index " << new_index,DBG_INFO); 00973 00974 // je parcours maintenant les vecteurs attachés 00975 std::vector<double *> & attached = attached_vectors[subset]; 00976 00977 for (unsigned int i = 0 ; i < attached.size(); ++i){ 00978 vector = attached[i]; 00979 DUMP("assigning attached vector " << i << " (internal index = " << at << ")",DBG_INFO); 00980 vector[new_index] = attached_values[at][subset][i]; 00981 } 00982 00983 // std::vector<unsigned int *> & attached_size = attached_sizes[subset]; 00984 // for (unsigned int i = 0 ; i < attached_size.size(); ++i){ 00985 // unsigned int * s = attached_size[i]; 00986 // DUMP("incresing size assigning attached vector " << i << " (internal index = " << at << ")"); 00987 // vector[new_index] = attached_values[at][subset][i]; 00988 // } 00989 00990 00991 std::vector<void *> & attached_duo_ = attached_duo[subset]; 00992 // je parcours maintenant les duovecteurs attaches 00993 DUMP("declaring received atoms on the " << attached_duo_.size() << " attached duo vectors",DBG_INFO); 00994 for (unsigned int i = 0 ; i < attached_duo_.size(); ++i){ 00995 DuoDistributedVecteur * duo = (DuoDistributedVecteur *)attached_duo_[i]; 00996 DUMP("assigning attached duo " << i << "(" << duo << ")" << " while mask = " << mask << " for subset " << conteneurs[subset]->name 00997 << " and as for new neighbor = " << attached_values_duo[at][subset][i] << " and at " << at,DBG_INFO); 00998 duo->receiveAtom(new_index,attached_values_duo[at][subset][i]); 00999 } 01000 01001 } 01002 } 01003 01004 int nb = conteneurs.size(); 01005 for (int subset = 0; subset < nb ; ++subset){ 01006 DUMP("in subset " << conteneurs[subset]->name << " i created " << compteur_atoms_created[subset] 01007 << " over " << concerned_conteneurs_recv.size() << " in total",DBG_ERROR); 01008 } 01009 01010 01011 DUMP("end CreationExchangedAtomsInSubSets",DBG_INFO); 01012 }
| void ReferenceManager< Ref >::DecodeBuffers | ( | std::map< int, std::vector< double > > & | recv_buffer, | |
| std::map< int, std::vector< int > > & | recv_buffer2 | |||
| ) | [inline, protected] |
in exchanging attached values this function decode the sended buffers
Definition at line 400 of file reference_manager.cpp.
References ReferenceManager< Ref >::attached_duo, ReferenceManager< Ref >::attached_values, ReferenceManager< Ref >::attached_values_duo, ReferenceManager< Ref >::attached_vectors, ReferenceManager< Ref >::concerned_conteneurs_recv, ReferenceManager< Ref >::conteneurs, DBG_INFO, DUMP, FATAL, ReferenceManager< Ref >::newatoms, and PROC_INVALID.
Referenced by ReferenceManager< Ref >::ExchangeSubSetAttachedValues().
00401 { 00402 00403 00404 // if (recv_buffer2.count(8)>0 && recv_buffer2[8].size() > 1) 00405 // DUMP("BBBBBBBBBBBBBBBBB " << recv_buffer2[8][0],DBG_INFO); 00406 00407 // char temp[256]; 00408 // sprintf(temp,"%d",my_proc_id); 00409 // std::string output_file = ""; output_file += temp ; 00410 // output_file += "bugdemerderecv.log"; 00411 // std::ofstream fout(output_file.c_str(),ios_base::out); 00412 00413 00414 /****************************************************************/ 00415 //phase de decodage du paquet groupe des valeurs attaches 00416 /****************************************************************/ 00417 00418 //boucle sur les sous-ensembles 00419 int nb = conteneurs.size(); 00420 int proc,size; 00421 00422 std::map<int,int> index; 00423 std::map<int,int> index2; 00424 00425 for (int subset = 0; subset < nb ; ++subset){ 00426 //boucle sur les vecteurs attachés 00427 std::vector<double *> & attached = attached_vectors[subset]; 00428 std::vector<void *> & attached_duo_ = attached_duo[subset]; 00429 00430 // je parcours les atomes envoyés sur les autres processeurs 00431 typename map<int,vector<Ref> >::iterator it = newatoms.begin(); 00432 typename map<int,vector<Ref> >::iterator last = newatoms.end(); 00433 00434 00435 //boucle sur mes processeurs qui m'envoient 00436 for (it = newatoms.begin();it != last ; ++it){ 00437 proc = (*it).first; 00438 00439 if (index.count(proc) == 0) index[proc] = 0; 00440 if (index2.count(proc) == 0) index2[proc] = 0; 00441 00442 if (proc == PROC_INVALID)continue; 00443 size = (*it).second.size(); 00444 vector<Ref> & atoms = (*it).second; 00445 00446 Ref at; 00447 int mask; 00448 00449 //boucle sur les atomes recus 00450 for (int i = 0; i < size ; ++i){ 00451 at = atoms[i]; 00452 if (!at.IsValid())continue; 00453 if (concerned_conteneurs_recv.count(at) == 0) FATAL("bipbipbipbipbip " << at); 00454 mask = concerned_conteneurs_recv[at]; 00455 00456 // if (proc == 8) fout << "atome " << i << " ref : " << at << " mask = " << mask <<std::endl; 00457 00458 // je skip les atomes qui sont pas dans le groupe actuel 00459 if ((mask & (1<<subset))==0) 00460 continue; 00461 00462 DUMP("atome " << i << " index " << at << " mask = " << mask << " from " << proc,DBG_INFO); 00463 00464 //parcours sur les vecteurs attaches 00465 for (unsigned int j = 0; j < attached.size() ; ++j){ 00466 DUMP("reading attached value atom " << i << " attached vector " << j << " subset " 00467 << subset << " : " << recv_buffer[proc][index[proc]] << " (internal index = " 00468 << at << ")" << proc,DBG_INFO); 00469 if (index[proc] >= recv_buffer[proc].size()) FATAL("depassement detecte " << index[proc] << " " << recv_buffer[proc].size()); 00470 attached_values[at][subset].push_back(recv_buffer[proc][index[proc]]); 00471 ++index[proc]; 00472 } 00473 00474 //parcours sur les vecteurs attaches duo 00475 DUMP("Decoding received packet onto the " << attached_duo_.size() << " duo vectors",DBG_INFO); 00476 for (unsigned int j = 0; j < attached_duo_.size() ; ++j){ 00477 DUMP("reading attached value atom " << i << " attached duo " << j << " subset " 00478 << subset << " : " << recv_buffer2[proc][index2[proc]] << " (internal index = " 00479 << at << ")",DBG_INFO); 00480 // if (proc == 8) fout << "attached value atom " << i << " attached duo " << j << " subset " 00481 // << subset << " : " << recv_buffer2[proc][index2[proc]] << std::endl; 00482 if (index2[proc] >= recv_buffer2[proc].size()) FATAL("depassement detecte " << index2[proc] << " " << recv_buffer2[proc].size()); 00483 attached_values_duo[at][subset].push_back(recv_buffer2[proc][index2[proc]]); 00484 // if (i == 145) DUMP("AAAAAAAAAAAAAAAAAAAAAAA youhou " << index2,DBG_INFO); 00485 ++index2[proc]; 00486 } 00487 00488 } 00489 } 00490 } 00491 // fout.close(); 00492 00493 if (recv_buffer2.count(8)>0 && recv_buffer2[8].size() > 1) 00494 DUMP("BBBBBBBBBBBBBBBBB " << recv_buffer2[8][0],DBG_INFO); 00495 00496 //print bilan of exchange subset values to screen use for debug only 00497 std::map<int,std::map<int,int> > cpt_recv; 00498 std::map<int,std::map<int,int> > cpt_recv_brut; 00499 { 00500 typename std::map<Ref,std::map<int,std::vector<int> >,typename Ref::RefComparator>::iterator it = attached_values_duo.begin(); 00501 typename std::map<Ref,std::map<int,std::vector<int> >,typename Ref::RefComparator>::iterator last = attached_values_duo.end(); 00502 00503 while (it != last){ 00504 Ref at = (*it).first; 00505 int nb = conteneurs.size(); 00506 for (int subset = 0; subset < nb ; ++subset){ 00507 if (((*it).second).count(subset) == 0) continue; 00508 std::map<int,int> & map = cpt_recv[subset]; 00509 std::vector<int> & v = ((*it).second)[subset]; 00510 for (unsigned int i = 0 ; i < v.size(); ++i){ 00511 int value = v[i]; 00512 if (map.count(value) == 0 ) map[value] = 0; 00513 ++map[value]; 00514 } 00515 } 00516 ++it; 00517 } 00518 } 00519 00520 00521 { 00522 std::map<int,std::vector<int> >::iterator it = recv_buffer2.begin(); 00523 std::map<int,std::vector<int> >::iterator last = recv_buffer2.end(); 00524 00525 while (it != last){ 00526 int proc = (*it).first; 00527 std::vector<int> & v = (*it).second; 00528 std::map<int,int> & map = cpt_recv_brut[proc]; 00529 for (unsigned int i = 0 ; i < v.size() ; ++i){ 00530 int value = v[i]; 00531 if (map.count(value) == 0 )map[value] = 0; 00532 ++map[value]; 00533 } 00534 ++it; 00535 } 00536 } 00537 00538 DUMP("BEGIN *********************************",DBG_INFO); 00539 { 00540 std::map<int,std::map<int,int> >::iterator it = cpt_recv_brut.begin(); 00541 std::map<int,std::map<int,int> >::iterator last = cpt_recv_brut.end(); 00542 while (it != last){ 00543 std::map<int,int>::iterator it2 = (*it).second.begin(); 00544 std::map<int,int>::iterator last2 = (*it).second.end(); 00545 while (it2 != last2){ 00546 DUMP("bilan recv brut from proc " << (*it).first << 00547 " for dist owner stored " << (*it2).first << 00548 " quantity :" << (*it2).second,DBG_INFO); 00549 ++it2; 00550 } 00551 ++it; 00552 } 00553 00554 it = cpt_recv.begin(); 00555 last = cpt_recv.end(); 00556 while (it != last){ 00557 std::map<int,int>::iterator it2 = (*it).second.begin(); 00558 std::map<int,int>::iterator last2 = (*it).second.end(); 00559 while (it2 != last2){ 00560 DUMP("bilan recv for subset " << (*it).first << 00561 " for dist owner stored " << (*it2).first << 00562 " quantity :" << (*it2).second,DBG_INFO); 00563 ++it2; 00564 } 00565 ++it; 00566 } 00567 } 00568 DUMP("END *********************************",DBG_INFO); 00569 00570 }
| void ReferenceManager< Ref >::ExchangeSubSetAttachedValues | ( | ) | [inline, protected] |
perform real value exchange communication
Definition at line 814 of file reference_manager.cpp.
References ReferenceManager< Ref >::AdjustSizeRecvBuffers(), ReferenceManager< Ref >::BuildSendingBuffers(), DBG_INFO, ReferenceManager< Ref >::DecodeBuffers(), DUMP, ReferenceManager< Ref >::newatoms, PROC_INVALID, ReferenceManager< Ref >::rank, ReferenceManager< Ref >::sent_byproc, and ReferenceManager< Ref >::worldCom.
Referenced by ReferenceManager< Ref >::UpdateRefSubSets().
00814 { 00815 DUMP("ExchangeSubSetAttachedValues",DBG_INFO); 00816 00817 int proc; 00818 int size; 00819 00820 std::map<int,std::vector<double> > send_buffer; 00821 std::map<int,std::vector<double> > recv_buffer; 00822 00823 std::map<int,std::vector<int> > send_buffer2; 00824 std::map<int,std::vector<int> > recv_buffer2; 00825 00826 BuildSendingBuffers(send_buffer,send_buffer2); 00827 // DUMP("INITINIT " << send_buffer2[1][145],DBG_INFO); 00828 AdjustSizeRecvBuffers(recv_buffer,recv_buffer2); 00829 // DUMP("INITINIT " << send_buffer2[1][145],DBG_INFO); 00830 00831 /****************************************************************/ 00832 // partie communication 00833 /****************************************************************/ 00834 00835 map<int,MPI_Request> recv_requests; 00836 map<int,MPI_Request> recv_requests2; 00837 00838 //phase de reception asynchrone 00839 { 00840 typename map<int,vector<Ref> >::iterator it = newatoms.begin(); 00841 typename map<int,vector<Ref> >::iterator last = newatoms.end(); 00842 00843 //boucle sur mes processeurs destinataires 00844 for (it = newatoms.begin();it != last ; ++it){ 00845 proc = (*it).first; 00846 if (proc == PROC_INVALID) continue; 00847 size = recv_buffer[proc].size(); 00848 if (size>0){ 00849 DUMP("a buffer of size " << size << " doubles will be received from proc " << proc 00850 << " for attached values",DBG_INFO); 00851 MPI_Request & request = recv_requests[proc]; 00852 MPI_Irecv(&recv_buffer[proc][0],size,MPI_DOUBLE,proc,proc+1,worldCom,&request); 00853 } 00854 size = recv_buffer2[proc].size(); 00855 if (size>0){ 00856 DUMP("a buffer of size " << size << " integers will be received from proc " << proc 00857 << " for attached duos",DBG_INFO); 00858 MPI_Request & request = recv_requests2[proc]; 00859 MPI_Irecv(&recv_buffer2[proc][0],size,MPI_INT,proc,proc+2,worldCom,&request); 00860 } 00861 } 00862 } 00863 00864 //phase d'envoi 00865 { 00866 typename map<int,vector<Ref> >::iterator it = sent_byproc.begin(); 00867 typename map<int,vector<Ref> >::iterator last = sent_byproc.end(); 00868 00869 //boucle sur mes processeurs destinataires 00870 for (it = sent_byproc.begin();it != last ; ++it){ 00871 proc = (*it).first; 00872 if (proc == PROC_INVALID)continue; 00873 size = send_buffer[proc].size(); 00874 if (size>0){ 00875 DUMP("a buffer of size " << size << " double will be sent to proc " << proc 00876 << " for attached values",DBG_INFO); 00877 MPI_Send(&send_buffer[proc][0],size,MPI_DOUBLE,proc,rank+1,worldCom); 00878 } 00879 00880 size = send_buffer2[proc].size(); 00881 if (size>0){ 00882 DUMP("a buffer of size " << size << " integers will be sent to proc " << proc 00883 << " for attached duos",DBG_INFO); 00884 MPI_Send(&send_buffer2[proc][0],size,MPI_INT,proc,rank+2,worldCom); 00885 } 00886 } 00887 } 00888 00889 //maintenant j'attend les communication de maniere synchronisante (pour les vector) 00890 { 00891 MPI_Status status; 00892 typename map<int,MPI_Request>::iterator it = recv_requests.begin(); 00893 typename map<int,MPI_Request>::iterator last = recv_requests.end(); 00894 00895 for (it = recv_requests.begin();it != last ; ++it){ 00896 MPI_Wait(&((*it).second),&status); 00897 proc = (*it).first; 00898 DUMP("received packet vector from proc " << proc,DBG_INFO); 00899 if(recv_buffer2.count(8)>0 && recv_buffer2[8].size() > 1) 00900 DUMP("BBBBBBBBBBBBBBBBB " << recv_buffer2[8][0],DBG_INFO); 00901 } 00902 } 00903 00904 //maintenant j'attend les communication de maniere synchronisante (pour les duos) 00905 { 00906 MPI_Status status; 00907 typename map<int,MPI_Request>::iterator it = recv_requests2.begin(); 00908 typename map<int,MPI_Request>::iterator last = recv_requests2.end(); 00909 00910 for (it = recv_requests2.begin();it != last ; ++it){ 00911 MPI_Wait(&((*it).second),&status); 00912 proc = (*it).first; 00913 DUMP("received packet duo from proc " << proc,DBG_INFO); 00914 } 00915 } 00916 00917 DecodeBuffers(recv_buffer,recv_buffer2); 00918 00919 00920 }
Here is the call graph for this function:

| void ReferenceManager< Ref >::ExchangeSubSetsMasks | ( | ) | [inline, protected] |
perform the exchange to let know the ownership mask of migrated atoms
Definition at line 247 of file reference_manager.cpp.
References ReferenceManager< Ref >::concerned_conteneurs_recv, ReferenceManager< Ref >::concerned_conteneurs_sent, DBG_DETAIL, DBG_INFO, DUMP, FATAL, ReferenceManager< Ref >::newatoms, PROC_INVALID, ReferenceManager< Ref >::rank, ReferenceManager< Ref >::sent_byproc, and ReferenceManager< Ref >::worldCom.
Referenced by ReferenceManager< Ref >::UpdateRefSubSets().
00247 { 00248 int proc; 00249 int size; 00250 //checking phase first 00251 00252 //maintenant que je sais quels sous ensembles sont concernes par 00253 //les changements il faut prevenir les procs distant de ce fait 00254 map<int,int> recv_buffers_check; 00255 map<int,MPI_Request> recv_requests_check; 00256 00257 { 00258 //phase de reception asynchrone 00259 typename map<int,vector<Ref> >::iterator it = newatoms.begin(); 00260 typename map<int,vector<Ref> >::iterator last = newatoms.end(); 00261 00262 //pour chaque processeurs qui m'ont envoyes des atomes 00263 for (it = newatoms.begin();it != last ; ++it){ 00264 proc = (*it).first; 00265 00266 if (proc == PROC_INVALID) 00267 continue; 00268 size = (*it).second.size(); 00269 if (size == 0) continue; 00270 00271 int & buffer = recv_buffers_check[proc]; 00272 MPI_Request & request = recv_requests_check[proc]; 00273 MPI_Irecv(&buffer,1,MPI_INT,proc,proc,worldCom,&request); 00274 } 00275 } 00276 { 00277 //phase d'envoi 00278 typename map<int,vector<Ref> >::iterator it = sent_byproc.begin(); 00279 typename map<int,vector<Ref> >::iterator last = sent_byproc.end(); 00280 00281 for (it = sent_byproc.begin();it != last ; ++it){ 00282 proc = (*it).first; 00283 if (proc == PROC_INVALID) continue; 00284 00285 size = (*it).second.size(); 00286 if (size == 0) continue; 00287 MPI_Send(&size,1,MPI_INT,proc,rank,worldCom); 00288 } 00289 } 00290 //maintenant j'attend les communication de maniere synchronisante 00291 { 00292 MPI_Status status; 00293 typename map<int,MPI_Request>::iterator it = recv_requests_check.begin(); 00294 typename map<int,MPI_Request>::iterator last = recv_requests_check.end(); 00295 00296 for (it = recv_requests_check.begin();it != last ; ++it){ 00297 proc = (*it).first; 00298 if (newatoms.count(proc) == 0) FATAL("pas normal du tout"); 00299 if (proc == PROC_INVALID) continue; 00300 int & buffer = recv_buffers_check[proc]; 00301 DUMP("waiting for com from " << proc << " in check process",DBG_INFO); 00302 MPI_Wait(&((*it).second),&status); 00303 DUMP("ok received",DBG_INFO); 00304 if (newatoms[proc].size() != buffer) FATAL("protocol prevision failed : " << newatoms[proc].size() 00305 << " != " << buffer << " for exchange with " << proc); 00306 //je remplis la structure map concerned_conteneurs_recv (une fois recu bien sur); 00307 } 00308 } 00309 00310 // MPI_Barrier(worldCom); 00311 00312 //real phase now 00313 //maintenant que je sais quels sous ensembles sont concernes par 00314 //les changements il faut prevenir les procs distant de ce fait 00315 map<int,std::vector<int> > recv_buffers; 00316 map<int,MPI_Request> recv_requests; 00317 00318 { 00319 //phase de reception asynchrone 00320 typename map<int,vector<Ref> >::iterator it = newatoms.begin(); 00321 typename map<int,vector<Ref> >::iterator last = newatoms.end(); 00322 00323 //pour chaque processeurs qui m'ont envoyes des atomes 00324 for (it = newatoms.begin();it != last ; ++it){ 00325 proc = (*it).first; 00326 00327 if (proc == PROC_INVALID) 00328 continue; 00329 size = (*it).second.size(); 00330 if (size == 0) continue; 00331 00332 std::vector<int> & buffer = recv_buffers[proc]; 00333 MPI_Request & request = recv_requests[proc]; 00334 00335 buffer.resize(size); 00336 DUMP("receiving from proc " << proc << " " << size << " integers",DBG_INFO); 00337 MPI_Irecv(&buffer[0],size,MPI_INT,proc,proc,worldCom,&request); 00338 } 00339 00340 } 00341 00342 00343 { 00344 //phase d'envoi 00345 std::vector<int> send_buffer; 00346 00347 typename map<int,vector<Ref> >::iterator it = sent_byproc.begin(); 00348 typename map<int,vector<Ref> >::iterator last = sent_byproc.end(); 00349 00350 for (it = sent_byproc.begin();it != last ; ++it){ 00351 proc = (*it).first; 00352 if (proc == PROC_INVALID) continue; 00353 00354 size = (*it).second.size(); 00355 vector<Ref> & atoms = (*it).second; 00356 00357 if (size == 0) continue; 00358 00359 send_buffer.resize(size); 00360 00361 DUMP("sending to proc " << proc << " " << size << " integers",DBG_INFO); 00362 00363 for (int i=0; i < size ; ++i){ 00364 if (concerned_conteneurs_sent.count(atoms[i]) == 0) 00365 send_buffer[i] = 0; 00366 else 00367 send_buffer[i] = concerned_conteneurs_sent[atoms[i]]; 00368 } 00369 MPI_Send(&send_buffer[0],size,MPI_INT,proc,rank,worldCom); 00370 } 00371 } 00372 00373 //maintenant j'attend les communication de maniere synchronisante 00374 { 00375 MPI_Status status; 00376 typename map<int,MPI_Request>::iterator it = recv_requests.begin(); 00377 typename map<int,MPI_Request>::iterator last = recv_requests.end(); 00378 00379 for (it = recv_requests.begin();it != last ; ++it){ 00380 proc = (*it).first; 00381 if (proc == PROC_INVALID) continue; 00382 00383 std::vector<int> & buffer = recv_buffers[proc]; 00384 DUMP("waiting to receive a packet from proc " << proc << " of size " << buffer.size()<< " integers",DBG_INFO); 00385 MPI_Wait(&((*it).second),&status); 00386 DUMP("received packet from proc " << proc << " of size " << buffer.size(),DBG_DETAIL); 00387 //je remplis la structure map concerned_conteneurs_recv (une fois recu bien sur); 00388 for (unsigned int i = 0 ; i < buffer.size() ; ++i){ 00389 DUMP("received mask " << buffer[i] << " assoc with " << newatoms[proc][i] << " with i = " << i,DBG_INFO); 00390 if (concerned_conteneurs_recv.count(newatoms[proc][i]) != 0) 00391 FATAL("trying to set mask multiple time over same uniq atom : probably migration trouble"); 00392 if (buffer[i] != 0) 00393 concerned_conteneurs_recv[newatoms[proc][i]] = buffer[i]; 00394 } 00395 } 00396 } 00397 }
| void ReferenceManager< Ref >::PrintBilanToScreen | ( | ) | [inline, protected] |
print bilan for concerned conteneur : used only to debug
Definition at line 189 of file reference_manager.cpp.
References ReferenceManager< Ref >::concerned_conteneurs_recv, ReferenceManager< Ref >::concerned_conteneurs_sent, ReferenceManager< Ref >::conteneurs, DBG_INFO, and DUMP.
Referenced by ReferenceManager< Ref >::UpdateRefSubSets().
00189 { 00190 int nb = conteneurs.size(); 00191 std::map<int,int> cpt_subset_sent; 00192 std::map<int,int> cpt_subset_recv; 00193 00194 { 00195 typename std::map<Ref,int,typename Ref::RefComparator>::iterator it = concerned_conteneurs_sent.begin(); 00196 typename std::map<Ref,int,typename Ref::RefComparator>::iterator last = concerned_conteneurs_sent.end(); 00197 00198 while (it != last){ 00199 Ref at = (*it).first; 00200 int mask = (*it).second; 00201 for (int subset = 0; subset < nb ; ++subset){ 00202 if (cpt_subset_sent.count(subset) == 0) cpt_subset_sent[subset] = 0; 00203 if (mask & (1<<subset)) ++cpt_subset_sent[subset]; 00204 } 00205 ++it; 00206 } 00207 } 00208 00209 { 00210 typename std::map<Ref,int,typename Ref::RefComparator>::iterator it = concerned_conteneurs_recv.begin(); 00211 typename std::map<Ref,int,typename Ref::RefComparator>::iterator last = concerned_conteneurs_recv.end(); 00212 00213 while (it != last){ 00214 Ref at = (*it).first; 00215 int mask = (*it).second; 00216 for (int subset = 0; subset < nb ; ++subset){ 00217 if (cpt_subset_recv.count(subset) == 0) cpt_subset_recv[subset] = 0; 00218 if (mask & (1<<subset)) ++cpt_subset_recv[subset]; 00219 } 00220 ++it; 00221 } 00222 } 00223 00224 DUMP("BEGIN *********************************",DBG_INFO); 00225 { 00226 std::map<int,int>::iterator it = cpt_subset_sent.begin(); 00227 std::map<int,int>::iterator last = cpt_subset_sent.end(); 00228 while (it != last){ 00229 DUMP("number of sent registered for subset " << (*it).first << " is " << (*it).second,DBG_INFO); 00230 ++it; 00231 } 00232 } 00233 00234 { 00235 std::map<int,int>::iterator it = cpt_subset_recv.begin(); 00236 std::map<int,int>::iterator last = cpt_subset_recv.end(); 00237 while (it != last){ 00238 DUMP("number of recv registered for subset " << (*it).first << " is " << (*it).second,DBG_INFO); 00239 ++it; 00240 } 00241 } 00242 DUMP("END *********************************",DBG_INFO); 00243 }
| ContenerTableauRefAtome<Ref>& ReferenceManager< Ref >::RequestCreationSubSet | ( | char * | name | ) | [inline] |
the contener of subsets of atoms may only be created through refmanager
contener of subsets need to be updated in order to fit the migrated structures
Definition at line 68 of file reference_manager.h.
00068 { 00069 int size = conteneurs.size(); 00070 DUMP("creation d'un sous ensemble d'atomes (numero" << size << ") named " << name,DBG_INFO); 00071 conteneurs.resize(size+1); 00072 conteneurs[size] = new ContenerTableauRefAtome<Ref>(name); 00073 return *conteneurs[size]; 00074 }
| void ReferenceManager< Ref >::UpdateRefSubSets | ( | ) | [inline] |
function that start the updating process of all attached structures
Definition at line 64 of file reference_manager.cpp.
References ReferenceManager< Ref >::AnalyseSubSets(), ReferenceManager< Ref >::CheckSubSetsCardinal(), ReferenceManager< Ref >::ClearSTL(), ReferenceManager< Ref >::CreationExchangedAtomsInSubSets(), DBG_ERROR, DBG_INFO, DBG_WARNING, DUMP, ReferenceManager< Ref >::ExchangeSubSetAttachedValues(), ReferenceManager< Ref >::ExchangeSubSetsMasks(), ReferenceManager< Ref >::have_changed, ReferenceManager< Ref >::moved, ReferenceManager< Ref >::newatoms, ReferenceManager< Ref >::PrintBilanToScreen(), ReferenceManager< Ref >::sent, ReferenceManager< Ref >::sent_byproc, and ReferenceManager< Ref >::worldCom.
Referenced by UpdateRefSubSets().
00064 { 00065 MPI_Barrier(worldCom); 00066 00067 if (have_changed) 00068 DUMP("have_changed = " << have_changed,DBG_ERROR); 00069 if (have_changed==false){ 00070 MPI_Barrier(worldCom); 00071 MPI_Barrier(worldCom); 00072 MPI_Barrier(worldCom); 00073 MPI_Barrier(worldCom); 00074 MPI_Barrier(worldCom); 00075 return; 00076 } 00077 // sleep(my_proc_id); 00078 00079 if (moved.size() > 0){ 00080 DUMP(moved.size() << " atoms moved in memory",DBG_INFO); 00081 } 00082 00083 { 00084 typename map<int,vector<Ref> >::iterator it = newatoms.begin(); 00085 typename map<int,vector<Ref> >::iterator last = newatoms.end(); 00086 00087 for (it = newatoms.begin();it != last;++it){ 00088 DUMP((*it).second.size() << " atoms received from proc " << (*it).first,DBG_INFO); 00089 // for (unsigned int k = 0 ; k < (*it).second.size() ; ++k){ 00090 // LOG("received atom " << (*it).second[k]); 00091 // } 00092 } 00093 00094 { 00095 typename map<int,vector<Ref> >::iterator it = sent_byproc.begin(); 00096 typename map<int,vector<Ref> >::iterator last = sent_byproc.end(); 00097 00098 for(it = sent_byproc.begin();it != last;++it){ 00099 DUMP((*it).second.size() << " atoms sent to proc " << (*it).first,DBG_INFO); 00100 // for (unsigned int k = 0 ; k < (*it).second.size() ; ++k){ 00101 // LOG("sent atom " << (*it).second[k]); 00102 // } 00103 00104 } 00105 } 00106 00107 { 00108 00109 std::map<int,int> temp; 00110 { 00111 typename map<Ref,int,typename Ref::RefComparator>::iterator it = sent.begin(); 00112 typename map<Ref,int,typename Ref::RefComparator>::iterator last = sent.end(); 00113 00114 for(it = sent.begin();it != last;++it){ 00115 ++temp[(*it).second]; 00116 } 00117 } 00118 // { 00119 // typename map<int,vector<Ref> >::iterator it = sent_byproc.begin(); 00120 // typename map<int,vector<Ref> >::iterator last = sent_byproc.end(); 00121 00122 // for(it = sent_byproc.begin();it != last;++it){ 00123 // if((*it).second.size() != temp[(*it).first]) 00124 // FATAL("sent_by_proc registered " << (*it).second.size() 00125 // << " atoms as sended but sent registered " << temp[(*it).first] 00126 // << " fatal inconstistency in send maps"); 00127 // } 00128 // } 00129 00130 00131 } 00132 00133 00134 00135 } 00136 00137 MPI_Barrier(worldCom); 00138 00139 //construit les masques d'appartenances des atomes a des sous ensembles 00140 DUMP("analyse ref subset",DBG_WARNING); 00141 AnalyseSubSets(); 00142 DUMP("analyse of ref subset done",DBG_WARNING); 00143 MPI_Barrier(worldCom); 00144 //fait s'échanger les masques d'appartenances au sous groupes 00145 DUMP("exchange subset masks",DBG_WARNING); 00146 ExchangeSubSetsMasks(); 00147 PrintBilanToScreen(); 00148 DUMP("exchange subset masks done",DBG_WARNING); 00149 MPI_Barrier(worldCom); 00150 //effectue le transfert des valeurs des vecteurs attachés 00151 DUMP("exchange subset attached values",DBG_WARNING); 00152 ExchangeSubSetAttachedValues(); 00153 DUMP("exchange subset attached values done",DBG_WARNING); 00154 MPI_Barrier(worldCom); 00155 //effectue la creation des nouvelles references dans les subsets 00156 DUMP("exchange atoms in subsets",DBG_WARNING); 00157 CreationExchangedAtomsInSubSets(); 00158 DUMP("exchange atoms in subsets done",DBG_WARNING); 00159 MPI_Barrier(worldCom); 00160 #ifdef DEBUG_REFERENCEMANAGER 00161 DUMP("check subsets cardinal",DBG_WARNING); 00162 //fait une verification que le cardinal des subsets gere n'ont pas changer avec la migration 00163 CheckSubSetsCardinal(); 00164 DUMP("check subsets cardinal done",DBG_WARNING); 00165 #endif 00166 //vide toutes les structures pour la prochaine fois 00167 DUMP("clear STL",DBG_WARNING); 00168 ClearSTL(); 00169 DUMP("clear STL done",DBG_WARNING); 00170 00171 have_changed = false; 00172 DUMP("end update ref",DBG_INFO); 00173 }
Here is the call graph for this function:

std::map<int,std::vector<void *> > ReferenceManager< Ref >::attached_duo [protected] |
attached duos that need to be updated as well as the conteners
Definition at line 130 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::AdjustSizeRecvBuffers(), ReferenceManager< Ref >::AttachDuoDistributedVector(), ReferenceManager< Ref >::BuildSendingBuffers(), ReferenceManager< Ref >::CreationExchangedAtomsInSubSets(), and ReferenceManager< Ref >::DecodeBuffers().
std::map<Ref,std::map<int,std::vector<double> >,typename Ref::RefComparator> ReferenceManager< Ref >::attached_values [protected] |
attached values (we won't send complete vector)
Definition at line 128 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::ClearSTL(), ReferenceManager< Ref >::CreationExchangedAtomsInSubSets(), and ReferenceManager< Ref >::DecodeBuffers().
std::map<Ref,std::map<int,std::vector<int> >,typename Ref::RefComparator> ReferenceManager< Ref >::attached_values_duo [protected] |
attached values in the duodistributed vector
Definition at line 132 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::ClearSTL(), ReferenceManager< Ref >::CreationExchangedAtomsInSubSets(), and ReferenceManager< Ref >::DecodeBuffers().
std::map<int,std::vector<double *> > ReferenceManager< Ref >::attached_vectors [protected] |
attached vectors that need to be updated as well as the conteners
Definition at line 126 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::AdjustSizeRecvBuffers(), ReferenceManager< Ref >::AttachVector(), ReferenceManager< Ref >::BuildSendingBuffers(), ReferenceManager< Ref >::CreationExchangedAtomsInSubSets(), and ReferenceManager< Ref >::DecodeBuffers().
std::map<Ref,int,typename Ref::RefComparator> ReferenceManager< Ref >::concerned_conteneurs_recv [protected] |
mapping between received atoms and the mask giving ownership to each subsets in chrage
Definition at line 120 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::AdjustSizeRecvBuffers(), ReferenceManager< Ref >::ClearSTL(), ReferenceManager< Ref >::CreationExchangedAtomsInSubSets(), ReferenceManager< Ref >::DecodeBuffers(), ReferenceManager< Ref >::ExchangeSubSetsMasks(), and ReferenceManager< Ref >::PrintBilanToScreen().
std::map<Ref,int,typename Ref::RefComparator> ReferenceManager< Ref >::concerned_conteneurs_sent [protected] |
mapping between sent atoms and the mask giving ownership to each subsets in chrage
Definition at line 118 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::AnalyseSubSets(), ReferenceManager< Ref >::BuildSendingBuffers(), ReferenceManager< Ref >::ClearSTL(), ReferenceManager< Ref >::ExchangeSubSetsMasks(), and ReferenceManager< Ref >::PrintBilanToScreen().
std::vector<ContenerTableauRefAtome<Ref> *> ReferenceManager< Ref >::conteneurs [protected] |
contener in charge (management of atom subsets )
Definition at line 116 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::AdjustSizeRecvBuffers(), ReferenceManager< Ref >::AnalyseSubSets(), ReferenceManager< Ref >::AttachDuoDistributedVector(), ReferenceManager< Ref >::AttachVector(), ReferenceManager< Ref >::BuildSendingBuffers(), ReferenceManager< Ref >::CheckSubSetsCardinal(), ReferenceManager< Ref >::CreationExchangedAtomsInSubSets(), ReferenceManager< Ref >::DecodeBuffers(), ReferenceManager< Ref >::PrintBilanToScreen(), ReferenceManager< RefLammps >::RequestCreationSubSet(), and ReferenceManager< RefLammps >::~ReferenceManager().
bool ReferenceManager< Ref >::have_changed [protected] |
flag to notify if updating of attached references needed
Definition at line 113 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::UpdateRefSubSets().
std::map<Ref,Ref,typename Ref::RefComparator> ReferenceManager< Ref >::moved [protected] |
mapping between moved atoms old ref and new ref
Definition at line 135 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::AnalyseSubSets(), ReferenceManager< Ref >::ClearSTL(), and ReferenceManager< Ref >::UpdateRefSubSets().
std::map<int,std::vector<Ref> > ReferenceManager< Ref >::newatoms [protected] |
new atoms generated by migration (received)
Definition at line 143 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::AdjustSizeRecvBuffers(), ReferenceManager< Ref >::ClearSTL(), ReferenceManager< Ref >::DecodeBuffers(), ReferenceManager< Ref >::ExchangeSubSetAttachedValues(), ReferenceManager< Ref >::ExchangeSubSetsMasks(), and ReferenceManager< Ref >::UpdateRefSubSets().
int ReferenceManager< Ref >::rank [protected] |
Definition at line 147 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::ExchangeSubSetAttachedValues(), ReferenceManager< Ref >::ExchangeSubSetsMasks(), and ReferenceManager< RefLammps >::ReferenceManager().
std::map<Ref,int,typename Ref::RefComparator> ReferenceManager< Ref >::sent [protected] |
mapping between sent atom ref and new proc owner
Definition at line 138 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::AnalyseSubSets(), ReferenceManager< Ref >::ClearSTL(), and ReferenceManager< Ref >::UpdateRefSubSets().
std::map<int,std::vector<Ref> > ReferenceManager< Ref >::sent_byproc [protected] |
inverse mapping : sent atoms sorted by receiving processors
Definition at line 140 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::BuildSendingBuffers(), ReferenceManager< Ref >::ClearSTL(), ReferenceManager< Ref >::ExchangeSubSetAttachedValues(), ReferenceManager< Ref >::ExchangeSubSetsMasks(), and ReferenceManager< Ref >::UpdateRefSubSets().
std::vector<std::map<Ref,int,typename Ref::RefComparator> > ReferenceManager< Ref >::trous [protected] |
holes created by migration in subsets conteners
Definition at line 122 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::AnalyseSubSets(), ReferenceManager< Ref >::BuildSendingBuffers(), ReferenceManager< Ref >::ClearSTL(), and ReferenceManager< Ref >::CreationExchangedAtomsInSubSets().
MPI_Comm ReferenceManager< Ref >::worldCom [protected] |
Definition at line 146 of file reference_manager.h.
Referenced by ReferenceManager< Ref >::AnalyseSubSets(), ReferenceManager< Ref >::CheckSubSetsCardinal(), ReferenceManager< Ref >::ExchangeSubSetAttachedValues(), ReferenceManager< Ref >::ExchangeSubSetsMasks(), ReferenceManager< RefLammps >::ReferenceManager(), and ReferenceManager< Ref >::UpdateRefSubSets().
1.5.2