Index: XIOS/dev/dev_trunk_omp/extern/src_ep_dev/ep_gatherv.cpp
===================================================================
--- XIOS/dev/dev_trunk_omp/extern/src_ep_dev/ep_gatherv.cpp	(revision 1603)
+++ XIOS/dev/dev_trunk_omp/extern/src_ep_dev/ep_gatherv.cpp	(revision 1646)
@@ -1,2 +1,3 @@
+#ifdef _usingEP
 /*!
    \file ep_gather.cpp
@@ -93,5 +94,7 @@
     else                          MPI_Gather_local(&sendcount, 1, MPI_INT, local_recvcounts.data(), 0, comm);
 
-
+    
+    //if(is_root) printf("rank %d =================local_recvcounts = %d %d\n", ep_rank, local_recvcounts[0], local_recvcounts[1]);
+    //if(!is_root && ep_rank_loc==0 && mpi_rank != root_mpi_rank) printf("rank %d =================local_recvcounts = %d %d\n", ep_rank, local_recvcounts[0], local_recvcounts[1]);
 
     if(is_master)
@@ -108,7 +111,13 @@
     else                          MPI_Gatherv_local(sendbuf, sendcount, sendtype, local_recvbuf, local_recvcounts.data(), local_displs.data(), 0, comm);
 
+    
+    //if(is_root) printf("rank %d =================local_recvbuf = %d %d\n", ep_rank, static_cast<int*>(local_recvbuf)[0], static_cast<int*>(local_recvbuf)[1]);
+    //if(!is_root && ep_rank_loc==0 && mpi_rank != root_mpi_rank && ep_rank!=6) printf("rank %d =================local_recvbuf = %d %d\n", ep_rank, static_cast<int*>(local_recvbuf)[0], static_cast<int*>(local_recvbuf)[1]);
+    //if(!is_root && ep_rank_loc==0 && mpi_rank != root_mpi_rank && ep_rank==6) printf("rank %d =================local_recvbuf = %d %d %d\n", ep_rank, static_cast<int*>(local_recvbuf)[0], static_cast<int*>(local_recvbuf)[1], static_cast<int*>(local_recvbuf)[2]);
 
     void* tmp_recvbuf;
     int tmp_recvbuf_size = std::accumulate(recvcounts, recvcounts+ep_size, 0);
+
+
 
     if(is_root) tmp_recvbuf = new void*[datasize * tmp_recvbuf_size];
@@ -121,4 +130,10 @@
     if(is_master)
     {
+      int sendcount_mpi = 0;
+      for(int i=0; i<num_ep; i++)
+      {
+        sendcount_mpi += local_recvcounts[i];
+      }
+
       for(int i=0; i<ep_size; i++)
       {
@@ -130,5 +145,13 @@
 
 
-      ::MPI_Gatherv(local_recvbuf, sendcount*num_ep, to_mpi_type(sendtype), tmp_recvbuf, mpi_recvcounts.data(), mpi_displs.data(), to_mpi_type(recvtype), root_mpi_rank, to_mpi_comm(comm->mpi_comm));
+      ::MPI_Gatherv(local_recvbuf, sendcount_mpi, to_mpi_type(sendtype), tmp_recvbuf, mpi_recvcounts.data(), mpi_displs.data(), to_mpi_type(recvtype), root_mpi_rank, to_mpi_comm(comm->mpi_comm));
+      //printf("****************** rank %d, sendcount*num_ep = %d, sendcount_mpi = %d\n", ep_rank, sendcount*num_ep, sendcount_mpi);
+
+      /*if(is_root) printf("rank %d =================tmp_recvbuf = %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", ep_rank, static_cast<int*>(tmp_recvbuf)[0], static_cast<int*>(tmp_recvbuf)[1], static_cast<int*>(tmp_recvbuf)[2],
+                                                                                                                                 static_cast<int*>(tmp_recvbuf)[3], static_cast<int*>(tmp_recvbuf)[4], static_cast<int*>(tmp_recvbuf)[5],
+                                                                                                                                 static_cast<int*>(tmp_recvbuf)[6], static_cast<int*>(tmp_recvbuf)[7], static_cast<int*>(tmp_recvbuf)[8],
+                                                                                                                                 static_cast<int*>(tmp_recvbuf)[9], static_cast<int*>(tmp_recvbuf)[10], static_cast<int*>(tmp_recvbuf)[11],
+                                                                                                                                 static_cast<int*>(tmp_recvbuf)[12], static_cast<int*>(tmp_recvbuf)[13], static_cast<int*>(tmp_recvbuf)[14],
+                                                                                                                                 static_cast<int*>(tmp_recvbuf)[15], static_cast<int*>(tmp_recvbuf)[16]);*/
     }   
 
@@ -174,2 +197,3 @@
 
 }
+#endif
