Ignore:
Timestamp:
03/22/18 10:43:20 (6 years ago)
Author:
yushan
Message:

branch_openmp merged with XIOS_DEV_CMIP6@1459

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/src/node/axis.hpp

    r1331 r1460  
    1616#include "transformation.hpp" 
    1717#include "transformation_enum.hpp" 
     18 
     19#include "mpi_std.hpp" 
    1820 
    1921namespace xios { 
     
    3840      , public CAxisAttributes 
    3941   { 
     42               /// typedef /// 
     43         typedef CObjectTemplate<CAxis>   SuperClass; 
     44         typedef CAxisAttributes SuperClassAttribute; 
     45          
     46      public: 
    4047         enum EEventId 
    4148         { 
    42            EVENT_ID_SERVER_ATTRIBUT, 
    43            EVENT_ID_INDEX, 
     49           EVENT_ID_DISTRIBUTION_ATTRIBUTE,            
    4450           EVENT_ID_DISTRIBUTED_VALUE, 
    45            EVENT_ID_NON_DISTRIBUTED_VALUE 
     51           EVENT_ID_NON_DISTRIBUTED_VALUE, 
     52           EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES, 
     53           EVENT_ID_DISTRIBUTED_ATTRIBUTES 
    4654         } ; 
    4755 
    48          /// typedef /// 
    49          typedef CObjectTemplate<CAxis>   SuperClass; 
    50          typedef CAxisAttributes SuperClassAttribute; 
    51  
    52       public : 
    53  
     56      public: 
    5457         typedef CAxisAttributes RelAttributes; 
    5558         typedef CAxisGroup      RelGroup; 
     
    6871         const std::set<StdString> & getRelFiles(void) const; 
    6972 
    70          const std::vector<int>& getIndexesToWrite(void) const; 
    71          int getNumberWrittenIndexes() const; 
    72          int getTotalNumberWrittenIndexes() const; 
    73          int getOffsetWrittenIndexes() const; 
     73         int getNumberWrittenIndexes(ep_lib::MPI_Comm writtenCom); 
     74         int getTotalNumberWrittenIndexes(ep_lib::MPI_Comm writtenCom); 
     75         int getOffsetWrittenIndexes(ep_lib::MPI_Comm writtenCom); 
     76         CArray<int, 1>& getCompressedIndexToWriteOnServer(ep_lib::MPI_Comm writtenCom); 
    7477 
    75          std::map<int, StdSize> getAttributesBufferSize(); 
     78         std::map<int, StdSize> getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid, 
     79                                                        CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION); 
    7680 
    7781         /// Test /// 
     
    9397         virtual void parse(xml::CXMLNode & node); 
    9498 
     99         void setContextClient(CContextClient* contextClient); 
     100 
    95101         /// Accesseurs statiques /// 
    96102         static StdString GetName(void); 
     
    98104         static ENodeType GetType(void); 
    99105 
    100          void sendServerAttribut(const std::vector<int>& globalDim, int orderPositionInGrid, 
    101                                  CServerDistributionDescription::ServerDistributionType distType); 
    102          static bool dispatchEvent(CEventServer& event); 
    103          static void recvServerAttribut(CEventServer& event); 
    104          void recvServerAttribut(CBufferIn& buffer) ; 
     106         static bool dispatchEvent(CEventServer& event);          
     107          
    105108         void checkAttributesOnClient(); 
    106109         void checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid, 
     
    110113 
    111114         void checkEligibilityForCompressedOutput(); 
     115         size_t getGlobalWrittenSize(void) ; 
    112116 
     117         void computeWrittenIndex(); 
     118         void computeWrittenCompressedIndex(ep_lib::MPI_Comm); 
    113119         bool hasTransformation(); 
    114120         void solveInheritanceTransformation(); 
    115          TransMapTypes getAllTransformations(); 
    116          void fillInValues(const CArray<double,1>& values); 
     121         TransMapTypes getAllTransformations();          
    117122         void duplicateTransformation(CAxis*); 
    118123         CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id=""); 
    119124         bool isEqual(CAxis* axis); 
     125         bool zoomByIndex(); 
    120126 
    121       public: 
    122         int zoom_begin_srv, zoom_end_srv, zoom_size_srv; 
    123         int ni_srv, begin_srv, end_srv; 
    124         int global_zoom_begin_srv, global_zoom_end_srv, global_zoom_size_srv; 
    125         CArray<double,1> value_srv; 
    126         CArray<double,2> bound_srv; 
    127         CArray<StdString,1> label_srv; 
    128         CArray<int,1> zoom_index_srv; 
    129         bool hasValue; 
     127      public:  
     128        bool hasValue;         
     129        CArray<size_t,1> localIndexToWriteOnServer;         
    130130 
    131131      private: 
     
    134134         void checkZoom(); 
    135135         void checkBounds(); 
    136          void checkLabel();          
    137          void sendValue(); 
    138          void computeConnectedServer(const std::vector<int>& globalDim, int orderPositionInGrid, 
     136         void checkLabel(); 
     137         void sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, 
     138                             CServerDistributionDescription::ServerDistributionType distType); 
     139         void sendDistributionAttribute(const std::vector<int>& globalDim, int orderPositionInGrid, 
     140                                        CServerDistributionDescription::ServerDistributionType distType); 
     141         void computeConnectedClients(const std::vector<int>& globalDim, int orderPositionInGrid, 
    139142                                     CServerDistributionDescription::ServerDistributionType distType); 
    140          void sendDistributedValue(); 
    141          void sendNonDistributedValue(); 
    142          bool zoomByIndex(); 
    143143 
    144          static void recvIndex(CEventServer& event); 
    145          static void recvDistributedValue(CEventServer& event); 
    146          static void recvNonDistributedValue(CEventServer& event); 
    147          void recvIndex(int rank, CBufferIn& buffer); 
    148          void recvDistributedValue(int rank, CBufferIn& buffer); 
    149          void recvNonDistributedValue(int rank, CBufferIn& buffer); 
     144         void sendNonDistributedAttributes(void); 
     145         void sendDistributedAttributes(void); 
     146 
     147         static void recvNonDistributedAttributes(CEventServer& event); 
     148         static void recvDistributedAttributes(CEventServer& event); 
     149         static void recvDistributionAttribute(CEventServer& event); 
     150         void recvNonDistributedAttributes(int rank, CBufferIn& buffer); 
     151         void recvDistributedAttributes(vector<int>& rank, vector<CBufferIn*> buffers); 
     152         void recvDistributionAttribute(CBufferIn& buffer); 
    150153 
    151154         void setTransformations(const TransMapTypes&); 
    152155 
    153156      private: 
     157 
     158/** Clients that have to send a domain. There can be multiple clients in case of secondary server, otherwise only one client. */ 
     159         std::list<CContextClient*> clients; 
     160         std::set<CContextClient*> clientsSet; 
     161 
    154162         bool isChecked; 
    155163         bool areClientAttributesChecked_; 
    156164         bool isClientAfterTransformationChecked; 
    157165         std::set<StdString> relFiles, relFilesCompressed; 
    158          TransMapTypes transformationMap_; 
    159          bool isDistributed_; 
     166         TransMapTypes transformationMap_;          
    160167         //! True if and only if the data defined on the axis can be outputted in a compressed way 
    161168         bool isCompressible_; 
    162          std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server 
    163          std::map<int, vector<size_t> > indSrv_; // Global index of each client sent to server 
    164          std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server 
     169         std::map<int, map<int,int> > nbSenders; // Mapping of number of communicating client to a server 
     170         std::map<int, boost::unordered_map<int, vector<size_t> > > indSrv_; // Global index of each client sent to server 
     171         // std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server 
     172         boost::unordered_map<size_t,size_t> globalLocalIndexMap_; 
    165173         std::vector<int> indexesToWrite; 
    166          int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_; 
    167          std::vector<int> connectedServerRank_; 
    168          std::map<int, CArray<int,1> > indiSrv_; 
    169          bool hasBounds_; 
    170          bool hasLabel; 
     174         std::map<int,int> numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_; 
     175         std::map<int, CArray<int, 1> > compressedIndexToWriteOnServer; 
     176         std::map<int, std::vector<int> > connectedServerRank_; 
     177         bool hasBounds; 
     178         bool hasLabel;          
     179         bool computedWrittenIndex_;                   
    171180 
    172181       private: 
Note: See TracChangeset for help on using the changeset viewer.