source: XIOS/trunk/src/server.hpp @ 655

Last change on this file since 655 was 655, checked in by rlacroix, 9 years ago

Properly release all MPI resources.

  • 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.0 KB
Line 
1#ifndef __SERVER_HPP__
2#define __SERVER_HPP__
3
4#include "xios_spl.hpp"
5#include "context.hpp"
6#include "mpi.hpp"
7#include "event_scheduler.hpp"
8
9namespace xios
10{
11    class CServer
12    {
13      public:
14        static void initialize(void);
15        static void finalize(void);
16        static void eventLoop(void);
17        static void contextEventLoop(void);
18        static void listenContext(void);
19        static void listenFinalize(void);
20        static void recvContextMessage(void* buff,int count);
21        static void listenRootContext(void);
22        static void listenRootFinalize(void);
23        static void registerContext(void* buff,int count, int leaderRank=0);
24
25        static MPI_Comm intraComm;
26        static list<MPI_Comm> interComm;
27        static std::list<MPI_Comm> contextInterComms;
28        static CEventScheduler* eventScheduler;
29
30        struct contextMessage
31        {
32          int nbRecv;
33          int leaderRank;
34        };
35
36        static bool isRoot;
37
38        static map<string,CContext*> contextList;
39        static bool finished;
40        static bool is_MPI_Initialized;
41
42      public:
43        //! Get rank of the current process
44        static int getRank();
45
46        //! Open a file stream to write the info logs
47        static void openInfoStream(const StdString& fileName);
48        //! Write the info logs to standard output
49        static void openInfoStream();
50        //! Close the info logs file if it opens
51        static void closeInfoStream();
52
53        //! Open a file stream to write the error log
54        static void openErrorStream(const StdString& fileName);
55        //! Write the error log to standard error output
56        static void openErrorStream();
57        //! Close the error log file if it opens
58        static void closeErrorStream();
59
60      private:
61        static int rank;
62        static StdOFStream m_infoStream;
63        static StdOFStream m_errorStream;
64
65        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb);
66    };
67}
68
69#endif
Note: See TracBrowser for help on using the repository browser.