Index: XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp
===================================================================
--- XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp	(revision 1622)
+++ XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp	(revision 1638)
@@ -434,10 +434,14 @@
   CContextClient* client=context->client;
 
-  MPI_Comm poleComme(MPI_COMM_NULL);
+  ep_lib::MPI_Comm poleComme(EP_COMM_NULL);
+  #ifdef _usingMPI
   MPI_Comm_split(client->intraComm, interMapValuePole.empty() ? MPI_UNDEFINED : 1, 0, &poleComme);
-  if (MPI_COMM_NULL != poleComme)
+  #elif _usingEP
+  ep_lib::MPI_Comm_split(client->intraComm, interMapValuePole.empty() ? 0 : 1, 0, &poleComme);
+  #endif
+  if (EP_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,
@@ -450,5 +454,5 @@
     std::vector<int> recvCount(nbClientPole,0);
     std::vector<int> displ(nbClientPole,0);
-    MPI_Allgather(&nbWeight,1,MPI_INT,&recvCount[0],1,MPI_INT,poleComme) ;
+    ep_lib::MPI_Allgather(&nbWeight,1,EP_INT,&recvCount[0],1,EP_INT,poleComme) ;
 
     displ[0]=0;
@@ -473,6 +477,6 @@
 
     // Gather all index and weight for pole
-    MPI_Allgatherv(&sendSourceIndexBuff[0],nbWeight,MPI_INT,&recvSourceIndexBuff[0],&recvCount[0],&displ[0],MPI_INT,poleComme);
-    MPI_Allgatherv(&sendSourceWeightBuff[0],nbWeight,MPI_DOUBLE,&recvSourceWeightBuff[0],&recvCount[0],&displ[0],MPI_DOUBLE,poleComme);
+    ep_lib::MPI_Allgatherv(&sendSourceIndexBuff[0],nbWeight,EP_INT,&recvSourceIndexBuff[0],&recvCount[0],&displ[0],EP_INT,poleComme);
+    ep_lib::MPI_Allgatherv(&sendSourceWeightBuff[0],nbWeight,EP_DOUBLE,&recvSourceWeightBuff[0],&recvCount[0],&displ[0],EP_DOUBLE,poleComme);
 
     std::map<int,double> recvTemp;
@@ -631,5 +635,5 @@
 
 
-  MPI_Allreduce(sendBuff, recvBuff, nbClient, MPI_INT, MPI_SUM, client->intraComm);
+  ep_lib::MPI_Allreduce(sendBuff, recvBuff, nbClient, EP_INT, EP_SUM, client->intraComm);
 
   int* sendIndexDestBuff = new int [sendBuffSize];
@@ -637,5 +641,5 @@
   double* sendWeightBuff = new double [sendBuffSize];
 
-  std::vector<MPI_Request> sendRequest;
+  std::vector<ep_lib::MPI_Request> sendRequest;
 
   int sendOffSet = 0, l = 0;
@@ -658,24 +662,24 @@
     }
 
