Index: XIOS/dev/branch_yushan/extern/src_ep_dev/ep_gatherv.cpp
===================================================================
--- XIOS/dev/branch_yushan/extern/src_ep_dev/ep_gatherv.cpp	(revision 1110)
+++ XIOS/dev/branch_yushan/extern/src_ep_dev/ep_gatherv.cpp	(revision 1115)
@@ -89,5 +89,5 @@
           #pragma omp critical (read_from_buffer)
           {
-            copy(buffer, buffer+min(BUFFER_SIZE, count-j), recv_buf+j+displs[k]);
+            copy(buffer, buffer+min(BUFFER_SIZE, recvcounts[k]-j), recv_buf+j+displs[k]);
           }
         }
@@ -133,5 +133,5 @@
           #pragma omp critical (read_from_buffer)
           {
-            copy(buffer, buffer+min(BUFFER_SIZE, count-j), recv_buf+j+displs[k]);
+            copy(buffer, buffer+min(BUFFER_SIZE, recvcounts[k]-j), recv_buf+j+displs[k]);
           }
         }
@@ -177,5 +177,5 @@
           #pragma omp critical (read_from_buffer)
           {
-            copy(buffer, buffer+min(BUFFER_SIZE, count-j), recv_buf+j+displs[k]);
+            copy(buffer, buffer+min(BUFFER_SIZE, recvcounts[k]-j), recv_buf+j+displs[k]);
           }
         }
@@ -221,5 +221,5 @@
           #pragma omp critical (read_from_buffer)
           {
-            copy(buffer, buffer+min(BUFFER_SIZE, count-j), recv_buf+j+displs[k]);
+            copy(buffer, buffer+min(BUFFER_SIZE, recvcounts[k]-j), recv_buf+j+displs[k]);
           }
         }
@@ -265,5 +265,5 @@
           #pragma omp critical (read_from_buffer)
           {
-            copy(buffer, buffer+min(BUFFER_SIZE, count-j), recv_buf+j+displs[k]);
+            copy(buffer, buffer+min(BUFFER_SIZE, recvcounts[k]-j), recv_buf+j+displs[k]);
           }
         }
@@ -309,5 +309,5 @@
           #pragma omp critical (read_from_buffer)
           {
-            copy(buffer, buffer+min(BUFFER_SIZE, count-j), recv_buf+j+displs[k]);
+            copy(buffer, buffer+min(BUFFER_SIZE, recvcounts[k]-j), recv_buf+j+displs[k]);
           }
         }
@@ -485,5 +485,5 @@
     
 
-    assert(accumulate(recvcounts, recvcounts+ep_size-1, 0) == displs[ep_size-1]); // Only for contunuous gather.
+    assert(accumulate(recvcounts, recvcounts+ep_size-1, 0) == displs[ep_size-1]); // Only for continuous gather.
 
 
@@ -498,4 +498,5 @@
       int buffer_size = accumulate(recvcounts+ep_rank, recvcounts+ep_rank+num_ep, 0);
       local_gather_recvbuf = new void*[datasize*buffer_size];
+      printf("buffersize = %d\n", buffer_size);
     }
 
Index: XIOS/dev/branch_yushan/src/client_server_mapping.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/client_server_mapping.cpp	(revision 1110)
+++ XIOS/dev/branch_yushan/src/client_server_mapping.cpp	(revision 1115)
@@ -68,8 +68,20 @@
   int recvSize=displ[nbClient-1]+recvCount[nbClient-1] ;
   int* recvBuff=new int[recvSize] ;
-
+  
+  printf("nbConnectedServer = %d\n", nbConnectedServer);
+  
+  printf("displ = %d, %d, %d, %d, %d, %d, %d, %d\n", 
+              displ[0], displ[1], displ[2], displ[3], displ[4], displ[5], displ[6], displ[7]);
+  printf("recvCount = %d, %d, %d, %d, %d, %d, %d, %d\n", 
+              recvCount[0], recvCount[1], recvCount[2], recvCount[3], recvCount[4], recvCount[5], recvCount[6], recvCount[7]);
+  printf("receSize = %d\n", recvSize);
+  
 
   MPI_Allgatherv(sendBuff,nbConnectedServer,MPI_INT,recvBuff,recvCount,displ,MPI_INT,clientIntraComm) ;
-  for(int n=0;n<recvSize;n++) clientRes[recvBuff[n]]++ ;
+  for(int n=0;n<recvSize;n++) 
+  {
+    recvBuff[n];
+    clientRes[recvBuff[n]]++ ;
+  }
 
   for(int n=0;n<nbConnectedServer;n++)
