Index: XIOS/dev/branch_yushan/src/buffer_server.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/buffer_server.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/buffer_server.hpp	(revision 1053)
@@ -4,5 +4,5 @@
 #include "xios_spl.hpp"
 #include "buffer.hpp"
-#include "mpi.hpp"
+#include "mpi_std.hpp"
 #include "cxios.hpp"
 
Index: XIOS/dev/branch_yushan/src/client.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/client.cpp	(revision 1053)
@@ -31,6 +31,4 @@
       else is_MPI_Initialized=false ;
       
-      //return;
-
 // don't use OASIS
       if (!CXios::usingOasis)
Index: XIOS/dev/branch_yushan/src/client.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/client.hpp	(revision 1053)
@@ -16,5 +16,5 @@
         static void initialize(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm);
         static void finalize(void);
-        static void registerContext(const string& id, MPI_Comm contextComm);
+        static void registerContext(const string& id, ep_lib::MPI_Comm contextComm);
 
         static MPI_Comm intraComm;
Index: XIOS/dev/branch_yushan/src/client_client_dht_template.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/client_client_dht_template.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/client_client_dht_template.hpp	(revision 1053)
@@ -13,5 +13,5 @@
 #include "xios_spl.hpp"
 #include "array_new.hpp"
-#include "mpi.hpp"
+#include "mpi_std.hpp"
 #include "policy.hpp"
 #include <boost/unordered_map.hpp>
@@ -40,8 +40,8 @@
   public:
     CClientClientDHTTemplate(const Index2InfoTypeMap& indexInfoInitMap,
-                             const MPI_Comm& clientIntraComm);
+                             const ep_lib::MPI_Comm& clientIntraComm);
 
     CClientClientDHTTemplate(const Index2VectorInfoTypeMap& indexInfoInitMap,
-                             const MPI_Comm& clientIntraComm);
+                             const ep_lib::MPI_Comm& clientIntraComm);
 
     void computeIndexInfoMapping(const CArray<size_t,1>& indices);
@@ -55,5 +55,5 @@
 
   protected:
-    CClientClientDHTTemplate(const MPI_Comm& clientIntraComm);
+    CClientClientDHTTemplate(const ep_lib::MPI_Comm& clientIntraComm);
 
   protected:
@@ -62,9 +62,9 @@
     // Redistribute index and info among clients
     void computeDistributedIndex(const Index2InfoTypeMap& indexInfoInitMap,
-                                 const MPI_Comm& intraCommLevel,
+                                 const ep_lib::MPI_Comm& intraCommLevel,
                                  int level);
 
     void computeDistributedIndex(const Index2VectorInfoTypeMap& indexInfoInitMap,
-                                 const MPI_Comm& intraCommLevel,
+                                 const ep_lib::MPI_Comm& intraCommLevel,
                                  int level);
 
@@ -73,5 +73,5 @@
 
     void computeIndexInfoMappingLevel(const CArray<size_t,1>& indices,
-                                      const MPI_Comm& intraCommLevel,
+                                      const ep_lib::MPI_Comm& intraCommLevel,
                                       int level);
 
