source: XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/daemons_manager.cpp @ 2246

Last change on this file since 2246 was 2246, checked in by ymipsl, 3 years ago
  • Update of the tranfer protocol using one sided communication
  • Introduce MPI_Improb/MPI_mrecv to listen incomming request
  • Introducing latency when looping over managers

YM

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#include "daemons_manager.hpp"
2#include "cxios.hpp"
3#include "ressources_manager.hpp"
4#include "services_manager.hpp"
5#include "contexts_manager.hpp"
6#include "servers_ressource.hpp"
7#include "server.hpp"
8
9namespace xios
10{
11  using namespace std ;
12
13  CDaemonsManager::CDaemonsManager(bool isXiosServer) : isServer_(isXiosServer)
14  {
15    MPI_Comm xiosComm = CXios::getXiosComm() ;
16    int commRank ;
17    MPI_Comm_rank(xiosComm,&commRank) ;
18    MPI_Comm splitComm ;
19    MPI_Comm_split(xiosComm,isXiosServer,commRank,&splitComm) ;
20   
21    CXios::launchRegistryManager(isXiosServer) ;
22    CXios::launchRessourcesManager(isXiosServer) ;
23    CXios::launchServicesManager(isXiosServer) ;
24    CXios::launchContextsManager(isXiosServer) ;
25    CXios::launchCouplerManager(isXiosServer) ;
26 
27    if (isXiosServer) CServer::launchServersRessource(splitComm) ;
28    MPI_Barrier(xiosComm) ;
29    MPI_Comm_free(&splitComm) ;
30  }
31
32  CDaemonsManager::~CDaemonsManager()
33  {
34    CXios::finalizeContextsManager() ;
35    CXios::finalizeCouplerManager() ;
36    CXios::finalizeServicesManager() ;
37    CXios::finalizeRessourcesManager() ;
38    CXios::finalizeRegistryManager() ;
39  }
40
41  bool CDaemonsManager::eventLoop(void)
42  {
43   
44    CXios::getRessourcesManager()->eventLoop() ;
45    CXios::getServicesManager()->eventLoop() ;
46    CXios::getContextsManager()->eventLoop() ;
47    if (isServer_) return CServer::getServersRessource()->eventLoop(false) ;
48    else  return CXios::getPoolRessource()->eventLoop(false) ;
49  }
50 
51  bool CDaemonsManager::servicesEventLoop(void)
52  {
53    CXios::getRessourcesManager()->eventLoop() ;
54    CXios::getServicesManager()->eventLoop() ;
55    CXios::getContextsManager()->eventLoop() ;
56    if (isServer_) return CServer::getServersRessource()->eventLoop(true) ;
57    else  return CXios::getPoolRessource()->eventLoop(true) ;
58  } 
59
60}
Note: See TracBrowser for help on using the repository browser.