source: XIOS/dev/branch_yushan/src/server.hpp @ 1074

Last change on this file since 1074 was 1072, checked in by yushan, 7 years ago

Using threads : modif for xios_initialize

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