@@ -85,19 +85,19 @@
     // Send information to clients
     void sendInfoToClients(int clientDestRank, unsigned char* info, int infoSize,
-                           const MPI_Comm& clientIntraComm,
-                           std::vector<MPI_Request>& requestSendInfo);
+                           const ep_lib::MPI_Comm& clientIntraComm,
+                           std::vector<ep_lib::MPI_Request>& requestSendInfo);
 
     void recvInfoFromClients(int clientSrcRank, unsigned char* info, int infoSize,
-                            const MPI_Comm& clientIntraComm,
-                            std::vector<MPI_Request>& requestRecvInfo);
+                            const ep_lib::MPI_Comm& clientIntraComm,
+                            std::vector<ep_lib::MPI_Request>& requestRecvInfo);
 
     // Send global index to clients
     void sendIndexToClients(int clientDestRank, size_t* indices, size_t indiceSize,
-                            const MPI_Comm& clientIntraComm,
-                            std::vector<MPI_Request>& requestSendIndexGlobal);
+                            const ep_lib::MPI_Comm& clientIntraComm,
+                            std::vector<ep_lib::MPI_Request>& requestSendIndexGlobal);
 
     void recvIndexFromClients(int clientSrcRank, size_t* indices, size_t indiceSize,
-                             const MPI_Comm& clientIntraComm,
-                             std::vector<MPI_Request>& requestRecvIndex);
+                             const ep_lib::MPI_Comm& clientIntraComm,
+                             std::vector<ep_lib::MPI_Request>& requestRecvIndex);
 
     void sendRecvOnReturn(const std::vector<int>& sendNbRank, std::vector<int>& sendNbElements,
Index: XIOS/dev/branch_yushan/src/client_client_dht_template_impl.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/client_client_dht_template_impl.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/client_client_dht_template_impl.hpp	(revision 1053)
@@ -18,5 +18,5 @@
 {
 template<typename T, typename H>
-CClientClientDHTTemplate<T,H>::CClientClientDHTTemplate(const MPI_Comm& clientIntraComm)
+CClientClientDHTTemplate<T,H>::CClientClientDHTTemplate(const ep_lib::MPI_Comm& clientIntraComm)
   : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_(), nbClient_(0)
 {
@@ -38,5 +38,5 @@
 template<typename T, typename H>
 CClientClientDHTTemplate<T,H>::CClientClientDHTTemplate(const Index2InfoTypeMap& indexInfoMap,
-                                                        const MPI_Comm& clientIntraComm)
+                                                        const ep_lib::MPI_Comm& clientIntraComm)
   : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_(), nbClient_(0)
 {
@@ -68,5 +68,5 @@
 template<typename T, typename H>
 CClientClientDHTTemplate<T,H>::CClientClientDHTTemplate(const Index2VectorInfoTypeMap& indexInfoMap,
-                                                        const MPI_Comm& clientIntraComm)
+                                                        const ep_lib::MPI_Comm& clientIntraComm)
   : H(clientIntraComm), index2InfoMapping_(), indexToInfoMappingLevel_(), nbClient_(0)
 {
@@ -104,5 +104,5 @@
 template<typename T, typename H>
 void CClientClientDHTTemplate<T,H>::computeIndexInfoMappingLevel(const CArray<size_t,1>& indices,
-                                                                 const MPI_Comm& commLevel,
+                                                                 const ep_lib::MPI_Comm& commLevel,
                                                                  int level)
 {
@@ -178,5 +178,5 @@
     recvIndexBuff = new unsigned long[recvNbIndexCount];
 
-  std::vector<MPI_Request> request;
+  std::vector<ep_lib::MPI_Request> request;
   std::vector<int>::iterator itbRecvIndex = recvRankClient.begin(), itRecvIndex,
                              iteRecvIndex = recvRankClient.end(),
@@ -199,5 +199,5 @@
     sendIndexToClients(itIndex->first, (itIndex->second), sendNbIndexBuff[itIndex->first-groupRankBegin], commLevel, request);
 
-  std::vector<MPI_Status> status(request.size());
+  std::vector<ep_lib::MPI_Status> status(request.size());
 
   //printf("1(%d): calling wait all for %lu requests\n", clientRank, request.size());
@@ -259,5 +259,5 @@
   }
 
-  std::vector<MPI_Request> requestOnReturn;
+  std::vector<ep_lib::MPI_Request> requestOnReturn;
   currentIndex = 0;
   for (int idx = 0; idx < recvRankOnReturn.size(); ++idx)
@@ -310,5 +310,5 @@
   }
 
-  std::vector<MPI_Status> statusOnReturn(requestOnReturn.size());
+  std::vector<ep_lib::MPI_Status> statusOnReturn(requestOnReturn.size());
   //printf("2(%d): calling wait all for %lu requests\n", clientRank, requestOnReturn.size());
   MPI_Waitall(requestOnReturn.size(), &requestOnReturn[0], &statusOnReturn[0]);
@@ -380,5 +380,5 @@
 template<typename T, typename H>
 void CClientClientDHTTemplate<T,H>::computeDistributedIndex(const Index2VectorInfoTypeMap& indexInfoMap,
-                                                            const MPI_Comm& commLevel,
+                                                            const ep_lib::MPI_Comm& commLevel,
                                                             int level)
 {
@@ -465,5 +465,5 @@
   // it will send a message to the correct clients.
   // Contents of the message are index and its corresponding informatioin
-  std::vector<MPI_Request> request;
+  std::vector<ep_lib::MPI_Request> request;
   int currentIndex = 0;
   int nbRecvClient = recvRankClient.size();
@@ -504,5 +504,5 @@
 
   //printf("check 8 OK. clientRank = %d\n", clientRank);
-  std::vector<MPI_Status> status(request.size());
+  std::vector<ep_lib::MPI_Status> status(request.size());
 
   MPI_Waitall(request.size(), &request[0], &status[0]);
@@ -564,8 +564,8 @@
 template<typename T, typename H>
 void CClientClientDHTTemplate<T,H>::sendIndexToClients(int clientDestRank, size_t* indices, size_t indiceSize,
-                                                       const MPI_Comm& clientIntraComm,
-                                                       std::vector<MPI_Request>& requestSendIndex)
-{
-  MPI_Request request;
+                                                       const ep_lib::MPI_Comm& clientIntraComm,
+                                                       std::vector<ep_lib::MPI_Request>& requestSendIndex)
+{
+  ep_lib::MPI_Request request;
   requestSendIndex.push_back(request);
 
@@ -583,8 +583,8 @@
 template<typename T, typename H>
 void CClientClientDHTTemplate<T,H>::recvIndexFromClients(int clientSrcRank, size_t* indices, size_t indiceSize,
-                                                         const MPI_Comm& clientIntraComm,
-                                                         std::vector<MPI_Request>& requestRecvIndex)
-{
-  MPI_Request request;
+                                                         const ep_lib::MPI_Comm& clientIntraComm,
+                                                         std::vector<ep_lib::MPI_Request>& requestRecvIndex)
+{
+  ep_lib::MPI_Request request;
   requestRecvIndex.push_back(request);
 
@@ -603,8 +603,8 @@
 template<typename T, typename H>
 void CClientClientDHTTemplate<T,H>::sendInfoToClients(int clientDestRank, unsigned char* info, int infoSize,
-                                                      const MPI_Comm& clientIntraComm,
-                                                      std::vector<MPI_Request>& requestSendInfo)
-{
-  MPI_Request request;
+                                                      const ep_lib::MPI_Comm& clientIntraComm,
+                                                      std::vector<ep_lib::MPI_Request>& requestSendInfo)
+{
+  ep_lib::MPI_Request request;
   requestSendInfo.push_back(request);
   //printf("MPI_IsendInfo(info, infoSize, MPI_CHAR,... char count = %d, dest = %d, buf_size = %d\n", infoSize, clientDestRank, sizeof(*info) );
@@ -623,8 +623,8 @@
 template<typename T, typename H>
 void CClientClientDHTTemplate<T,H>::recvInfoFromClients(int clientSrcRank, unsigned char* info, int infoSize,
-                                                        const MPI_Comm& clientIntraComm,
-                                                        std::vector<MPI_Request>& requestRecvInfo)
-{
-  MPI_Request request;
+                                                        const ep_lib::MPI_Comm& clientIntraComm,
+                                                        std::vector<ep_lib::MPI_Request>& requestRecvInfo)
+{
+  ep_lib::MPI_Request request;
   requestRecvInfo.push_back(request);
 
@@ -699,6 +699,6 @@
 {
   recvNbElements.resize(recvNbRank.size());
-  std::vector<MPI_Request> request(sendNbRank.size()+recvNbRank.size());
-  std::vector<MPI_Status> requestStatus(sendNbRank.size()+recvNbRank.size());
+  std::vector<ep_lib::MPI_Request> request(sendNbRank.size()+recvNbRank.size());
+  std::vector<ep_lib::MPI_Status> requestStatus(sendNbRank.size()+recvNbRank.size());
 
   int nRequest = 0;
@@ -751,6 +751,6 @@
   std::vector<int> recvBuff(recvBuffSize*2,0);
 
-  std::vector<MPI_Request> request(sendBuffSize+recvBuffSize);
-  std::vector<MPI_Status> requestStatus(sendBuffSize+recvBuffSize);
+  std::vector<ep_lib::MPI_Request> request(sendBuffSize+recvBuffSize);
+  std::vector<ep_lib::MPI_Status> requestStatus(sendBuffSize+recvBuffSize);
 
   int nRequest = 0;
Index: XIOS/dev/branch_yushan/src/client_server_mapping.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/client_server_mapping.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/client_server_mapping.hpp	(revision 1053)
@@ -41,5 +41,5 @@
 
     static std::map<int,int> computeConnectedClients(int nbServer, int nbClient,
-                                                     MPI_Comm& clientIntraComm,
+                                                     ep_lib::MPI_Comm& clientIntraComm,
                                                      const std::vector<int>& connectedServerRank);
 
Index: XIOS/dev/branch_yushan/src/client_server_mapping_distributed.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/client_server_mapping_distributed.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/client_server_mapping_distributed.hpp	(revision 1053)
@@ -35,5 +35,5 @@
     /** Default constructor */
     CClientServerMappingDistributed(const boost::unordered_map<size_t,int>& globalIndexOfServer,
-                                    const MPI_Comm& clientIntraComm,
+                                    const ep_lib::MPI_Comm& clientIntraComm,
                                     bool isDataDistributed = true);
 
Index: XIOS/dev/branch_yushan/src/context_client.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/context_client.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/context_client.cpp	(revision 1053)
@@ -20,5 +20,5 @@
     \cxtSer [in] cxtSer Pointer to context of server side. (It is only used on case of attached mode)
     */
-    CContextClient::CContextClient(CContext* parent, MPI_Comm intraComm_, MPI_Comm interComm_, CContext* cxtSer)
+    CContextClient::CContextClient(CContext* parent, ep_lib::MPI_Comm intraComm_, ep_lib::MPI_Comm interComm_, CContext* cxtSer)
      : mapBufferSize_(), parentServer(cxtSer), maxBufferedEvents(4)
     {
@@ -163,5 +163,10 @@
       for (itBuffer = bufferList.begin(), itSize = sizeList.begin(); itBuffer != bufferList.end(); itBuffer++, itSize++)
       {
-        retBuffer.push_back((*itBuffer)->getBuffer(*itSize));
+        CBufferOut* m_buf = (*itBuffer)->getBuffer(*itSize);
+        //retBuffer.push_back((*itBuffer)->getBuffer(*itSize));
+        //int m_size = retBuffer.size();
+        //retBuffer.resize(m_size+1);
+        //m_size = retBuffer.size();
+        retBuffer.push_back(m_buf);
       }
       return retBuffer;
Index: XIOS/dev/branch_yushan/src/context_client.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/context_client.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/context_client.hpp	(revision 1053)
@@ -31,5 +31,5 @@
     public:
       // Contructor
-      CContextClient(CContext* parent, MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0);
+      CContextClient(CContext* parent, ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* parentServer = 0);
 
       // Send event to server
@@ -66,7 +66,7 @@
       int serverSize; //!< Size of server group
 
-      MPI_Comm interComm; //!< Communicator of server group
+      ep_lib::MPI_Comm interComm; //!< Communicator of server group
 
-      MPI_Comm intraComm; //!< Communicator of client group
+      ep_lib::MPI_Comm intraComm; //!< Communicator of client group
 
       map<int,CClientBuffer*> buffers; //!< Buffers for connection to servers
Index: XIOS/dev/branch_yushan/src/context_server.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/context_server.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/context_server.cpp	(revision 1053)
@@ -10,5 +10,5 @@
 #include "file.hpp"
 #include "grid.hpp"
-#include "mpi.hpp"
+#include "mpi_std.hpp"
 #include "tracer.hpp"
 #include "timer.hpp"
@@ -23,5 +23,5 @@
 {
 
-  CContextServer::CContextServer(CContext* parent,MPI_Comm intraComm_,MPI_Comm interComm_)
+  CContextServer::CContextServer(CContext* parent, ep_lib::MPI_Comm intraComm_, ep_lib::MPI_Comm interComm_)
   {
     context=parent;
@@ -71,5 +71,5 @@
     int count;
     char * addr;
-    MPI_Status status;
+    ep_lib::MPI_Status status;
     map<int,CServerBuffer*>::iterator it;
 
@@ -101,5 +101,5 @@
             {
               addr=(char*)it->second->getBuffer(count);
-              MPI_Irecv(addr,count,MPI_CHAR,rank,20,interComm,&pendingRequest[rank]);
+              ep_lib::MPI_Irecv(addr,count,MPI_CHAR,rank,20,interComm,&pendingRequest[rank]);
               bufferRequest[rank]=addr;
               //printf("find message, i-receiving to buffer %p, rank = %d, commSize = %d\n", addr, rank, commSize);
@@ -113,5 +113,5 @@
   void CContextServer::checkPendingRequest(void)
   {
-    map<int,MPI_Request>::iterator it;
+    map<int,ep_lib::MPI_Request>::iterator it;
     list<int> recvRequest;
     list<int>::iterator itRecv;
@@ -119,5 +119,5 @@
     int flag;
     int count;
-    MPI_Status status;
+    ep_lib::MPI_Status status;
 
     //printf("enter checkPendingRequest\n");
Index: XIOS/dev/branch_yushan/src/context_server.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/context_server.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/context_server.hpp	(revision 1053)
@@ -14,5 +14,5 @@
     public:
 
-    CContextServer(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ;
+    CContextServer(CContext* parent, ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm) ;
     bool eventLoop(void) ;
     void listen(void) ;
@@ -25,13 +25,13 @@
     bool hasFinished(void);
 
-    MPI_Comm intraComm ;
+    ep_lib::MPI_Comm intraComm ;
     int intraCommSize ;
     int intraCommRank ;
 
-    MPI_Comm interComm ;
+    ep_lib::MPI_Comm interComm ;
     int commSize ;
 
     map<int,CServerBuffer*> buffers ;
-    map<int,MPI_Request> pendingRequest ;
+    map<int,ep_lib::MPI_Request> pendingRequest ;
     map<int,char*> bufferRequest ;
 
Index: XIOS/dev/branch_yushan/src/cxios.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/cxios.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/cxios.cpp	(revision 1053)
@@ -79,5 +79,5 @@
     MPI_Info info;
     MPI_Comm *ep_comm;
-    MPI_Comm_create_endpoints(MPI_COMM_WORLD, num_ep, info, ep_comm); 
+    MPI_Comm_create_endpoints(MPI_COMM_WORLD, num_ep, info, ep_comm);  // servers should reach here too.
       
     globalComm = ep_comm[0];
Index: XIOS/dev/branch_yushan/src/cxios.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/cxios.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/cxios.hpp	(revision 1053)
@@ -19,5 +19,5 @@
     public:
      static void initialize(void) ;
-     static void initClientSide(const string & codeId, MPI_Comm& localComm, MPI_Comm& returnComm) ;
+     static void initClientSide(const string & codeId, ep_lib::MPI_Comm& localComm, ep_lib::MPI_Comm& returnComm) ;
      static void initServerSide(void) ;
      static void clientFinalize(void) ;
Index: XIOS/dev/branch_yushan/src/dht_auto_indexing.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/dht_auto_indexing.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/dht_auto_indexing.cpp	(revision 1053)
@@ -22,5 +22,5 @@
 
   CDHTAutoIndexing::CDHTAutoIndexing(const CArray<size_t,1>& hashValue,
-                                     const MPI_Comm& clientIntraComm)
+                                     const ep_lib::MPI_Comm& clientIntraComm)
     : CClientClientDHTTemplate<size_t>(clientIntraComm)
   {
@@ -58,5 +58,5 @@
   */
   CDHTAutoIndexing::CDHTAutoIndexing(Index2VectorInfoTypeMap& hashInitMap,
-                                     const MPI_Comm& clientIntraComm)
+                                     const ep_lib::MPI_Comm& clientIntraComm)
     : CClientClientDHTTemplate<size_t>(clientIntraComm)
   {
Index: XIOS/dev/branch_yushan/src/dht_auto_indexing.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/dht_auto_indexing.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/dht_auto_indexing.hpp	(revision 1053)
@@ -28,8 +28,8 @@
 
     CDHTAutoIndexing(const CArray<size_t,1>& hashValue,
-                     const MPI_Comm& clientIntraComm);
+                     const ep_lib::MPI_Comm& clientIntraComm);
 
     CDHTAutoIndexing(Index2VectorInfoTypeMap& hashInitMap,
-                     const MPI_Comm& clientIntraComm);
+                     const ep_lib::MPI_Comm& clientIntraComm);
 
     size_t getNbIndexesGlobal() const;
Index: XIOS/dev/branch_yushan/src/filter/filter.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/filter/filter.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/filter/filter.cpp	(revision 1053)
@@ -14,5 +14,9 @@
     CDataPacketPtr outputPacket = engine->apply(data);
     if (outputPacket)
+    {
+      printf("filter/filter.cpp : deliverOuput(outputPacket)\n");
       deliverOuput(outputPacket);
+      printf("filter/filter.cpp : deliverOuput(outputPacket) OKOK\n");
+    }
   }
 } // namespace xios
Index: XIOS/dev/branch_yushan/src/filter/input_pin.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/filter/input_pin.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/filter/input_pin.cpp	(revision 1053)
@@ -33,5 +33,7 @@
       // Unregister before calling onInputReady in case the filter registers again
       gc.unregisterFilter(this, packet->timestamp);
+      printf("filter/input_pin.cpp : onInputReady\n");
       onInputReady(it->second.packets);
+      printf("filter/input_pin.cpp : onInputReady OKOK\n");
       inputs.erase(it);
     }
Index: XIOS/dev/branch_yushan/src/filter/output_pin.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/filter/output_pin.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/filter/output_pin.cpp	(revision 1053)
@@ -22,5 +22,7 @@
     for (it = outputs.begin(), itEnd = outputs.end(); it != itEnd; ++it)
     {
+      printf("filter/output_pin.cpp : setInput\n");
       it->first->setInput(it->second, packet);
+      printf("filter/output_pin.cpp : setInput OKOK\n");
     }
   }
Index: XIOS/dev/branch_yushan/src/filter/source_filter.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/filter/source_filter.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/filter/source_filter.cpp	(revision 1053)
@@ -29,5 +29,7 @@
     grid->inputField(data, packet->data);
 
+    printf("filter/source_filter.cpp : deliverOuput(packet) \n");
     deliverOuput(packet);
+    printf("filter/source_filter.cpp : deliverOuput(packet) OKOK\n");
   }
 
Index: XIOS/dev/branch_yushan/src/filter/spatial_transform_filter.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/filter/spatial_transform_filter.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/filter/spatial_transform_filter.cpp	(revision 1053)
@@ -150,5 +150,5 @@
 
       idxSendBuff = 0;
-      std::vector<MPI_Request> sendRecvRequest;
+      std::vector<ep_lib::MPI_Request> sendRecvRequest;
       for (itSend = itbSend; itSend != iteSend; ++itSend, ++idxSendBuff)
       {
@@ -160,5 +160,5 @@
           sendBuff[idxSendBuff][idx] = dataCurrentSrc(localIndex_p(idx));
         }
-        sendRecvRequest.push_back(MPI_Request());
+        sendRecvRequest.push_back(ep_lib::MPI_Request());
         MPI_Isend(sendBuff[idxSendBuff], countSize, MPI_DOUBLE, destRank, 12, client->intraComm, &sendRecvRequest.back());
       }
@@ -178,9 +178,9 @@
         int srcRank = itRecv->first;
         int countSize = itRecv->second.size();
-        sendRecvRequest.push_back(MPI_Request());
+        sendRecvRequest.push_back(ep_lib::MPI_Request());
         MPI_Irecv(recvBuff + currentBuff, countSize, MPI_DOUBLE, srcRank, 12, client->intraComm, &sendRecvRequest.back());
         currentBuff += countSize;
       }
-      std::vector<MPI_Status> status(sendRecvRequest.size());
+      std::vector<ep_lib::MPI_Status> status(sendRecvRequest.size());
       MPI_Waitall(sendRecvRequest.size(), &sendRecvRequest[0], &status[0]);
 
Index: XIOS/dev/branch_yushan/src/interface/c/icdata.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/interface/c/icdata.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/interface/c/icdata.cpp	(revision 1053)
@@ -23,5 +23,5 @@
 #include "context.hpp"
 #include "context_client.hpp"
-#include "mpi.hpp"
+#include "mpi_std.hpp"
 #include "timer.hpp"
 #include "array_new.hpp"
@@ -54,8 +54,8 @@
    {
       std::string str;
-      MPI_Comm local_comm;
-      MPI_Comm return_comm;
+      ep_lib::MPI_Comm local_comm;
+      ep_lib::MPI_Comm return_comm;
       
-      fc_comm_map.clear();
+      ep_lib::fc_comm_map.clear();
 
       if (!cstr2string(client_id, len_client_id, str)) return;
@@ -63,5 +63,6 @@
       int initialized;
       MPI_Initialized(&initialized);
-      if (initialized) local_comm=MPI_Comm_f2c(*f_local_comm);
+      //if (initialized) local_comm.mpi_comm = MPI_Comm_f2c(*f_local_comm);
+      if (initialized) local_comm = ep_lib::EP_Comm_f2c(static_cast< int >(*f_local_comm));
       else local_comm = MPI_COMM_NULL;
       
@@ -69,5 +70,6 @@
 
       CXios::initClientSide(str, local_comm, return_comm);
-      *f_return_comm = MPI_Comm_c2f(return_comm);
+
+      *f_return_comm = ep_lib::EP_Comm_c2f(return_comm);
 
       printf("in icdata.cpp, f_return_comm = %d\n", *f_return_comm);
@@ -80,14 +82,14 @@
    {
      std::string str;
-     MPI_Comm comm;
+     ep_lib::MPI_Comm comm;
 
      if (!cstr2string(context_id, len_context_id, str)) return;
      CTimer::get("XIOS").resume();
      CTimer::get("XIOS init context").resume();
-     comm=MPI_Comm_f2c(*f_comm);
+     comm = ep_lib::EP_Comm_f2c(static_cast< int >(*f_comm));
     
      CClient::registerContext(str, comm);
      
-     //printf("client register context OK\n");
+     printf("icdata.cpp: client register context OK\n");
      
      CTimer::get("XIOS init context").suspend();
Index: XIOS/dev/branch_yushan/src/interface/c/oasis_cinterface.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/interface/c/oasis_cinterface.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/interface/c/oasis_cinterface.cpp	(revision 1053)
@@ -26,5 +26,5 @@
     
     fxios_oasis_get_localcomm(&f_comm) ;
-    comm=MPI_Comm_f2c(f_comm) ;
+    //comm=MPI_Comm_f2c(f_comm) ;
   }
  
@@ -34,5 +34,5 @@
     
     fxios_oasis_get_intracomm(&f_comm,server_id.data(),server_id.size()) ;
-    comm_client_server=MPI_Comm_f2c(f_comm) ;
+    //comm_client_server=MPI_Comm_f2c(f_comm) ;
   }
  
@@ -42,5 +42,5 @@
     
     fxios_oasis_get_intercomm(&f_comm,server_id.data(),server_id.size()) ;
-    comm_client_server=MPI_Comm_f2c(f_comm) ;
+    //comm_client_server=MPI_Comm_f2c(f_comm) ;
   }
 }
Index: XIOS/dev/branch_yushan/src/interface/fortran/idata.F90
===================================================================
--- XIOS/dev/branch_yushan/src/interface/fortran/idata.F90	(revision 1037)
+++ XIOS/dev/branch_yushan/src/interface/fortran/idata.F90	(revision 1053)
@@ -476,4 +476,5 @@
       
       !print*, "in fortran, world_f = ", MPI_COMM_WORLD 
+
       print*, "in fortran, f_return_comm = ", f_return_comm 
 
Index: XIOS/dev/branch_yushan/src/io/inetcdf4.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/inetcdf4.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/io/inetcdf4.cpp	(revision 1053)
@@ -18,9 +18,10 @@
     }
     mpi = comm && !multifile;
+    MPI_Info m_info;
 
     // The file format will be detected automatically by NetCDF, it is safe to always set NC_MPIIO
     // even if Parallel NetCDF ends up being used.
     if (mpi)
-      CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, *comm, MPI_INFO_NULL, this->ncidp);
+      CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, *comm, m_info, this->ncidp);
     else
       CNetCdfInterface::open(filename, NC_NOWRITE, this->ncidp);
