source: XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.hpp @ 2310

Last change on this file since 2310 was 2310, checked in by ymipsl, 2 years ago

Implement small garbage collector for unfreed MPI windows and communicator.

YM

  • 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: 5.4 KB
Line 
1#ifndef __XIOS_HPP__
2#define __XIOS_HPP__
3
4#include "xios_spl.hpp"
5#include "mpi.hpp"
6#include "registry.hpp"
7#include "ressources_manager.hpp"
8#include "services_manager.hpp"
9#include "contexts_manager.hpp"
10#include "daemons_manager.hpp"
11#include "coupler_manager.hpp"
12#include "registry_manager.hpp"
13#include "mpi_garbage_collector.hpp"
14
15namespace xios
16{
17  /*!
18  \class CXios
19  */
20  class CXios
21  {
22    public:
23     static void initialize(void) ;
24     static void initClientSide(const string & codeId, MPI_Comm& localComm, MPI_Comm& returnComm) ;
25     static void initServerSide(void) ;
26     static void clientFinalize(void) ;
27     static void parseFile(const string& filename) ;
28
29     template <typename T>
30     static T getin(const string& id,const T& defaultValue) ;
31
32     template <typename T>
33     static T getin(const string& id) ;
34
35    public:
36     static string rootFile ; //!< Configuration filename
37     static string xiosCodeId ; //!< Identity for XIOS
38     static string clientFile;        //!< Filename template for client
39     static string serverFile;        //!< Filename template for server
40     static string serverPrmFile;  //!< Filename template for primary server in case of two server levels
41     static string serverSndFile;  //!< Filename template for secondary server in case of two server levels
42
43     static bool xiosStack;    //!< Exception handling
44     static bool systemStack;  //!< Exception handling
45
46     static bool isClient ; //!< Check if xios is client
47     static bool isServer ; //!< Check if xios is server
48
49     static MPI_Comm globalComm ; //!< Global communicator
50     static MPI_Comm xiosComm ; //!< Global communicator
51
52     static bool printLogs2Files; //!< Printing out logs into files
53     static bool usingOasis ;     //!< Using Oasis
54     static bool usingServer ;    //!< Using server (server mode)
55     static bool usingServer2 ;   //!< Using secondary server (server mode). IMPORTANT: Use this variable ONLY in CServer::initialize().
56     static int ratioServer2 ;    //!< Percentage of server processors dedicated to secondary server
57     static int nbPoolsServer2 ;  //!< Number of pools created on the secondary server
58     static double bufferSizeFactor; //!< Factor used to tune the buffer size
59     static const double defaultBufferSizeFactor; //!< Default factor value
60     static StdSize minBufferSize; //!< Minimum buffer size
61     static StdSize maxBufferSize; //!< Maximum buffer size
62     static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible)
63     static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers
64     static double recvFieldTimeout; //!< Time to wait for data before issuing an error when receiving a field
65     static bool checkEventSync; //!< For debuuging, check if event are coherent and synchrone on client side
66     
67     static const string defaultPoolId ;
68     static const string defaultServerId ;
69     static const string defaultGathererId ;
70
71
72     static CRegistryManager* registryManager_ ;
73     static CRessourcesManager* ressourcesManager_ ;
74     static CCouplerManager* couplerManager_ ;
75     static CServicesManager* servicesManager_ ;
76     static CContextsManager* contextsManager_ ;
77     static CDaemonsManager* daemonsManager_ ;
78     static CMpiGarbageCollector MpiGarbageCollector_  ;
79    public:
80     static CMpiGarbageCollector& getMpiGarbageCollector(void) { return MpiGarbageCollector_ ; }
81    public:
82     //! Setting xios to use server mode
83     static void setUsingServer();
84
85     //! Setting xios NOT to use server mode
86     static void setNotUsingServer();
87     
88     //! is using server mode
89     static bool isUsingServer() {return usingServer;}
90
91     //! Initialize server (if any)
92     static  void initServer();
93
94     static void launchServicesManager( bool isXiosServer) ;
95     static void launchContextsManager(bool isXiosServer) ;
96     static void launchDaemonsManager(bool isXiosServer) ;
97     static void launchRessourcesManager(bool isXiosServer) ;
98     static void launchCouplerManager(bool isXiosServer) ;
99     static void launchRegistryManager(bool isXiosServer) ;
100   
101     static void finalizeServicesManager() ;
102     static void finalizeContextsManager() ;
103     static void finalizeDaemonsManager() ;
104     static void finalizeRessourcesManager() ;
105     static void finalizeCouplerManager() ;
106     static void finalizeRegistryManager() ;
107
108     static CRegistryManager*   getRegistryManager(void) { return registryManager_ ;}
109     static CRessourcesManager* getRessourcesManager(void) { return ressourcesManager_ ;}
110     static CCouplerManager*    getCouplerManager(void) { return couplerManager_ ;}
111     static CServicesManager*   getServicesManager(void) { return servicesManager_ ;}
112     static CContextsManager*   getContextsManager(void) { return contextsManager_ ;}
113     static CDaemonsManager*    getDaemonsManager(void) { return daemonsManager_ ;}
114     static CPoolRessource*     getPoolRessource(void) ;
115     
116     static MPI_Comm getGlobalComm(void) { return globalComm ;}
117     static MPI_Comm getXiosComm(void) { return xiosComm ;}
118     static void setXiosComm(MPI_Comm comm) { xiosComm=comm ;}
119     static CRegistry* getGlobalRegistry(void) { return globalRegistry ;}
120     static void setGlobalRegistry(CRegistry* registry) { globalRegistry=registry ;}
121
122    private:
123      //! Parse only Xios part of configuration file
124      static void parseXiosConfig();
125  } ;
126}
127
128//#include "cxios_impl.hpp"
129#endif // __XIOS_HPP__
Note: See TracBrowser for help on using the repository browser.