Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.cpp	(revision 1875)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.cpp	(revision 1878)
@@ -55,4 +55,5 @@
   CServicesManager*   CXios::servicesManager_=nullptr ;
   CContextsManager*   CXios::contextsManager_=nullptr ;
+  CCouplerManager*    CXios::couplerManager_=nullptr ;
 
   //! Parse configuration file and create some objects from it
@@ -221,4 +222,9 @@
   }
 
+  void CXios::launchCouplerManager(bool isXiosServer)
+  {
+    couplerManager_ = new CCouplerManager(isXiosServer) ;
+  }
+
   void CXios::launchServicesManager(bool isXiosServer)
   {
@@ -240,4 +246,9 @@
   {
     delete ressourcesManager_;
+  }
+
+  void CXios::finalizeCouplerManager()
+  {
+    delete couplerManager_;
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.hpp	(revision 1875)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.hpp	(revision 1878)
@@ -9,4 +9,5 @@
 #include "contexts_manager.hpp"
 #include "daemons_manager.hpp"
+#include "coupler_manager.hpp"
 
 namespace xios
@@ -68,4 +69,5 @@
 
      static CRessourcesManager* ressourcesManager_ ;
+     static CCouplerManager* couplerManager_ ;
      static CServicesManager* servicesManager_ ;
      static CContextsManager* contextsManager_ ;
@@ -90,11 +92,14 @@
      static void launchDaemonsManager(bool isXiosServer) ;
      static void launchRessourcesManager(bool isXiosServer) ;
-     
+     static void launchCouplerManager(bool isXiosServer) ;
+    
      static void finalizeServicesManager() ;
      static void finalizeContextsManager() ;
      static void finalizeDaemonsManager() ;
      static void finalizeRessourcesManager() ;
+     static void finalizeCouplerManager() ;
 
      static CRessourcesManager* getRessourcesManager(void) { return ressourcesManager_ ;}
+     static CCouplerManager*    getCouplerManager(void) { return couplerManager_ ;}
      static CServicesManager*   getServicesManager(void) { return servicesManager_ ;}
      static CContextsManager*   getContextsManager(void) { return contextsManager_ ;}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/coupler_manager.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/coupler_manager.cpp	(revision 1878)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/coupler_manager.cpp	(revision 1878)
@@ -0,0 +1,131 @@
+#include "coupler_manager.hpp"
+#include "cxios.hpp"
+#include <functional>
+#include <string>
+
+
+
+namespace xios
+{
+  CCouplerManager::CCouplerManager(bool isXiosServer)
+  {
+    auto xiosComm_ = CXios::getXiosComm()  ;
+    
+    int commRank ;  
+    MPI_Comm_rank(xiosComm_, &commRank) ;
+    if (commRank==0 && isXiosServer) MPI_Comm_rank(xiosComm_, &commRank) ; 
+    else commRank=0 ;
+    MPI_Allreduce(&commRank, &managerGlobalLeader_, 1, MPI_INT, MPI_SUM, xiosComm_) ;
+    MPI_Comm_rank(xiosComm_, &commRank) ;
+    
+    winRegistredCoupling_ = new CWindowManager(xiosComm_, maxBufferSize_) ;
+    winNextCoupling_ = new CWindowManager(xiosComm_, maxBufferSize_) ;
+    if (commRank==managerGlobalLeader_)
+    {
+      winRegistredCoupling_->lockWindow(managerGlobalLeader_,0) ;
+      winRegistredCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ;
+      winRegistredCoupling_->unlockWindow(managerGlobalLeader_,0) ;
+
+      winNextCoupling_->lockWindow(managerGlobalLeader_,0) ;
+      winNextCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ;
+      winNextCoupling_->unlockWindow(managerGlobalLeader_,0) ;
+    }
+
+    MPI_Barrier(xiosComm_)  ;    
+  }
+
+  CCouplerManager::~CCouplerManager()
+  {
+    delete winRegistredCoupling_ ;
+    delete winNextCoupling_ ;
+  }
+  
+  
+  void CCouplerManager::registerCoupling(string srcCoupling, string dstCoupling)
+  {
+    hash<string> strHash ;
+    size_t key = strHash(getStrCoupling(srcCoupling,dstCoupling)) ;
+    
+    winRegistredCoupling_->lockWindow(managerGlobalLeader_,0) ;
+    winRegistredCoupling_->updateFromWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpIn) ;
+    if (registredCoupling_.count(key)==1)
+    {
+      registredCoupling_.erase(key) ;
+      winRegistredCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ;
+      winNextCoupling_->lockWindow(managerGlobalLeader_,0) ;
+      winNextCoupling_->updateFromWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ;
+      nextCoupling_.push_back(pair<size_t,int>(key,2)) ;
+      winNextCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ;
+      winNextCoupling_->unlockWindow(managerGlobalLeader_,0) ;
+    }
+    else 
+    {
+      registredCoupling_.insert(key) ;
+      winRegistredCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::registredCouplingDumpOut) ;
+    }
+    winRegistredCoupling_->unlockWindow(managerGlobalLeader_,0) ;
+  }
+
+  bool CCouplerManager::isNextCoupling(string srcCoupling, string dstCoupling)
+  {
+    bool ret ;
+    hash<string> strHash ;
+    size_t key = strHash(getStrCoupling(srcCoupling,dstCoupling)) ;
+
+    winNextCoupling_->lockWindow(managerGlobalLeader_,0) ;
+    winNextCoupling_->updateFromWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpIn) ;
+    if (nextCoupling_.front().first==key)
+    {
+      ret=true ;
+      if (nextCoupling_.front().second==1) nextCoupling_.pop_front() ;
+      else nextCoupling_.front().second=1 ;
+      winNextCoupling_->updateToWindow(managerGlobalLeader_, this, &CCouplerManager::nextCouplingDumpOut) ;
+    }
+    else ret=false ;
+    winNextCoupling_->unlockWindow(managerGlobalLeader_,0) ;
+    return ret ;
+  }
+  void CCouplerManager::registredCouplingDumpOut(CBufferOut& buffer)
+  {
+    buffer.realloc(maxBufferSize_) ;
+    buffer<<(int)registredCoupling_.size();
+    
+    for(auto hash : registredCoupling_) buffer << hash ;
+  } 
+
+  void CCouplerManager::registredCouplingDumpIn(CBufferIn& buffer)
+  {
+    registredCoupling_.clear() ;
+    size_t hash ;
+    int nbHash ;
+    buffer>>nbHash ;
+    for(int i=0;i<nbHash;i++) 
+    {
+      buffer>>hash ;
+      registredCoupling_.insert(hash) ;
+    }
+  }
+
+  void CCouplerManager::nextCouplingDumpOut(CBufferOut& buffer)
+  {
+    buffer.realloc(maxBufferSize_) ;
+    buffer<<(int)nextCoupling_.size();
+    
+    for(auto hash : nextCoupling_) buffer << hash.first<<hash.second ;
+  } 
+
+  void CCouplerManager::nextCouplingDumpIn(CBufferIn& buffer)
+  {
+    nextCoupling_.clear() ;
+    size_t hash ;
+    int count ;
+    int nbHash ;
+    buffer>>nbHash ;
+    for(int i=0;i<nbHash;i++) 
+    {
+      buffer>>hash>>count ;
+      nextCoupling_.push_back(pair<size_t,int>(hash,count)) ;
+    }
+  }
+
+}
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/coupler_manager.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/coupler_manager.hpp	(revision 1878)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/coupler_manager.hpp	(revision 1878)
@@ -0,0 +1,52 @@
+#ifndef __COUPLER_MANAGER_HPP__
+#define __COUPLER_MANAGER_HPP__
+
+#include "xios_spl.hpp"
+#include "mpi.hpp"
+#include "buffer_in.hpp"
+#include "buffer_out.hpp"
+
+#include <string>
+#include <map>
+#include "window_manager.hpp"
+
+
+namespace xios
+{
+  // the rule of this manager is to schedule intercommunicator creation between two or more coupling context
+  
+  class CCouplerManager
+  {
+  
+  public:
+    CCouplerManager(bool isXiosServer);
+    ~CCouplerManager() ;    
+    void registerCoupling(std::string srcCoupling, std::string dstCoupling) ;
+    bool isNextCoupling(string srcCoupling, string dstCoupling) ;
+  private :
+    void registredCouplingDumpOut(CBufferOut& buffer) ;
+    void registredCouplingDumpIn(CBufferIn& buffer) ;
+    void nextCouplingDumpOut(CBufferOut& buffer);
+    void nextCouplingDumpIn(CBufferIn& buffer);
+    
+    const std::string getStrCoupling(std::string srcCoupling, std::string dstCoupling) { return std::string("__"+srcCoupling+"__to__"+dstCoupling+"__") ; }
+    /** windows containing a set of coupling (hash) registred by at least one context */
+    CWindowManager* winRegistredCoupling_ ; 
+ 
+    /** windows containing a list of coupling fully registred by two context. The first coupling of the list will be the next candidate for intercommunicator creation */
+    CWindowManager* winNextCoupling_ ;
+
+    /** size of the windows, ie around 1024 coupling context can be registred at the time */
+    const size_t maxBufferSize_=1024*8 ;
+
+    std::set<size_t> registredCoupling_ ;
+    std::list<pair<size_t,int>> nextCoupling_ ;
+    
+    /** the rank of the mpi proc where the data are kept in memory*/
+    int managerGlobalLeader_ ;
+  } ;
+
+
+}
+
+#endif
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/daemons_manager.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/daemons_manager.cpp	(revision 1875)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/daemons_manager.cpp	(revision 1878)
@@ -22,4 +22,6 @@
     CXios::launchServicesManager(isXiosServer) ;
     CXios::launchContextsManager(isXiosServer) ;