Index: XIOS/dev/branch_yushan/src/io/inetcdf4.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/inetcdf4.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/io/inetcdf4.hpp	(revision 1053)
@@ -7,5 +7,5 @@
 #include "array_new.hpp"
 
-#include "mpi.hpp"
+#include "mpi_std.hpp"
 #include "netcdf.hpp"
 
Index: XIOS/dev/branch_yushan/src/io/nc4_data_output.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/nc4_data_output.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/io/nc4_data_output.cpp	(revision 1053)
@@ -26,5 +26,5 @@
       CNc4DataOutput::CNc4DataOutput
          (const StdString & filename, bool exist, bool useClassicFormat, bool useCFConvention,
-          MPI_Comm comm_file, bool multifile, bool isCollective, const StdString& timeCounterName)
+          ep_lib::MPI_Comm comm_file, bool multifile, bool isCollective, const StdString& timeCounterName)
             : SuperClass()
             , SuperClassWriter(filename, exist, useClassicFormat, useCFConvention, &comm_file, multifile, timeCounterName)
@@ -450,5 +450,5 @@
       StdString domainName = domain->name;
       domain->assignMesh(domainName, domain->nvertex);
-      domain->mesh->createMeshEpsilon(server->intraComm, domain->lonvalue_srv, domain->latvalue_srv, domain->bounds_lon_srv, domain->bounds_lat_srv);
+      domain->mesh->createMeshEpsilon(static_cast<MPI_Comm>(server->intraComm.mpi_comm), domain->lonvalue_srv, domain->latvalue_srv, domain->bounds_lon_srv, domain->bounds_lat_srv);
 
       StdString node_x = domainName + "_node_x";
