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/context.hpp

    r1334 r1460  
    1414#include "garbage_collector.hpp" 
    1515#include "registry.hpp" 
     16//#include "mpi.hpp" 
    1617 
    1718 
     
    5152           EVENT_ID_CLOSE_DEFINITION,EVENT_ID_UPDATE_CALENDAR, 
    5253           EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE, 
    53            EVENT_ID_POST_PROCESS, EVENT_ID_SEND_REGISTRY 
     54           EVENT_ID_POST_PROCESS, EVENT_ID_SEND_REGISTRY, 
     55           EVENT_ID_POST_PROCESS_GLOBAL_ATTRIBUTES, 
     56           EVENT_ID_PROCESS_GRID_ENABLED_FIELDS 
    5457         }; 
    5558 
     
    8891      public : 
    8992         // Initialize server or client 
     93         void initClient(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtServer = 0); 
    9094         void initServer(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtClient = 0); 
    91          void initClient(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtServer = 0); 
    9295         bool isInitialized(void); 
    9396 
    9497         // Put sever or client into loop state 
    95          bool checkBuffersAndListen(void); 
     98         bool checkBuffersAndListen(bool enableEventsProcessing=true); 
    9699 
    97100         // Finalize a context 
    98101         void finalize(void); 
     102         bool isFinalized(void); 
     103 
    99104         void closeDefinition(void); 
    100105 
    101106         // Some functions to process context 
    102          void findAllEnabledFields(void); 
    103          void findAllEnabledFieldsInReadModeFiles(void); 
     107         void findAllEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles); 
     108         // void findAllEnabledFields(void); 
     109         // void findAllEnabledFieldsInReadModeFiles(void); 
    104110         void readAttributesOfEnabledFieldsInReadModeFiles(); 
    105111         void solveAllInheritance(bool apply=true); 
    106112         void findEnabledFiles(void); 
     113         void findEnabledWriteModeFiles(void); 
    107114         void findEnabledReadModeFiles(void); 
    108115         void closeAllFile(void); 
    109116         void updateCalendar(int step); 
    110          void createFileHeader(void ); 
     117         void createFileHeader(void); 
     118         void initReadFiles(void); 
    111119         void checkAxisDomainsGridsEligibilityForCompressedOutput(); 
    112120         void prepareTimeseries(void); 
    113          void solveOnlyRefOfEnabledFields(bool sendToServer); 
    114          void solveAllRefOfEnabledFields(bool sendToServer); 
     121         void solveOnlyRefOfEnabledFields(bool sendToServer);          
    115122         void buildFilterGraphOfEnabledFields(); 
     123         void postProcessFilterGraph(); 
    116124         void startPrefetchingOfEnabledReadModeFiles(); 
     125         void doPreTimestepOperationsForEnabledReadModeFiles(); 
    117126         void doPostTimestepOperationsForEnabledReadModeFiles(); 
    118127         void findFieldsWithReadAccess(void); 
     
    120129         void buildFilterGraphOfFieldsWithReadAccess(); 
    121130         void postProcessing(); 
    122  
    123          std::map<int, StdSize> getAttributesBufferSize(std::map<int, StdSize>& maxEventSize); 
    124          std::map<int, StdSize> getDataBufferSize(std::map<int, StdSize>& maxEventSize); 
    125          void setClientServerBuffer(); 
     131         void postProcessingGlobalAttributes();          
     132 
     133         void solveAllRefOfEnabledFieldsAndTransform(bool sendToServer); 
     134         void checkGridEnabledFields(); 
     135         void checkGridEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles); 
     136         void sendGridEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles);   
     137         void sendGridComponentEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles)       ; 
     138 
     139         std::map<int, StdSize> getAttributesBufferSize(std::map<int, StdSize>& maxEventSize, CContextClient* contextClient, bool bufferForWriting = false); 
     140         std::map<int, StdSize> getDataBufferSize(std::map<int, StdSize>& maxEventSize, CContextClient* contextClient, bool bufferForWriting = false); 
     141         void setClientServerBuffer(CContextClient* contextClient, bool bufferForWriting = false); 
     142 
     143         // Distribute files (in write mode) among secondary-server pools according to the estimated data flux 
     144         void distributeFiles(void); 
     145         void distributeFileOverBandwith() ; 
     146         void distributeFileOverMemoryBandwith() ; 
     147          
    126148 
    127149         // Send context close definition 
     
    130152         void sendUpdateCalendar(int step); 
    131153         void sendCreateFileHeader(void); 
    132          void sendEnabledFiles(); 
    133          void sendEnabledFields(); 
    134          void sendRefDomainsAxis(); 
    135          void sendRefGrid(); 
     154         void sendEnabledFiles(const std::vector<CFile*>& activeFiles); 
     155         void sendEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles); 
     156         void sendRefDomainsAxisScalars(const std::vector<CFile*>& activeFiles); 
     157         void sendRefGrid(const std::vector<CFile*>& activeFiles); 
    136158         void sendPostProcessing(); 
    137          void sendRegistry(void) ; //!< after be gathered to the root process of the context, merged registry is sent to the root process of the servers 
     159         void sendPostProcessingGlobalAttributes(); 
     160         void sendProcessingGridOfEnabledFields(); 
     161         //!< after be gathered to the root process of the context, merged registry is sent to the root process of the servers 
     162         void sendRegistry(void) ; 
     163 
    138164         const StdString& getIdServer(); 
     165         const StdString& getIdServer(const int srvPoolNb); 
    139166 
    140167         // Client side: Receive and process messages 
     
    148175         static void recvPostProcessing(CEventServer& event); 
    149176         void recvPostProcessing(CBufferIn& buffer); 
     177         static void recvProcessingGridOfEnabledFields(CEventServer& event); 
     178         static void recvPostProcessingGlobalAttributes(CEventServer& event); 
     179         void recvPostProcessingGlobalAttributes(CBufferIn& buffer); 
    150180         static void recvRegistry(CEventServer& event) ; 
    151          void recvRegistry(CBufferIn& buffer) ; //!< registry is received by the root process of the servers 
     181         void recvRegistry(CBufferIn& buffer) ; //!< registry is received by the servers 
     182 
     183         void freeComms(void);                  //!< Free internally allcoated communicators 
     184         void releaseClientBuffers(void);       //! Deallocate buffers allocated by clientContexts 
    152185 
    153186         // dispatch event 
     
    192225         virtual bool hasChild(void) const; 
    193226 
     227 
    194228      public : 
    195229         // Calendar of context 
     
    200234         // List of all enabled files in read mode (files on which fields are read) 
    201235         std::vector<CFile*> enabledReadModeFiles; 
     236         // List of all enabled files in write mode 
     237         std::vector<CFile*> enabledWriteModeFiles; 
    202238 
    203239         // List of all enabled fields whose instant data is accessible from the public API 
     
    215251         bool hasServer; 
    216252 
    217          // Concrete context server 
    218          CContextServer* server; 
    219  
    220          // Concrete contex client 
    221          CContextClient* client; 
    222          CRegistry* registryIn ;  //!< input registry which is read from file 
    223          CRegistry* registryOut ; //!< output registry which will be wrote on file at the finalize 
     253         CContextServer* server;    //!< Concrete context server 
     254         CContextClient* client;    //!< Concrete contex client 
     255         std::vector<CContextServer*> serverPrimServer; 
     256         std::vector<CContextClient*> clientPrimServer; 
     257 
     258         CRegistry* registryIn ;    //!< input registry which is read from file 
     259         CRegistry* registryOut ;   //!< output registry which will be written into file at the finalize 
    224260 
    225261      private: 
    226262         bool isPostProcessed; 
     263         bool allProcessed; 
    227264         bool finalized; 
     265         int countChildCtx_;        //!< Counter of child contexts (for now it is the number of secondary server pools) 
    228266         StdString idServer_; 
    229267         CGarbageCollector garbageCollector; 
Note: See TracChangeset for help on using the changeset viewer.