+    CXios::launchCouplerManager(isXiosServer) ;
+
     if (isXiosServer) CServer::launchServersRessource(splitComm) ;
     MPI_Comm_free(&splitComm) ;
@@ -29,4 +31,5 @@
   {
     CXios::finalizeContextsManager() ;
+    CXios::finalizeCouplerManager() ;
     CXios::finalizeServicesManager() ;
     CXios::finalizeRessourcesManager() ;
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp	(revision 1875)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp	(revision 1878)
@@ -2446,14 +2446,47 @@
    TRY
    {
-      // juste for test now, in future need an scheduler to avoid dead-lock
-      for(auto it=enabledCouplerOut.begin();it!=enabledCouplerOut.end();++it)
-      {
-        (*it)->createInterCommunicator() ;
-      }
-
-      for(auto it=enabledCouplerIn.begin();it!=enabledCouplerIn.end();++it)
-      {
-        (*it)->createInterCommunicator() ;
-      }
+      int rank=this->getIntraCommRank() ;
+      map<string,list<CCouplerOut*>> listCouplerOut ;  
+      map<string,list<CCouplerIn*>> listCouplerIn ;  
+
+      for(auto couplerOut : enabledCouplerOut) listCouplerOut[couplerOut->getCouplingContextId()].push_back(couplerOut) ;
+      for(auto couplerIn : enabledCouplerIn) listCouplerIn[couplerIn->getCouplingContextId()].push_back(couplerIn) ;
+
+      CCouplerManager* couplerManager = CXios::getCouplerManager() ;
+      if (rank==0)
+      {
+        for(auto couplerOut : listCouplerOut) couplerManager->registerCoupling(this->getContextId(),couplerOut.first) ;
+        for(auto couplerIn : listCouplerIn) couplerManager->registerCoupling(couplerIn.first,this->getContextId()) ;
+      }
+
+      do
+      {
+        for(auto couplerOut : listCouplerOut) 
+        {
+          bool isNextCoupling ;
+          if (rank==0) isNextCoupling = couplerManager->isNextCoupling(this->getContextId(),couplerOut.first) ;
+          MPI_Bcast(&isNextCoupling,1,MPI_C_BOOL, 0, getIntraComm()) ; 
+          if (isNextCoupling) 
+          {
+            addCouplingChanel(couplerOut.first, true) ;
+            listCouplerOut.erase(couplerOut.first) ;
+            break ;
+          }            
+        }
+        for(auto couplerIn : listCouplerIn) 
+        {
+          bool isNextCoupling ;
+          if (rank==0) isNextCoupling = couplerManager->isNextCoupling(couplerIn.first,this->getContextId());
+          MPI_Bcast(&isNextCoupling,1,MPI_C_BOOL, 0, getIntraComm()) ; 
+          if (isNextCoupling) 
+          {
+            addCouplingChanel(couplerIn.first, false) ;
+            listCouplerIn.erase(couplerIn.first) ;
+            break ;
+          }           
+        }
+
+      } while (!listCouplerOut.empty() || !listCouplerIn.empty()) ;
+
    }
    CATCH_DUMP_ATTR
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp	(revision 1875)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp	(revision 1878)
@@ -2862,5 +2862,5 @@
           {
             bounds_lat_1d.resize(nvertex, nbLatInd) ;
-            bounds_lon_1d = bounds_lonvalue ;
+            bounds_lat_1d = bounds_latvalue ;
           }
         }
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp	(revision 1875)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp	(revision 1878)
@@ -580,5 +580,5 @@
       // for coupling, it would be after the first freq_op, because for now we don't have
       // restart mecanism to send the value at ts=0. It mus be changed in future
-      lastDataReceivedFromServer = context->getCalendar()->getInitDate()+freq_op;
+      lastDataReceivedFromServer = context->getCalendar()->getInitDate();
       wasDataAlreadyReceivedFromServer = true;
     }
@@ -659,5 +659,5 @@
     do
     {
-      const CDate nextDataDue = wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + freq_op) : context->getCalendar()->getInitDate();
+      const CDate nextDataDue = (wasDataAlreadyReceivedFromServer ? (lastDataReceivedFromServer + freq_op) : context->getCalendar()->getInitDate()) + freq_offset;
       isDataLate = (nextDataDue <= currentDate);
 