Index: XIOS/dev/branch_yushan/src/io/nc4_data_output.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/nc4_data_output.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/io/nc4_data_output.hpp	(revision 1053)
@@ -27,5 +27,5 @@
                (const StdString & filename, bool exist, bool useClassicFormat,
                 bool useCFConvention,
-                MPI_Comm comm_file, bool multifile, bool isCollective = true,
+                ep_lib::MPI_Comm comm_file, bool multifile, bool isCollective = true,
                 const StdString& timeCounterName = "time_counter");
 
@@ -116,5 +116,5 @@
 
             /// PropriÃ©tÃ©s privÃ©es ///
-            MPI_Comm comm_file;
+            ep_lib::MPI_Comm comm_file;
             const StdString filename;
             std::map<Time, StdSize> timeToRecordCache;
Index: XIOS/dev/branch_yushan/src/io/netCdfInterface.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/netCdfInterface.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/io/netCdfInterface.hpp	(revision 1053)
@@ -16,6 +16,5 @@
 #endif
 
-#include "mpi.hpp"
-//#include <mpi.h>
+#include "mpi_std.hpp"
 #include "netcdf.hpp"
 
Index: XIOS/dev/branch_yushan/src/io/netcdf.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/netcdf.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/io/netcdf.hpp	(revision 1053)
@@ -1,5 +1,5 @@
 #ifndef __XIOS_NETCDF_HPP__
 #define __XIOS_NETCDF_HPP__
