source: XIOS/dev/dev_olga/src/server.hpp @ 1027

Last change on this file since 1027 was 1021, checked in by oabramkina, 7 years ago

Intermeadiate version for merging with new server functionalities.

  • 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: 2.9 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:
15        static void initialize(void);
[987]16        static void initialize(const StdString& serverId);
[523]17        static void finalize(void);
18        static void eventLoop(void);
19        static void contextEventLoop(void);
20        static void listenContext(void);
21        static void listenFinalize(void);
22        static void recvContextMessage(void* buff,int count);
23        static void listenRootContext(void);
24        static void listenRootFinalize(void);
[983]25        static void registerContext(void* buff,int count, int leaderRank=0);        // context registered by the primary server
[490]26
[983]27        // Communicators for the primary group of servers
[523]28        static MPI_Comm intraComm;
[1009]29        static list<MPI_Comm> interCommLeft;   // interComm between server (primary or secondary) and its client (client or primary server)
[992]30        static list<MPI_Comm> interCommRight;  // interComm between primary server and secondary server (non-empty only for primary server pool)
31        static list<MPI_Comm> interComm;       // interCommLeft + interCommRight
[655]32        static std::list<MPI_Comm> contextInterComms;
[523]33        static CEventScheduler* eventScheduler;
[983]34
[1021]35        static int serverLevel ;
[1009]36
[1021]37//        static int nbSndSrvPools;   // number of secondary server pools
38//        static int poolNb;          // for secondary servers; stores the pool number
39
[523]40        struct contextMessage
41        {
42          int nbRecv;
43          int leaderRank;
44        };
[300]45
[523]46        static bool isRoot;
[490]47
[983]48        static map<string,CContext*> contextList;       // contexts on the primary server
[523]49        static bool finished;
50        static bool is_MPI_Initialized;
[490]51
[523]52      public:
53        //! Get rank of the current process
54        static int getRank();
[490]55
[523]56        //! Open a file stream to write the info logs
[490]57        static void openInfoStream(const StdString& fileName);
[523]58        //! Write the info logs to standard output
[490]59        static void openInfoStream();
[523]60        //! Close the info logs file if it opens
[490]61        static void closeInfoStream();
62
[523]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      private:
71        static int rank;
[1021]72        static int serverSize;  //!< Number of procs dedicated to server
73        static int nbPools;     //!< Number of secondary-server pools
74        static int poolId;      //!< ID of a secondary-server pool
[490]75        static StdOFStream m_infoStream;
[523]76        static StdOFStream m_errorStream;
77
78        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb);
79    };
[300]80}
81
82#endif
Note: See TracBrowser for help on using the repository browser.