source: XIOS3/trunk/src/server.hpp @ 2634

Last change on this file since 2634 was 2628, checked in by jderouillat, 4 months ago

New timers integration/reporting

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 3.7 KB
RevLine 
[342]1#ifndef __SERVER_HPP__
2#define __SERVER_HPP__
[300]3
[591]4#include "xios_spl.hpp"
[300]5#include "context.hpp"
[697]6#include "context_client.hpp"
[382]7#include "mpi.hpp"
[492]8#include "event_scheduler.hpp"
[2335]9#include "oasis_cinterface.hpp"
[300]10
[335]11namespace xios
[300]12{
[1761]13    class CServersRessource ;
14
[2335]15    class CThirdPartyDriver
16    {
17      public:
18        CThirdPartyDriver()
19        {
20          oasis_init(CXios::xiosCodeId);
21        };
22        virtual ~CThirdPartyDriver()
23        {
24          oasis_finalize();
25        };
26        virtual void endSynchronizedDefinition()
27        {
28          oasis_enddef();
29        };
30        virtual void getComponentCommunicator(MPI_Comm &intraComm)
31        {
32          oasis_get_localcomm(intraComm);
33        };
34    };
35 
[300]36    class CServer
37    {
[523]38      public:
39        static void initialize(void);
[1761]40        static void xiosGlobalCommByFileExchange(MPI_Comm serverComm) ;
41        static void xiosGlobalCommByPublishing(MPI_Comm serverComm) ;
42
[2333]43        static void listenRootOasisEnddef(void);
44        static void listenOasisEnddef(void);
[2523]45        static void testingEventScheduler(void);
46       
[523]47        static void finalize(void);
[2628]48        static void printProfile(void);
[523]49        static void eventLoop(void);
[1765]50       
[2332]51        static MPI_Comm intraComm_;
[1761]52        static MPI_Comm serversComm_;
[1639]53        static std::list<MPI_Comm> interCommLeft;           // interComm between server (primary, classical or secondary) and its client (client or primary server)
54        static std::list<MPI_Comm> interCommRight;          // interComm between primary server and secondary server (non-empty only for primary server pool)
55        static std::list<MPI_Comm> contextInterComms;  // list of context intercomms
56        static std::list<MPI_Comm> contextIntraComms;  // list of context intercomms (needed only in case of secondary servers)
[523]57        static CEventScheduler* eventScheduler;
[983]58
[1021]59        static int serverLevel ;
[1009]60
[523]61        struct contextMessage
62        {
63          int nbRecv;
64          int leaderRank;
65        };
[300]66
[523]67        static bool isRoot;
[490]68
[1054]69        static map<string,CContext*> contextList;
[523]70        static bool finished;
71        static bool is_MPI_Initialized;
[490]72
[523]73      public:
[1243]74        //! Get rank of the current process in the intraComm
[523]75        static int getRank();
[490]76
[1180]77        //!< Get global ranks of secondary server processes
[1168]78        static vector<int>& getSecondaryServerGlobalRanks();
79
[523]80        //! Open a file stream to write the info logs
[490]81        static void openInfoStream(const StdString& fileName);
[523]82        //! Write the info logs to standard output
[490]83        static void openInfoStream();
[523]84        //! Close the info logs file if it opens
[490]85        static void closeInfoStream();
86
[523]87        //! Open a file stream to write the error log
88        static void openErrorStream(const StdString& fileName);
89        //! Write the error log to standard error output
90        static void openErrorStream();
91        //! Close the error log file if it opens
92        static void closeErrorStream();
93
[1761]94        static CServersRessource* getServersRessource(void) { return serversRessource_;}
95        static void launchServersRessource(MPI_Comm commServer) ;
[2274]96        static void finalizeServersRessource(void) ;
[2212]97        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb);
[1761]98     
[523]99      private:
[1243]100        static vector<int> sndServerGlobalRanks;  //!< Global ranks of pool leaders on the secondary server
101        static int rank_;                         //!< If (!oasis) global rank, else rank in the intraComm returned by oasis
102        static int nbContexts;                    //!< Number of contexts registered by server
[490]103        static StdOFStream m_infoStream;
[523]104        static StdOFStream m_errorStream;
[2274]105        static CServersRessource* serversRessource_  ;
[2335]106
107        static CThirdPartyDriver* driver_;
[523]108    };
[300]109}
110
111#endif
Note: See TracBrowser for help on using the repository browser.