-#include "mpi.hpp"
+#include "mpi_std.hpp"
 #define MPI_INCLUDED
 #include <netcdf.h>
@@ -18,5 +18,5 @@
 extern "C"
 {
-#  include <netcdf_par.h>
+  #include <netcdf_par.h>
 }
 #  endif
@@ -30,8 +30,8 @@
 namespace xios
 {
-  inline int nc_create_par(const char *path, int cmode, MPI_Comm comm, MPI_Info info,int *ncidp)
+  inline int nc_create_par(const char *path, int cmode, ep_lib::MPI_Comm comm, MPI_Info info,int *ncidp)
   {
 #if defined(USING_NETCDF_PAR)
-    return ::nc_create_par(path, cmode, comm, info, ncidp) ;
+    return ::nc_create_par(path, cmode, static_cast<MPI_Comm>(comm.mpi_comm), info, ncidp) ;
 #else
     ERROR("int nc_create_par(const char *path, int cmode, MPI_Comm comm, MPI_Info info,int *ncidp)",
@@ -41,8 +41,8 @@
   }
 
-  inline int nc_open_par(const char *path, int mode, MPI_Comm comm, MPI_Info info,int *ncidp)
+  inline int nc_open_par(const char *path, int mode, ep_lib::MPI_Comm comm, MPI_Info info,int *ncidp)
   {
 #if defined(USING_NETCDF_PAR)
-    return ::nc_open_par(path, mode, comm, info, ncidp) ;
+    return ::nc_open_par(path, mode, static_cast<MPI_Comm>(comm.mpi_comm), info, ncidp) ;
 #else
     ERROR("int nc_open_par(const char *path, int mode, MPI_Comm comm, MPI_Info info,int *ncidp)",
Index: XIOS/dev/branch_yushan/src/io/onetcdf4.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/onetcdf4.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/io/onetcdf4.cpp	(revision 1053)
@@ -3,5 +3,4 @@
 #include "onetcdf4.hpp"
 #include "group_template.hpp"
-//#include "mpi_std.hpp"
 #include "netcdf.hpp"
 #include "netCdfInterface.hpp"
@@ -12,7 +11,6 @@
       /// ////////////////////// DÃ©finitions ////////////////////// ///
 
-      CONetCDF4::CONetCDF4(const StdString& filename, bool append, bool useClassicFormat,
-							bool useCFConvention,
-                           const MPI_Comm* comm, bool multifile, const StdString& timeCounterName)
+      CONetCDF4::CONetCDF4(const StdString& filename, bool append, bool useClassicFormat, bool useCFConvention, 
+                           const ep_lib::MPI_Comm* comm, bool multifile, const StdString& timeCounterName)
         : path()
         , wmpi(false)
@@ -32,5 +30,5 @@
 
       void CONetCDF4::initialize(const StdString& filename, bool append, bool useClassicFormat, bool useCFConvention, 
-                                 const MPI_Comm* comm, bool multifile, const StdString& timeCounterName)
+                                 const ep_lib::MPI_Comm* comm, bool multifile, const StdString& timeCounterName)
       {
          this->useClassicFormat = useClassicFormat;
@@ -58,7 +56,14 @@
          {
             if (wmpi)
-               CNetCdfInterface::createPar(filename, mode, *comm, info_null, this->ncidp);
+            {
+               CNetCdfInterface::createPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), info_null, this->ncidp);
+               printf("creating file with createPar\n");
+            }
             else
+            {
                CNetCdfInterface::create(filename, mode, this->ncidp);
+               printf("creating file with create\n");  
+            }  
+               
 
             this->appendMode = false;
@@ -68,7 +73,13 @@
             mode |= NC_WRITE;
             if (wmpi)
-               CNetCdfInterface::openPar(filename, mode, *comm, info_null, this->ncidp);
+            {
+               CNetCdfInterface::openPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), info_null, this->ncidp);
+               printf("opening file with openPar\n");
+            }
             else
+            {
                CNetCdfInterface::open(filename, mode, this->ncidp);
+               printf("opening file with open\n");
+            }
 
             this->appendMode = true;
Index: XIOS/dev/branch_yushan/src/io/onetcdf4.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/onetcdf4.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/io/onetcdf4.hpp	(revision 1053)
@@ -7,6 +7,5 @@
 #include "data_output.hpp"
 #include "array_new.hpp"
-#include "mpi.hpp"
-//#include <mpi.h>
+#include "mpi_std.hpp"
 #include "netcdf.hpp"
 
@@ -29,5 +28,5 @@
             CONetCDF4(const StdString& filename, bool append, bool useClassicFormat = false,
             		  bool useCFConvention = true,
-                      const MPI_Comm* comm = NULL, bool multifile = true,
+                      const ep_lib::MPI_Comm* comm = NULL, bool multifile = true,
                       const StdString& timeCounterName = "time_counter");
 
@@ -38,5 +37,5 @@
             /// Initialisation ///
             void initialize(const StdString& filename, bool append, bool useClassicFormat, bool useCFConvention,
-                            const MPI_Comm* comm, bool multifile, const StdString& timeCounterName);
+                            const ep_lib::MPI_Comm* comm, bool multifile, const StdString& timeCounterName);
             void close(void);
             void sync(void);
Index: XIOS/dev/branch_yushan/src/mpi.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/mpi.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/mpi.hpp	(revision 1053)
@@ -12,5 +12,5 @@
 
 #ifdef _usingEP
-  #include "../extern/src_ep/ep_lib.hpp"
+  #include "../extern/src_ep_dev/ep_lib.hpp"
   using namespace ep_lib;
 #elif _usingMPI
Index: XIOS/dev/branch_yushan/src/node/axis.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/axis.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/node/axis.cpp	(revision 1053)
@@ -742,6 +742,6 @@
       CContextServer* server = CContext::getCurrent()->server;
       axis->numberWrittenIndexes_ = axis->indexesToWrite.size();