-    sendRequest.push_back(MPI_Request());
-    MPI_Isend(sendIndexDestBuff + sendOffSet,
+    sendRequest.push_back(ep_lib::MPI_Request());
+    ep_lib::MPI_Isend(sendIndexDestBuff + sendOffSet,
              k,
-             MPI_INT,
+             EP_INT,
              itMap->first,
              MPI_DOMAIN_INTERPOLATION_DEST_INDEX,
              client->intraComm,
              &sendRequest.back());
-    sendRequest.push_back(MPI_Request());
-    MPI_Isend(sendIndexSrcBuff + sendOffSet,
+    sendRequest.push_back(ep_lib::MPI_Request());
+    ep_lib::MPI_Isend(sendIndexSrcBuff + sendOffSet,
              k,
-             MPI_INT,
+             EP_INT,
              itMap->first,
              MPI_DOMAIN_INTERPOLATION_SRC_INDEX,
              client->intraComm,
              &sendRequest.back());
-    sendRequest.push_back(MPI_Request());
-    MPI_Isend(sendWeightBuff + sendOffSet,
+    sendRequest.push_back(ep_lib::MPI_Request());
+    ep_lib::MPI_Isend(sendWeightBuff + sendOffSet,
              k,
-             MPI_DOUBLE,
+             EP_DOUBLE,
              itMap->first,
              MPI_DOMAIN_INTERPOLATION_WEIGHT,
@@ -693,20 +697,34 @@
   while (receivedSize < recvBuffSize)
   {
-    MPI_Status recvStatus;
+    ep_lib::MPI_Status recvStatus;
+    #ifdef _usingMPI
     MPI_Recv((recvIndexDestBuff + receivedSize),
              recvBuffSize,
-             MPI_INT,
+             EP_INT,
              MPI_ANY_SOURCE,
              MPI_DOMAIN_INTERPOLATION_DEST_INDEX,
              client->intraComm,
              &recvStatus);
+    #elif _usingEP
+    ep_lib::MPI_Recv((recvIndexDestBuff + receivedSize),
+             recvBuffSize,
+             EP_INT,
+             -2,
+             MPI_DOMAIN_INTERPOLATION_DEST_INDEX,
+             client->intraComm,
+             &recvStatus);
+    #endif
 
     int countBuff = 0;
-    MPI_Get_count(&recvStatus, MPI_INT, &countBuff);
+    ep_lib::MPI_Get_count(&recvStatus, EP_INT, &countBuff);
+    #ifdef _usingMPI
     clientSrcRank = recvStatus.MPI_SOURCE;
-
-    MPI_Recv((recvIndexSrcBuff + receivedSize),
+    #elif _usingEP
+    clientSrcRank = recvStatus.ep_src;
+    #endif
+
+    ep_lib::MPI_Recv((recvIndexSrcBuff + receivedSize),
              recvBuffSize,
-             MPI_INT,
+             EP_INT,
              clientSrcRank,
              MPI_DOMAIN_INTERPOLATION_SRC_INDEX,
@@ -714,7 +732,7 @@
              &recvStatus);
 
-    MPI_Recv((recvWeightBuff + receivedSize),
+    ep_lib::MPI_Recv((recvWeightBuff + receivedSize),
              recvBuffSize,
-             MPI_DOUBLE,
+             EP_DOUBLE,
              clientSrcRank,
              MPI_DOMAIN_INTERPOLATION_WEIGHT,
@@ -730,6 +748,11 @@
   }
 
-  std::vector<MPI_Status> requestStatus(sendRequest.size());
+  std::vector<ep_lib::MPI_Status> requestStatus(sendRequest.size());
+  #ifdef _usingMPI
   MPI_Waitall(sendRequest.size(), &sendRequest[0], MPI_STATUS_IGNORE);
+  #elif _usingEP
+  std::vector<ep_lib::MPI_Status> waitstat(sendRequest.size());
+  ep_lib::MPI_Waitall(sendRequest.size(), &sendRequest[0], &waitstat[0]);
+  #endif
 
   delete [] sendIndexDestBuff;
@@ -745,5 +768,5 @@
  
 /*! Redefined some functions of CONetCDF4 to make use of them */
-CDomainAlgorithmInterpolate::WriteNetCdf::WriteNetCdf(const StdString& filename, const MPI_Comm comm)
+CDomainAlgorithmInterpolate::WriteNetCdf::WriteNetCdf(const StdString& filename, const ep_lib::MPI_Comm comm)
   : CNc4DataOutput(NULL, filename, false, false, true, comm, false, true) {}
 int CDomainAlgorithmInterpolate::WriteNetCdf::addDimensionWrite(const StdString& name, 
@@ -835,6 +858,6 @@
   }
 
-  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_Allreduce(&localNbWeight, &globalNbWeight, 1, EP_LONG, EP_SUM, client->intraComm);
+  ep_lib::MPI_Scan(&localNbWeight, &startIndex, 1, EP_LONG, EP_SUM, client->intraComm);
   
   if (0 == globalNbWeight)