Index: XIOS/dev/branch_yushan/src/node/context.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/context.cpp	(revision 1110)
+++ XIOS/dev/branch_yushan/src/node/context.cpp	(revision 1115)
@@ -390,4 +390,5 @@
         {
           server->eventLoop();
+          //printf("server->hasFinished() = %d\n", server->hasFinished());
         }
 
Index: XIOS/dev/branch_yushan/src/test/test_complete.f90
===================================================================
--- XIOS/dev/branch_yushan/src/test/test_complete.f90	(revision 1110)
+++ XIOS/dev/branch_yushan/src/test/test_complete.f90	(revision 1115)
@@ -236,6 +236,6 @@
 !####################################################################################
 
-    DO ts=1,24*10
-    !DO ts=1,24
+    !DO ts=1,24*10
+    DO ts=1,24
 
       CALL xios_get_handle("atmosphere",ctx_hdl)
Index: XIOS/dev/branch_yushan/src/test/test_complete_omp.f90
===================================================================
--- XIOS/dev/branch_yushan/src/test/test_complete_omp.f90	(revision 1110)
+++ XIOS/dev/branch_yushan/src/test/test_complete_omp.f90	(revision 1115)
@@ -181,50 +181,50 @@
 !!! Initialisation des coordonnes globales et locales pour la grille indexee (1 point sur 2)
 
-    nb_pt=ni*nj/2
-    ALLOCATE(kindex(nb_pt),field_A_srf(nb_pt,llm))
-    DO i=1,nb_pt
-      kindex(i)=2*i-1
-    ENDDO
-    field_A_srf(1:nb_pt,:)=RESHAPE(field_A_glo(ibegin+1:iend+1:2,jbegin+1:jend+1,:),(/ nb_pt,llm /))
-
-  CALL xios_context_initialize("surface",comm)
-
-  CALL xios_get_handle("surface",ctx_hdl)
-  CALL xios_set_current_context(ctx_hdl)
-
-  CALL xios_define_calendar(type="Gregorian", &
-                            start_date=xios_date(2000, 01, 01, 00, 00, 00), &
-                            time_origin=xios_date(1999, 01, 01, 15, 00, 00))
-
-  CALL xios_set_axis_attr("axis_srf",n_glo=llm ,value=lval)
-  CALL xios_set_domain_attr("domain_srf",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj, type='curvilinear')
-  CALL xios_set_domain_attr("domain_srf",data_dim=1, data_ibegin=0, data_ni=nb_pt)
-  CALL xios_set_domain_attr("domain_srf",data_i_index=kindex)
-  CALL xios_set_domain_attr("domain_srf",lonvalue_2D=lon,latvalue_2D=lat)
+!    nb_pt=ni*nj/2
+!    ALLOCATE(kindex(nb_pt),field_A_srf(nb_pt,llm))
+!    DO i=1,nb_pt
+!      kindex(i)=2*i-1
+!    ENDDO
+!    field_A_srf(1:nb_pt,:)=RESHAPE(field_A_glo(ibegin+1:iend+1:2,jbegin+1:jend+1,:),(/ nb_pt,llm /))
+
+!  CALL xios_context_initialize("surface",comm)
+
+!  CALL xios_get_handle("surface",ctx_hdl)
+!  CALL xios_set_current_context(ctx_hdl)
+
+!  CALL xios_define_calendar(type="Gregorian", &
+!                            start_date=xios_date(2000, 01, 01, 00, 00, 00), &
+!                            time_origin=xios_date(1999, 01, 01, 15, 00, 00))
+
+!  CALL xios_set_axis_attr("axis_srf",n_glo=llm ,value=lval)
+!  CALL xios_set_domain_attr("domain_srf",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj, type='curvilinear')
+!  CALL xios_set_domain_attr("domain_srf",data_dim=1, data_ibegin=0, data_ni=nb_pt)
+!  CALL xios_set_domain_attr("domain_srf",data_i_index=kindex)
+!  CALL xios_set_domain_attr("domain_srf",lonvalue_2D=lon,latvalue_2D=lat)
 
 !!! Cration d un nouveau champ
 
-  CALL xios_get_handle("field_definition",fieldgroup_hdl)
-  CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B_srf")
+ ! CALL xios_get_handle("field_definition",fieldgroup_hdl)
+!  CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B_srf")
 
 !!! Heritage des attributs d un autre champ
 