-      MPI_Allreduce(&axis->numberWrittenIndexes_, &axis->totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
-      MPI_Scan(&axis->numberWrittenIndexes_, &axis->offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+      ep_lib::MPI_Allreduce(&axis->numberWrittenIndexes_, &axis->totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+      ep_lib::MPI_Scan(&axis->numberWrittenIndexes_, &axis->offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
       axis->offsetWrittenIndexes_ -= axis->numberWrittenIndexes_;
     }
Index: XIOS/dev/branch_yushan/src/node/context.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/context.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/node/context.cpp	(revision 1053)
@@ -236,5 +236,5 @@
 
    //! Initialize client side
-   void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer /*= 0*/)
+   void CContext::initClient(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtServer /*= 0*/)
    {
      hasClient=true;
@@ -248,5 +248,5 @@
      registryOut->setPath(getId()) ;
 
-     MPI_Comm intraCommServer, interCommServer;
+     ep_lib::MPI_Comm intraCommServer, interCommServer;
      if (cxtServer) // Attached mode
      {
@@ -311,5 +311,5 @@
 
    //! Initialize server
-   void CContext::initServer(MPI_Comm intraComm,MPI_Comm interComm, CContext* cxtClient /*= 0*/)
+   void CContext::initServer(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtClient /*= 0*/)
    {
      hasServer=true;
@@ -323,5 +323,5 @@
      registryOut->setPath(getId()) ;
 
-     MPI_Comm intraCommClient, interCommClient;
+     ep_lib::MPI_Comm intraCommClient, interCommClient;
      if (cxtClient) // Attached mode
      {
@@ -369,8 +369,9 @@
           closeAllFile();
           registryOut->hierarchicalGatherRegistry() ;
+          //registryOut->gatherRegistry() ;
           if (server->intraCommRank==0) CXios::globalRegistry->mergeRegistry(*registryOut) ;
         }
 
-        for (std::list<MPI_Comm>::iterator it = comms.begin(); it != comms.end(); ++it)
+        for (std::list<ep_lib::MPI_Comm>::iterator it = comms.begin(); it != comms.end(); ++it)
           MPI_Comm_free(&(*it));
         comms.clear();
Index: XIOS/dev/branch_yushan/src/node/context.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/context.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/node/context.hpp	(revision 1053)
@@ -88,6 +88,6 @@
       public :
          // Initialize server or client
-         void initServer(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtClient = 0);
-         void initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer = 0);
+         void initServer(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtClient = 0);
+         void initClient(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtServer = 0);
          bool isInitialized(void);
 
@@ -229,5 +229,5 @@
          StdString idServer_;
          CGarbageCollector garbageCollector;
-         std::list<MPI_Comm> comms; //!< Communicators allocated internally
+         std::list<ep_lib::MPI_Comm> comms; //!< Communicators allocated internally
 
       public: // Some function maybe removed in the near future
Index: XIOS/dev/branch_yushan/src/node/domain.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/domain.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/node/domain.cpp	(revision 1053)
@@ -475,5 +475,5 @@
    {
 	  CContext* context = CContext::getCurrent();
-      CContextClient* client = context->client;
+    CContextClient* client = context->client;
 	  lon_g.resize(ni_glo) ;
 	  lat_g.resize(nj_glo) ;
Index: XIOS/dev/branch_yushan/src/node/field_impl.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/field_impl.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/node/field_impl.hpp	(revision 1053)
@@ -20,9 +20,13 @@
     if (clientSourceFilter)
     {
+      printf("file_impl.hpp : clientSourceFilter->streamData\n");
       clientSourceFilter->streamData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data);
+      printf("file_impl.hpp : clientSourceFilter->streamData OKOK\n");
     }
     else if (!field_ref.isEmpty() || !content.empty())
+    {
       ERROR("void CField::setData(const CArray<double, N>& _data)",
             << "Impossible to receive data from the model for a field [ id = " << getId() << " ] with a reference or an arithmetic operation.");
+    }
   }
 
Index: XIOS/dev/branch_yushan/src/node/file.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/file.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/node/file.cpp	(revision 1053)
@@ -564,6 +564,6 @@
 
       if (isOpen) data_out->closeFile();
-      if (time_counter_name.isEmpty()) data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective));
-      else data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective, time_counter_name));
+      if (time_counter_name.isEmpty()) data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), static_cast<MPI_Comm>(fileComm.mpi_comm), multifile, isCollective));
+      else data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), static_cast<MPI_Comm>(fileComm.mpi_comm), multifile, isCollective, time_counter_name));
       isOpen = true;
     }
Index: XIOS/dev/branch_yushan/src/node/file.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/file.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/node/file.hpp	(revision 1053)
@@ -159,5 +159,5 @@
          bool isOpen;
          bool allDomainEmpty;
-         MPI_Comm fileComm;
+         ep_lib::MPI_Comm fileComm;
 
       private :
Index: XIOS/dev/branch_yushan/src/node/mesh.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/mesh.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/node/mesh.cpp	(revision 1053)
@@ -493,5 +493,5 @@
  * \param [in] bounds_lat Array of boundary latitudes. Its size depends on the element type.
  */
