source: XIOS/dev/dev_ym/XIOS_COUPLING/src/server.hpp @ 2333

Last change on this file since 2333 was 2333, checked in by jderouillat, 2 years ago

Reintroduced oasis_enddef management on the server side (communications are operated on MPI_COMM_WORLD in Oasis). XIOS clients require to initilialize Oasis by themselves first, and then to specify their local_comm to xios_initialize. Coupled components must be specified through clients_code_id in iodef.xml

  • 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.1 KB
Line 
1#ifndef __SERVER_HPP__
2#define __SERVER_HPP__
3
4#include "xios_spl.hpp"
5#include "context.hpp"
6#include "context_client.hpp"
7#include "mpi.hpp"
8#include "event_scheduler.hpp"
9
10namespace xios
11{
12    class CServersRessource ;
13
14    class CServer
15    {
16      public:
17        static void initialize(void);
18        static void xiosGlobalCommByFileExchange(MPI_Comm serverComm) ;
19        static void xiosGlobalCommByPublishing(MPI_Comm serverComm) ;
20
21        static void listenRootOasisEnddef(void);
22        static void listenOasisEnddef(void);
23
24        static void finalize(void);
25        static void eventLoop(void);
26       
27        static MPI_Comm intraComm_;
28        static MPI_Comm serversComm_;
29        static std::list<MPI_Comm> interCommLeft;           // interComm between server (primary, classical or secondary) and its client (client or primary server)
30        static std::list<MPI_Comm> interCommRight;          // interComm between primary server and secondary server (non-empty only for primary server pool)
31        static std::list<MPI_Comm> contextInterComms;  // list of context intercomms
32        static std::list<MPI_Comm> contextIntraComms;  // list of context intercomms (needed only in case of secondary servers)
33        static CEventScheduler* eventScheduler;
34
35        static int serverLevel ;
36
37        struct contextMessage
38        {
39          int nbRecv;
40          int leaderRank;
41        };
42
43        static bool isRoot;
44
45        static map<string,CContext*> contextList;
46        static bool finished;
47        static bool is_MPI_Initialized;
48
49      public:
50        //! Get rank of the current process in the intraComm
51        static int getRank();
52
53        //!< Get global ranks of secondary server processes
54        static vector<int>& getSecondaryServerGlobalRanks();
55
56        //! Open a file stream to write the info logs
57        static void openInfoStream(const StdString& fileName);
58        //! Write the info logs to standard output
59        static void openInfoStream();
60        //! Close the info logs file if it opens
61        static void closeInfoStream();
62
63        //! Open a file stream to write the error log
64        static void openErrorStream(const StdString& fileName);
65        //! Write the error log to standard error output
66        static void openErrorStream();
67        //! Close the error log file if it opens
68        static void closeErrorStream();
69
70        static CServersRessource* getServersRessource(void) { return serversRessource_;}
71        static void launchServersRessource(MPI_Comm commServer) ;
72        static void finalizeServersRessource(void) ;
73        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb);
74     
75      private:
76        static vector<int> sndServerGlobalRanks;  //!< Global ranks of pool leaders on the secondary server
77        static int rank_;                         //!< If (!oasis) global rank, else rank in the intraComm returned by oasis
78        static int nbContexts;                    //!< Number of contexts registered by server
79        static StdOFStream m_infoStream;
80        static StdOFStream m_errorStream;
81        static CServersRessource* serversRessource_  ;
82    };
83}
84
85#endif
Note: See TracBrowser for help on using the repository browser.