-  CALL xios_set_attr(field_hdl,field_ref="field_A_srf",name="field_B_srf")
+!  CALL xios_set_attr(field_hdl,field_ref="field_A_srf",name="field_B_srf")
 
 !!! Affectation de ce nouveau champ au fichier avec un nouveau nom
 
-  CALL xios_get_handle("output_surface",file_hdl)
-  CALL xios_add_child(file_hdl,field_hdl)
-  CALL xios_set_attr(field_hdl,field_ref="field_B_srf",name="field_C_srf")
+!  CALL xios_get_handle("output_surface",file_hdl)
+!  CALL xios_add_child(file_hdl,field_hdl)
+!  CALL xios_set_attr(field_hdl,field_ref="field_B_srf",name="field_C_srf")
 
 !!! Definition du timestep
 
-  dtime%second=1800
-  CALL xios_set_timestep(timestep=dtime)
+!  dtime%second=1800
+!  CALL xios_set_timestep(timestep=dtime)
 
 !!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalit)
 
-  ni=0 ; lonvalue(:,:)=0
-  CALL xios_get_domain_attr("domain_srf",ni=ni,lonvalue_2D=lonvalue)
+!  ni=0 ; lonvalue(:,:)=0
+!  CALL xios_get_domain_attr("domain_srf",ni=ni,lonvalue_2D=lonvalue)
 
   !PRINT *,"ni",ni
@@ -233,7 +233,7 @@
 !!! Fin de la definition du contexte SRF
 
-  CALL xios_close_context_definition()
-
-  print *, "xios_close_context_definition(surface)" 
+!  CALL xios_close_context_definition()
+
+!  print *, "xios_close_context_definition(surface)" 
 
 
@@ -242,9 +242,9 @@
 !####################################################################################
 
-    DO ts=1,24*10
-    !DO ts=1,24
-
-      CALL xios_get_handle("atmosphere",ctx_hdl)
-      CALL xios_set_current_context(ctx_hdl)
+    !DO ts=1,24*10
+    DO ts=1,24
+
+      !CALL xios_get_handle("atmosphere",ctx_hdl)
+      !CALL xios_set_current_context(ctx_hdl)
 
 !!! Mise a jour du pas de temps
@@ -258,14 +258,14 @@
 !!! On change de contexte
 
-      CALL xios_get_handle("surface",ctx_hdl)
-      CALL xios_set_current_context(ctx_hdl)
+!      CALL xios_get_handle("surface",ctx_hdl)
+!      CALL xios_set_current_context(ctx_hdl)
 
 !!! Mise a jour du pas de temps
 
-      CALL xios_update_calendar(ts)
+ !     CALL xios_update_calendar(ts)
 
 !!! On donne la valeur du champ srf
 
-      CALL xios_send_field("field_A_srf",field_A_srf)
+ !     CALL xios_send_field("field_A_srf",field_A_srf)
 
       CALL wait_us(5000) ;
@@ -283,15 +283,15 @@
 
 
-    CALL xios_get_handle("surface",ctx_hdl) 
-
-    CALL xios_set_current_context(ctx_hdl)
-
-    CALL xios_context_finalize()
-
-    print *, "xios_context_finalize(surface)" 
-
-     CALL xios_get_handle("atmosphere",ctx_hdl)
-
-     CALL xios_set_current_context(ctx_hdl)
+!    CALL xios_get_handle("surface",ctx_hdl) 
+
+!    CALL xios_set_current_context(ctx_hdl)
+
+!    CALL xios_context_finalize()
+
+!    print *, "xios_context_finalize(surface)" 
+
+     !CALL xios_get_handle("atmosphere",ctx_hdl)
+
+     !CALL xios_set_current_context(ctx_hdl)
 
      CALL xios_context_finalize()
@@ -308,5 +308,5 @@
 
     DEALLOCATE(lon, lat, field_A_atm, lonvalue)
-    DEALLOCATE(kindex, field_A_srf)
+!    DEALLOCATE(kindex, field_A_srf)
 
      print *, "Client : xios_finalize "
Index: XIOS/dev/branch_yushan/src/test/test_omp.f90
===================================================================
--- XIOS/dev/branch_yushan/src/test/test_omp.f90	(revision 1110)
+++ XIOS/dev/branch_yushan/src/test/test_omp.f90	(revision 1115)
@@ -45,5 +45,5 @@
     CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr)
     CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr)
-    if(rank < size-1) then
+    if(rank < size-2) then
 
     !$omp parallel default(private)