-  void CMesh::createMeshEpsilon(const MPI_Comm& comm,
+  void CMesh::createMeshEpsilon(const ep_lib::MPI_Comm& comm,
                                 const CArray<double, 1>& lonvalue, const CArray<double, 1>& latvalue,
                                 const CArray<double, 2>& bounds_lon, const CArray<double, 2>& bounds_lat)
@@ -1534,5 +1534,5 @@
    */
 
-  void CMesh::getGloNghbFacesNodeType(const MPI_Comm& comm, const CArray<int, 1>& face_idx,
+  void CMesh::getGloNghbFacesNodeType(const ep_lib::MPI_Comm& comm, const CArray<int, 1>& face_idx,
                                const CArray<double, 2>& bounds_lon, const CArray<double, 2>& bounds_lat,
                                CArray<int, 2>& nghbFaces)
@@ -1690,5 +1690,5 @@
    */
 
-  void CMesh::getGloNghbFacesEdgeType(const MPI_Comm& comm, const CArray<int, 1>& face_idx,
+  void CMesh::getGloNghbFacesEdgeType(const ep_lib::MPI_Comm& comm, const CArray<int, 1>& face_idx,
                                const CArray<double, 2>& bounds_lon, const CArray<double, 2>& bounds_lat,
                                CArray<int, 2>& nghbFaces)
@@ -1871,5 +1871,5 @@
    */
 
-  void CMesh::getGlobalNghbFaces(const int nghbType, const MPI_Comm& comm,
+  void CMesh::getGlobalNghbFaces(const int nghbType, const ep_lib::MPI_Comm& comm,
                                  const CArray<int, 1>& face_idx,
                                  const CArray<double, 2>& bounds_lon, const CArray<double, 2>& bounds_lat,
Index: XIOS/dev/branch_yushan/src/node/mesh.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/mesh.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/node/mesh.hpp	(revision 1053)
@@ -60,9 +60,9 @@
                       const CArray<double, 2>&, const CArray<double, 2>& );
                         
-      void createMeshEpsilon(const MPI_Comm&,
+      void createMeshEpsilon(const ep_lib::MPI_Comm&,
                              const CArray<double, 1>&, const CArray<double, 1>&,
                              const CArray<double, 2>&, const CArray<double, 2>& );
 
-      void getGlobalNghbFaces(const int, const MPI_Comm&, const CArray<int, 1>&,
+      void getGlobalNghbFaces(const int, const ep_lib::MPI_Comm&, const CArray<int, 1>&,
                               const CArray<double, 2>&, const CArray<double, 2>&,
                               CArray<int, 2>&);
@@ -84,6 +84,6 @@
       CClientClientDHTSizet* pNodeGlobalIndex;                    // pointer to a map <nodeHash, nodeIdxGlo>
       CClientClientDHTSizet* pEdgeGlobalIndex;                    // pointer to a map <edgeHash, edgeIdxGlo>
-      void getGloNghbFacesNodeType(const MPI_Comm&, const CArray<int, 1>&, const CArray<double, 2>&, const CArray<double, 2>&, CArray<int, 2>&);
-      void getGloNghbFacesEdgeType(const MPI_Comm&, const CArray<int, 1>&, const CArray<double, 2>&, const CArray<double, 2>&, CArray<int, 2>&);
+      void getGloNghbFacesNodeType(const ep_lib::MPI_Comm&, const CArray<int, 1>&, const CArray<double, 2>&, const CArray<double, 2>&, CArray<int, 2>&);
+      void getGloNghbFacesEdgeType(const ep_lib::MPI_Comm&, const CArray<int, 1>&, const CArray<double, 2>&, const CArray<double, 2>&, CArray<int, 2>&);
       void getLocNghbFacesNodeType(const CArray<int, 1>&, const CArray<double, 2>&, const CArray<double, 2>&, CArray<int, 2>&, CArray<int, 1>&);
       void getLocNghbFacesEdgeType(const CArray<int, 1>&, const CArray<double, 2>&, const CArray<double, 2>&, CArray<int, 2>&, CArray<int, 1>&);
Index: XIOS/dev/branch_yushan/src/policy.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/policy.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/policy.hpp	(revision 1053)
@@ -31,5 +31,5 @@
 {
 protected:
-  DivideAdaptiveComm(const MPI_Comm& mpiComm);
+  DivideAdaptiveComm(const ep_lib::MPI_Comm& mpiComm);
 
   void computeMPICommLevel();
@@ -41,5 +41,5 @@
 
 protected:
-  const MPI_Comm& internalComm_;
+  const ep_lib::MPI_Comm& internalComm_;
   std::vector<std::vector<int> > groupParentsBegin_;
   std::vector<std::vector<int> > nbInGroupParents_;
Index: XIOS/dev/branch_yushan/src/registry.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/registry.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/registry.cpp	(revision 1053)
@@ -1,5 +1,4 @@
 #include "registry.hpp"
 #include "type.hpp"
-#include <mpi.hpp>
 #include <fstream>
 #include <sstream>
@@ -261,5 +260,5 @@
   void CRegistry::hierarchicalGatherRegistry(void)
   {
-    //hierarchicalGatherRegistry(communicator) ;
+    hierarchicalGatherRegistry(communicator) ;
   }
 
@@ -288,6 +287,9 @@
       if (mpiRank==0 || mpiRank==mpiSize/2+mpiSize%2) color=0 ;
       else color=1 ;
+      
       MPI_Comm_split(comm,color,mpiRank,&commDown) ;
+      
       if (color==0) gatherRegistry(commDown) ;
+      printf("gatherRegistry OKOK\n");
       MPI_Comm_free(&commDown) ;    
     }
Index: XIOS/dev/branch_yushan/src/registry.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/registry.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/registry.hpp	(revision 1053)
@@ -28,5 +28,5 @@
 /** Constructor, the communicator is used for bcast or gather operation between MPI processes */
      
-      CRegistry(const MPI_Comm& comm=MPI_COMM_WORLD) : communicator(comm) {}
+      CRegistry(const ep_lib::MPI_Comm& comm=MPI_COMM_WORLD) : communicator(comm) {}
       
      
@@ -127,5 +127,5 @@
 
 /** MPI communicator used for broadcast and gather operation */
-      MPI_Comm communicator ;
+      ep_lib::MPI_Comm communicator ;
   } ;
 
Index: XIOS/dev/branch_yushan/src/test/test_client.f90
===================================================================
--- XIOS/dev/branch_yushan/src/test/test_client.f90	(revision 1037)
+++ XIOS/dev/branch_yushan/src/test/test_client.f90	(revision 1053)
@@ -42,6 +42,7 @@
 
   CALL MPI_COMM_RANK(comm,rank,ierr)
-  print*, "test_client MPI_COMM_RANK OK"
+  print*, "test_client MPI_COMM_RANK OK", rank
   CALL MPI_COMM_SIZE(comm,size,ierr)
+  print*, "test_client MPI_COMM_SIZE OK", size
   
 
@@ -138,5 +139,5 @@
   PRINT*,"field field_A is active ? ",xios_field_is_active("field_A")
   !DO ts=1,24*10
-  DO ts=1,24
+  DO ts=1,6
     CALL xios_update_calendar(ts)
     print*, "xios_update_calendar OK, ts = ", ts
Index: XIOS/dev/branch_yushan/src/transformation/axis_algorithm_inverse.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/transformation/axis_algorithm_inverse.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/transformation/axis_algorithm_inverse.cpp	(revision 1053)
@@ -173,6 +173,6 @@
 
   // Sending global index of grid source to corresponding process as well as the corresponding mask
-  std::vector<MPI_Request> requests;
-  std::vector<MPI_Status> status;
+  std::vector<ep_lib::MPI_Request> requests;
+  std::vector<ep_lib::MPI_Status> status;
   boost::unordered_map<int, unsigned long* > recvGlobalIndexSrc;
   boost::unordered_map<int, double* > sendValueToDest;
@@ -184,5 +184,5 @@
     sendValueToDest[recvRank] = new double [recvSize];
 
-    requests.push_back(MPI_Request());
+    requests.push_back(ep_lib::MPI_Request());
     MPI_Irecv(recvGlobalIndexSrc[recvRank], recvSize, MPI_UNSIGNED_LONG, recvRank, 46, client->intraComm, &requests.back());
   }
@@ -206,5 +206,5 @@
 
     // Send global index source and mask
-    requests.push_back(MPI_Request());
+    requests.push_back(ep_lib::MPI_Request());
     MPI_Isend(sendGlobalIndexSrc[sendRank], sendSize, MPI_UNSIGNED_LONG, sendRank, 46, client->intraComm, &requests.back());
   }
@@ -215,6 +215,6 @@
   //printf("(%d) src/transformation/axis_algorithm_inverse 1st waitall OK\n", clientRank);
 
-  std::vector<MPI_Request>().swap(requests);
-  std::vector<MPI_Status>().swap(status);
+  std::vector<ep_lib::MPI_Request>().swap(requests);
+  std::vector<ep_lib::MPI_Status>().swap(status);
 
   // Okie, on destination side, we will wait for information of masked index of source
@@ -224,5 +224,5 @@
     int recvSize = itSend->second;
 
-    requests.push_back(MPI_Request());
+    requests.push_back(ep_lib::MPI_Request());
     MPI_Irecv(recvValueFromSrc[recvRank], recvSize, MPI_DOUBLE, recvRank, 48, client->intraComm, &requests.back());
   }
@@ -242,5 +242,5 @@
     }
     // Okie, now inform the destination which source index are masked
-    requests.push_back(MPI_Request());
+    requests.push_back(ep_lib::MPI_Request());
     MPI_Isend(sendValueToDest[recvRank], recvSize, MPI_DOUBLE, recvRank, 48, client->intraComm, &requests.back());
   }
Index: XIOS/dev/branch_yushan/src/transformation/axis_algorithm_inverse.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/transformation/axis_algorithm_inverse.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/transformation/axis_algorithm_inverse.hpp	(revision 1053)
@@ -12,5 +12,8 @@
 #include "axis_algorithm_transformation.hpp"
 #include "transformation.hpp"
