source: XIOS/dev/dev_trunk_omp/src/server.hpp @ 1646

Last change on this file since 1646 was 1646, checked in by yushan, 5 years ago

branch merged with trunk @1645. arch file (ep&mpi) added for ADA

  • 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 CServer
13    {
14      public:
15        ~CServer(){};
16        static void initialize(void);
17        static void finalize(void);
18       
19        static void eventLoop(void);
20        static void contextEventLoop(bool enableEventsProcessing=true);
21        static void listenContext(void);
22        static void listenFinalize(void);
23        static void recvContextMessage(void* buff,int count);
24        static void listenRootContext(void);
25        static void listenRootFinalize(void);
26        static void listenRootOasisEnddef(void);
27        static void listenOasisEnddef(void);
28        static void registerContext(void* buff,int count, int leaderRank=0);
29
30        static ep_lib::MPI_Comm intraComm;
31        static std::list<ep_lib::MPI_Comm> interCommLeft;           // interComm between server (primary, classical or secondary) and its client (client or primary server)
32        static std::list<ep_lib::MPI_Comm> interCommRight;          // interComm between primary server and secondary server (non-empty only for primary server pool)
33        static std::list<ep_lib::MPI_Comm> contextInterComms;  // list of context intercomms
34        static std::list<ep_lib::MPI_Comm> contextIntraComms;  // list of context intercomms (needed only in case of secondary servers)
35        static CEventScheduler* eventScheduler;
36
37        static int serverLevel ;
38
39        struct contextMessage
40        {
41          int nbRecv;
42          int leaderRank;
43        };
44
45        static bool isRoot;
46
47        static map<string,CContext*> contextList;
48        static bool finished;
49        static bool is_MPI_Initialized;
50
51      public:
52        //! Get rank of the current process in the intraComm
53        static int getRank();
54
55        //!< Get global ranks of secondary server processes
56        static vector<int>& getSecondaryServerGlobalRanks();
57
58        //! Open a file stream to write the info logs
59        static void openInfoStream(const StdString& fileName);
60        //! Write the info logs to standard output
61        static void openInfoStream();
62        //! Close the info logs file if it opens
63        static void closeInfoStream();
64
65        //! Open a file stream to write the error log
66        static void openErrorStream(const StdString& fileName);
67        //! Write the error log to standard error output
68        static void openErrorStream();
69        //! Close the error log file if it opens
70        static void closeErrorStream();
71
72      private:
73        static vector<int> sndServerGlobalRanks;  //!< Global ranks of pool leaders on the secondary server
74        static int rank_;                         //!< If (!oasis) global rank, else rank in the intraComm returned by oasis
75        static int nbContexts;                    //!< Number of contexts registered by server
76        static StdOFStream m_infoStream;
77        static StdOFStream m_errorStream;
78        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb);
79
80    };
81   
82}
83
84#endif
Note: See TracBrowser for help on using the repository browser.