Ignore:
Timestamp:
08/04/17 16:03:34 (7 years ago)
Author:
mhnguyen
Message:

Making some changes to allow pools with different number of server

+) Associate context client to each grid distribution (This should be changed in the future)
+) Correct some buffer size estimation
+) Clean some redundant code and add comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.hpp

    r1215 r1236  
    5050           EVENT_ID_INDEX, EVENT_ID_LON, EVENT_ID_LAT,  
    5151           EVENT_ID_AREA, EVENT_ID_MASK, 
    52            EVENT_ID_DATA_INDEX, EVENT_ID_SERVER_ATTRIBUT, 
    53            EVENT_ID_INDEX_ZOOM 
     52           EVENT_ID_DATA_INDEX, EVENT_ID_SERVER_ATTRIBUT 
    5453         } ; 
    55  
    56  
    5754 
    5855      public: 
     
    9996         int getOffsetWrittenIndexes() const; 
    10097 
    101          std::map<int, StdSize> getAttributesBufferSize(); 
    102          CArray<size_t,1> localIndexToWriteOnServer; 
    103          CArray<int, 1> compressedIndexToWriteOnServer; 
     98         std::map<int, StdSize> getAttributesBufferSize(CContextClient* client); 
    10499 
    105100         bool isEmpty(void) const; 
     
    107102         bool isCompressible(void) const;  
    108103  
     104         std::vector<int> getNbGlob(); 
     105         bool isEqual(CDomain* domain); 
     106 
     107         static bool dispatchEvent(CEventServer& event); 
     108 
     109      public: 
     110         /// Mutateur /// 
     111         void addRelFile(const StdString & filename); 
     112         void addRelFileCompressed(const StdString& filename);             
     113          
     114         void computeWrittenIndex(); 
     115 
     116         void AllgatherRectilinearLonLat(CArray<double,1>& lon, CArray<double,1>& lat, 
     117                                         CArray<double,1>& lon_g, CArray<double,1>& lat_g); 
     118 
     119         void fillInRectilinearBoundLonLat(CArray<double,1>& lon, CArray<double,1>& lat, 
     120                                           CArray<double,2>& boundsLon, CArray<double,2>& boundsLat); 
     121          
     122         void fillInLonLat(); 
     123         bool distributionAttributesHaveValue() const; 
     124 
     125         size_t getGlobalWrittenSize() ; 
     126         /// Destructeur /// 
     127         virtual ~CDomain(void); 
     128 
     129         /// Accesseurs statiques /// 
     130         static StdString GetName(void); 
     131         static StdString GetDefName(void); 
     132 
     133         static ENodeType GetType(void);         
     134 
     135      public: 
    109136         CArray<double, 1> lonvalue, latvalue; 
    110137         CArray<double, 2> bounds_lonvalue, bounds_latvalue; 
    111138         CArray<double, 1> areavalue; 
    112139 
    113          vector<int> connectedServer ; // list of connected server 
    114          vector<int> nbSenders ; // for each communication with a server, number of communicating client 
    115          vector<int> nbDataSrv ; // size of data to send to each server 
    116          vector< vector<int> > i_indSrv ; // for each server, i global index to send 
    117          vector< vector<int> > j_indSrv ; // for each server, j global index to send 
    118          std::vector<int> getNbGlob(); 
    119          bool isEqual(CDomain* domain); 
    120       public: 
    121          /// Mutateur /// 
    122          void addRelFile(const StdString & filename); 
    123          void addRelFileCompressed(const StdString& filename); 
    124          void completeLonLatClient(void);          
    125          void computeConnectedClients(); 
    126          void computeWrittenIndex(); 
    127  
    128          void AllgatherRectilinearLonLat(CArray<double,1>& lon, CArray<double,1>& lat, 
    129                                          CArray<double,1>& lon_g, CArray<double,1>& lat_g); 
    130  
    131          void fillInRectilinearBoundLonLat(CArray<double,1>& lon, CArray<double,1>& lat, 
    132                                            CArray<double,2>& boundsLon, CArray<double,2>& boundsLat); 
    133           
    134          void fillInLonLat(); 
    135          bool distributionAttributesHaveValue() const; 
    136  
    137          static bool dispatchEvent(CEventServer& event); 
    138          static void recvDistributionAttributes(CEventServer& event); 
    139          static void recvIndex(CEventServer& event); 
    140          static void recvIndexZoom(CEventServer& event); 
    141          static void recvMask(CEventServer& event); 
    142          static void recvZoom(CEventServer& event); 
    143          static void recvLon(CEventServer& event); 
    144          static void recvLat(CEventServer& event); 
    145          static void recvArea(CEventServer& event); 
    146          static void recvDataIndex(CEventServer& event); 
    147          void recvDistributionAttributes(CBufferIn& buffer);                   
    148          void recvIndex(std::map<int, CBufferIn*>& rankBuffers); 
    149          void recvIndexZoom(std::map<int, CBufferIn*>& rankBuffers); 
    150          void recvMask(std::map<int, CBufferIn*>& rankBuffers); 
    151          void recvLon(std::map<int, CBufferIn*>& rankBuffers); 
    152          void recvLat(std::map<int, CBufferIn*>& rankBuffers); 
    153          void recvArea(std::map<int, CBufferIn*>& rankBuffers);          
    154          void recvDataIndex(std::map<int, CBufferIn*>& rankBuffers); 
    155          size_t getGlobalWrittenSize() ; 
    156          /// Destructeur /// 
    157          virtual ~CDomain(void); 
    158  
    159          /// Accesseurs statiques /// 
    160          static StdString GetName(void); 
    161          static StdString GetDefName(void); 
    162  
    163          static ENodeType GetType(void); 
    164          const std::map<int, vector<size_t> >& getIndexServer() const; 
     140         CArray<size_t,1> localIndexToWriteOnServer; 
     141         CArray<int, 1> compressedIndexToWriteOnServer; 
     142 
    165143         CArray<bool, 1> localMask; 
    166144         bool isCurvilinear ; 
     
    192170         void sendMask(); 
    193171         void sendArea(); 
    194          void sendLonLat(); 
    195          void sendIndexZoom(); 
     172         void sendLonLat();          
    196173         void sendDataIndex(); 
    197174         void convertLonLatValue(); 
     
    199176         void fillInCurvilinearLonLat(); 
    200177         void fillInUnstructuredLonLat(); 
     178          
     179         static void recvDistributionAttributes(CEventServer& event); 
     180         static void recvIndex(CEventServer& event); 
     181         static void recvIndexZoom(CEventServer& event); 
     182         static void recvMask(CEventServer& event);          
     183         static void recvLon(CEventServer& event); 
     184         static void recvLat(CEventServer& event); 
     185         static void recvArea(CEventServer& event); 
     186         static void recvDataIndex(CEventServer& event); 
     187         void recvDistributionAttributes(CBufferIn& buffer);                   
     188         void recvIndex(std::map<int, CBufferIn*>& rankBuffers);          
     189         void recvMask(std::map<int, CBufferIn*>& rankBuffers); 
     190         void recvLon(std::map<int, CBufferIn*>& rankBuffers); 
     191         void recvLat(std::map<int, CBufferIn*>& rankBuffers); 
     192         void recvArea(std::map<int, CBufferIn*>& rankBuffers);          
     193         void recvDataIndex(std::map<int, CBufferIn*>& rankBuffers); 
     194 
     195         void completeLonLatClient(void);   
     196         void computeConnectedClients();     
     197 
    201198       private:          
    202199         bool doZoomByIndex_; 
     
    205202         bool isClientChecked; // Verify whether all attributes of domain on the client side are good 
    206203         bool isClientAfterTransformationChecked; 
    207          std::map<int, CArray<int,1> > indiSrv, indjSrv, indGlob_, indGlobZoom_; 
    208          std::map<int,int> nbConnectedClients_, nbConnectedClientsZoom_; // Mapping of number of communicating client to a server 
    209  
    210          boost::unordered_map<int, vector<size_t> > indSrv_; // Global index of each client sent to server 
    211          boost::unordered_map<int, vector<size_t> > indZoomSrv_; // Global index of each client sent to server 
    212          std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server 
     204         std::map<int, CArray<int,1> > indGlob_; 
     205         std::map<CContextClient*, map<int,int> > nbSenders; // Mapping of number of communicating client to a server 
     206 
     207         std::map<CContextClient*, boost::unordered_map<int, vector<size_t> > > indSrv_; // Global index of each client sent to server          
     208         // std::map<CContextClient*, std::map<int, vector<int> > > indWrittenSrv_; // Global written index of each client sent to server 
    213209         std::vector<int> indexesToWrite; 
    214          std::vector<int> recvClientRanks_, recvClientZoomRanks_; 
    215          int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_; 
    216          std::vector<int> connectedServerRank_, connectedServerZoomRank_;          
     210         std::vector<int> recvClientRanks_; 
     211         int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;          
     212         std::map<CContextClient*, std::map<int,size_t> > connectedDataSize_; 
     213         std::map<CContextClient*, std::vector<int> > connectedServerRank_; 
     214 
    217215         //! True if and only if the data defined on the domain can be outputted in a compressed way 
    218216         bool isCompressible_; 
     
    220218         TransMapTypes transformationMap_;          
    221219         bool isUnstructed_; 
    222          boost::unordered_map<size_t,size_t> globalLocalIndexMap_, globalLocalIndexZoomMap_; 
     220         boost::unordered_map<size_t,size_t> globalLocalIndexMap_; 
    223221        
    224222       private: 
Note: See TracChangeset for help on using the changeset viewer.