-
+#ifdef _usingEP
+#include "ep_declaration.hpp"
+#endif
+   
 namespace xios {
 
Index: XIOS/dev/branch_yushan/src/transformation/domain_algorithm_interpolate.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/transformation/domain_algorithm_interpolate.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/transformation/domain_algorithm_interpolate.cpp	(revision 1053)
@@ -371,10 +371,10 @@
   CContextClient* client=context->client;
 
-  MPI_Comm poleComme(MPI_COMM_NULL);
-  MPI_Comm_split(client->intraComm, interMapValuePole.empty() ? MPI_UNDEFINED : 1, 0, &poleComme);
+  ep_lib::MPI_Comm poleComme(MPI_COMM_NULL);
+  ep_lib::MPI_Comm_split(client->intraComm, interMapValuePole.empty() ? MPI_UNDEFINED : 1, 0, &poleComme);
   if (MPI_COMM_NULL != poleComme)
   {
     int nbClientPole;
-    MPI_Comm_size(poleComme, &nbClientPole);
+    ep_lib::MPI_Comm_size(poleComme, &nbClientPole);
 
     std::map<int,std::vector<std::pair<int,double> > >::iterator itePole = interMapValuePole.end(), itPole,
@@ -541,5 +541,5 @@
   double* sendWeightBuff = new double [sendBuffSize];
 
-  std::vector<MPI_Request> sendRequest;
+  std::vector<ep_lib::MPI_Request> sendRequest;
 
   int sendOffSet = 0, l = 0;
@@ -562,5 +562,5 @@
     }
 
-    sendRequest.push_back(MPI_Request());
+    sendRequest.push_back(ep_lib::MPI_Request());
     MPI_Isend(sendIndexDestBuff + sendOffSet,
              k,
@@ -570,5 +570,5 @@
              client->intraComm,
              &sendRequest.back());
-    sendRequest.push_back(MPI_Request());
+    sendRequest.push_back(ep_lib::MPI_Request());
     MPI_Isend(sendIndexSrcBuff + sendOffSet,
              k,
@@ -578,5 +578,5 @@
              client->intraComm,
              &sendRequest.back());
-    sendRequest.push_back(MPI_Request());
+    sendRequest.push_back(ep_lib::MPI_Request());
     MPI_Isend(sendWeightBuff + sendOffSet,
              k,
@@ -597,5 +597,5 @@
   while (receivedSize < recvBuffSize)
   {
-    MPI_Status recvStatus;
+    ep_lib::MPI_Status recvStatus;
     MPI_Recv((recvIndexDestBuff + receivedSize),
              recvBuffSize,
@@ -637,6 +637,8 @@
   }
 
-  std::vector<MPI_Status> requestStatus(sendRequest.size());
-  MPI_Waitall(sendRequest.size(), &sendRequest[0], MPI_STATUS_IGNORE);
+  std::vector<ep_lib::MPI_Status> requestStatus(sendRequest.size());
+  ep_lib::MPI_Status stat_ignore;
+  MPI_Waitall(sendRequest.size(), &sendRequest[0], &stat_ignore);
+  //MPI_Waitall(sendRequest.size(), &sendRequest[0], MPI_STATUS_IGNORE);
 
   delete [] sendIndexDestBuff;
@@ -724,10 +726,10 @@
 
   MPI_Allreduce(&localNbWeight, &globalNbWeight, 1, MPI_LONG, MPI_SUM, client->intraComm);
-  MPI_Scan(&localNbWeight, &startIndex, 1, MPI_LONG, MPI_SUM, client->intraComm);
+  ep_lib::MPI_Scan(&localNbWeight, &startIndex, 1, MPI_LONG, MPI_SUM, client->intraComm);
   
   std::vector<StdSize> start(1, startIndex - localNbWeight);
   std::vector<StdSize> count(1, localNbWeight);
 
-  WriteNetCdf netCdfWriter(filename, client->intraComm);
+  WriteNetCdf netCdfWriter(filename, static_cast<MPI_Comm>(client->intraComm.mpi_comm));
 
   // netCdfWriter = CONetCDF4(filename, false, false, true, client->intraComm, false);
Index: XIOS/dev/branch_yushan/src/transformation/domain_algorithm_interpolate.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/transformation/domain_algorithm_interpolate.hpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/transformation/domain_algorithm_interpolate.hpp	(revision 1053)
@@ -13,4 +13,7 @@
 #include "transformation.hpp"
 #include "nc4_data_output.hpp"
+#ifdef _usingEP
+#include "ep_declaration.hpp"
+#endif
 
 namespace xios {
Index: XIOS/dev/branch_yushan/src/transformation/grid_transformation.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/transformation/grid_transformation.cpp	(revision 1037)
+++ XIOS/dev/branch_yushan/src/transformation/grid_transformation.cpp	(revision 1053)
@@ -475,6 +475,6 @@
 
   // Sending global index of grid source to corresponding process as well as the corresponding mask
-  std::vector<MPI_Request> requests;
-  std::vector<MPI_Status> status;
+  std::vector<ep_lib::MPI_Request> requests;
+  std::vector<ep_lib::MPI_Status> status;
   boost::unordered_map<int, unsigned char* > recvMaskDst;
   boost::unordered_map<int, unsigned long* > recvGlobalIndexSrc;
@@ -486,7 +486,7 @@
     recvGlobalIndexSrc[recvRank] = new unsigned long [recvSize];
 
-    requests.push_back(MPI_Request());
+    requests.push_back(ep_lib::MPI_Request());
     MPI_Irecv(recvGlobalIndexSrc[recvRank], recvSize, MPI_UNSIGNED_LONG, recvRank, 46, client->intraComm, &requests.back());
-    requests.push_back(MPI_Request());
+    requests.push_back(ep_lib::MPI_Request());
     MPI_Irecv(recvMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 47, client->intraComm, &requests.back());
   }
@@ -524,7 +524,7 @@
 
     // Send global index source and mask
-    requests.push_back(MPI_Request());
+    requests.push_back(ep_lib::MPI_Request());
     MPI_Isend(sendGlobalIndexSrc[sendRank], sendSize, MPI_UNSIGNED_LONG, sendRank, 46, client->intraComm, &requests.back());
-    requests.push_back(MPI_Request());
+    requests.push_back(ep_lib::MPI_Request());
     MPI_Isend(sendMaskDst[sendRank], sendSize, MPI_UNSIGNED_CHAR, sendRank, 47, client->intraComm, &requests.back());
   }
@@ -536,6 +536,6 @@
 
   // Okie, now use the mask to identify which index source we need to send, then also signal the destination which masked index we will return
-  std::vector<MPI_Request>().swap(requests);
-  std::vector<MPI_Status>().swap(status);
+  std::vector<ep_lib::MPI_Request>().swap(requests);
+  std::vector<ep_lib::MPI_Status>().swap(status);
   // Okie, on destination side, we will wait for information of masked index of source
   for (std::map<int,int>::const_iterator itSend = sendRankSizeMap.begin(); itSend != sendRankSizeMap.end(); ++itSend)
@@ -544,5 +544,5 @@
     int recvSize = itSend->second;
 
-    requests.push_back(MPI_Request());
+    requests.push_back(ep_lib::MPI_Request());
     MPI_Irecv(sendMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 48, client->intraComm, &requests.back());
   }
@@ -581,5 +581,5 @@
 
     // Okie, now inform the destination which source index are masked
-    requests.push_back(MPI_Request());
+    requests.push_back(ep_lib::MPI_Request());
     MPI_Isend(recvMaskDst[recvRank], recvSize, MPI_UNSIGNED_CHAR, recvRank, 48, client->intraComm, &requests.back());
   }
