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
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"
[300]9
[335]10namespace xios
[300]11{
12    class CServer
13    {
[523]14      public:
[1646]15        ~CServer(){};
[523]16        static void initialize(void);
17        static void finalize(void);
[1646]18       
[523]19        static void eventLoop(void);
[1378]20        static void contextEventLoop(bool enableEventsProcessing=true);
[523]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);
[1587]26        static void listenRootOasisEnddef(void);
27        static void listenOasisEnddef(void);
[1054]28        static void registerContext(void* buff,int count, int leaderRank=0);
[490]29
[1601]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)
[523]35        static CEventScheduler* eventScheduler;
[983]36
[1021]37        static int serverLevel ;
[1009]38
[523]39        struct contextMessage
40        {
41          int nbRecv;
42          int leaderRank;
43        };
[300]44
[523]45        static bool isRoot;
[490]46
[1054]47        static map<string,CContext*> contextList;
[523]48        static bool finished;
49        static bool is_MPI_Initialized;
[490]50
[523]51      public:
[1243]52        //! Get rank of the current process in the intraComm
[523]53        static int getRank();
[490]54
[1180]55        //!< Get global ranks of secondary server processes
[1168]56        static vector<int>& getSecondaryServerGlobalRanks();
57
[523]58        //! Open a file stream to write the info logs
[490]59        static void openInfoStream(const StdString& fileName);
[523]60        //! Write the info logs to standard output
[490]61        static void openInfoStream();
[523]62        //! Close the info logs file if it opens
[490]63        static void closeInfoStream();
64
[523]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:
[1243]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
[490]76        static StdOFStream m_infoStream;
[523]77        static StdOFStream m_errorStream;
78        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb);
[1646]79
[523]80    };
[1646]81   
[300]82}
83
84#endif
Note: See TracBrowser for help on using the repository browser.