Index: XIOS/dev/branch_yushan/arch/arch-GCC_LINUX.path
===================================================================
--- XIOS/dev/branch_yushan/arch/arch-GCC_LINUX.path	(revision 1081)
+++ XIOS/dev/branch_yushan/arch/arch-GCC_LINUX.path	(revision 1085)
@@ -3,6 +3,6 @@
 NETCDF_LIB=" -lnetcdf"
 
-MPI_INCDIR=""
-MPI_LIBDIR=""
+MPI_INCDIR="-I /usr/local/include"
+MPI_LIBDIR="-L /usr/local/lib"
 MPI_LIB=""
 
Index: XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp
===================================================================
--- XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp	(revision 1081)
+++ XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp	(revision 1085)
@@ -6,4 +6,7 @@
 #include "ep_declaration.hpp"
 
+#ifdef _openmpi
+//#undef MPI_Fint
+#endif
 
 namespace ep_lib
Index: XIOS/dev/branch_yushan/src/buffer_server.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/buffer_server.cpp	(revision 1081)
+++ XIOS/dev/branch_yushan/src/buffer_server.cpp	(revision 1085)
@@ -2,5 +2,4 @@
 #include "exception.hpp"
 #include "buffer_server.hpp"
-
 
 namespace xios
Index: XIOS/dev/branch_yushan/src/client.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.cpp	(revision 1081)
+++ XIOS/dev/branch_yushan/src/client.cpp	(revision 1085)
@@ -17,5 +17,5 @@
     MPI_Comm CClient::intraComm ;
     MPI_Comm CClient::interComm ;
-    std::list<MPI_Comm> CClient::contextInterComms;
+    std::list<MPI_Comm> *CClient::contextInterComms_ptr;
     int CClient::serverLeader ;
     bool CClient::is_MPI_Initialized ;
@@ -172,7 +172,10 @@
       CContext::setCurrent(id) ;
       CContext* context = CContext::create(id);
+
+      int tmp_rank;
+      MPI_Comm_rank(contextComm,&tmp_rank) ;
       
       #pragma omp critical (_output)
-      printf("Client::registerContext context add = %p\n", &(*context));
+      printf("Client %d : Client::registerContext context add = %p\n", tmp_rank, &(*context));
       
       
@@ -228,5 +231,5 @@
         
 
-        contextInterComms.push_back(contextInterComm);
+        contextInterComms_ptr->push_back(contextInterComm);
         MPI_Comm_free(&inter);
       }
@@ -246,5 +249,5 @@
         CContext::setCurrent(id);
 
-        contextInterComms.push_back(contextInterComm);
+        contextInterComms_ptr->push_back(contextInterComm);
       }
     }
@@ -266,5 +269,5 @@
       }
 
-      for (std::list<MPI_Comm>::iterator it = contextInterComms.begin(); it != contextInterComms.end(); ++it)
+      for (std::list<MPI_Comm>::iterator it = contextInterComms_ptr->begin(); it != contextInterComms_ptr->end(); ++it)
         MPI_Comm_free(&(*it));
       
Index: XIOS/dev/branch_yushan/src/client.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.hpp	(revision 1081)
+++ XIOS/dev/branch_yushan/src/client.hpp	(revision 1085)
@@ -21,6 +21,6 @@
         #pragma omp threadprivate(interComm)
 
-        static std::list<MPI_Comm> contextInterComms;
-        //std::list<MPI_Comm> contextInterComms;
+        //static std::list<MPI_Comm> contextInterComms;
+        std::list<MPI_Comm> contextInterComms;
         static std::list<MPI_Comm> * contextInterComms_ptr;
         #pragma omp threadprivate(contextInterComms_ptr)
Index: XIOS/dev/branch_yushan/src/cxios.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/cxios.cpp	(revision 1081)
+++ XIOS/dev/branch_yushan/src/cxios.cpp	(revision 1085)
@@ -22,22 +22,22 @@
   bool CXios::isClient ;
   bool CXios::isServer ;
-  #pragma omp threadprivate(CXios::isServer, CXios::isClient)
+  //#pragma omp threadprivate(CXios::isServer, CXios::isClient)
 
   MPI_Comm CXios::globalComm ;
-  #pragma omp threadprivate(CXios::globalComm)
+  //#pragma omp threadprivate(CXios::globalComm)
   
   bool CXios::usingOasis ;
   bool CXios::usingServer = false;
-  #pragma omp threadprivate(CXios::usingOasis, CXios::usingServer)
+ // #pragma omp threadprivate(CXios::usingOasis, CXios::usingServer)
 
   double CXios::bufferSizeFactor = 1.0;
   const double CXios::defaultBufferSizeFactor = 1.0;
   StdSize CXios::minBufferSize = 1024 * sizeof(double);
-  #pragma omp threadprivate(CXios::bufferSizeFactor, CXios::defaultBufferSizeFactor, CXios::minBufferSize)
+  //#pragma omp threadprivate(CXios::bufferSizeFactor, CXios::defaultBufferSizeFactor, CXios::minBufferSize)
 
   bool CXios::printLogs2Files;
   bool CXios::isOptPerformance = true;
   CRegistry* CXios::globalRegistry = 0;
-  #pragma omp threadprivate(CXios::printLogs2Files, CXios::isOptPerformance)
+  //#pragma omp threadprivate(CXios::printLogs2Files, CXios::isOptPerformance)
 
 
Index: XIOS/dev/branch_yushan/src/io/netcdf.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/netcdf.hpp	(revision 1081)
+++ XIOS/dev/branch_yushan/src/io/netcdf.hpp	(revision 1085)
@@ -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/mpi_std.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/mpi_std.hpp	(revision 1081)
+++ 	(revision )
@@ -1,18 +1,0 @@
-#ifndef __XIOS_MPI_HPP__
-#define __XIOS_MPI_HPP__
-
-/* skip C++ Binding for mpich , intel MPI */
-#define MPICH_SKIP_MPICXX
-
-/* skip C++ Binding for SGI MPI library */
-#define MPI_NO_CPPBIND
-
-/* skip C++ Binding for OpenMPI */
-#define OMPI_SKIP_MPICXX
-
-#include "../extern/src_ep_dev/ep_lib.hpp"
-#include <mpi.h>
-
-
-
-#endif
Index: XIOS/dev/branch_yushan/src/object_template.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/object_template.hpp	(revision 1081)
+++ XIOS/dev/branch_yushan/src/object_template.hpp	(revision 1085)
@@ -97,4 +97,5 @@
 
          /// PropriÃ©tÃ©s statiques ///
+         // bkp
          static xios_map<StdString,
                 xios_map<StdString,
@@ -104,5 +105,15 @@
 
          static xios_map< StdString, long int > GenId ;
-         //#pragma omp threadprivate(AllMapObj, AllVectObj, GenId)
+
+         // xios_map<StdString, xios_map<StdString, boost::shared_ptr<DerivedType> > > AllMapObj;
+         // xios_map<StdString, std::vector<boost::shared_ptr<DerivedType> > > AllVectObj;
+         // xios_map< StdString, long int > GenId ;
+
+         // static xios_map<StdString, xios_map<StdString, boost::shared_ptr<DerivedType> > > *AllMapObj_ptr;
+         // static xios_map<StdString, std::vector<boost::shared_ptr<DerivedType> > > *AllVectObj_ptr;
+         // static xios_map< StdString, long int > *GenId_ptr ;
+
+         // #pragma omp threadprivate(AllMapObj_ptr, AllVectObj_ptr, GenId_ptr)
+
 
    }; // class CObjectTemplate
Index: XIOS/dev/branch_yushan/src/server.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/server.cpp	(revision 1081)
+++ XIOS/dev/branch_yushan/src/server.cpp	(revision 1085)
@@ -9,5 +9,4 @@
 #include <boost/functional/hash.hpp>
 #include <boost/algorithm/string.hpp>
-//#include "mpi.hpp"
 #include "tracer.hpp"
 #include "timer.hpp"
Index: XIOS/dev/branch_yushan/src/test/test_omp.f90
===================================================================
--- XIOS/dev/branch_yushan/src/test/test_omp.f90	(revision 1081)
+++ XIOS/dev/branch_yushan/src/test/test_omp.f90	(revision 1085)
@@ -84,9 +84,19 @@
     print*, "xios init OK", rank, size
 
-      CALL xios_context_initialize("test",comm)
-      print*, "xios_context init OK", rank, size 
-
-!      CALL xios_context_finalize()
-!      print*, "xios_context finalize OK", rank, size
+    CALL xios_context_initialize("test",comm)
+
+    print*, "xios_context_initialize OK", rank, size
+
+    CALL xios_context_finalize()
+    print*, "xios_context_finalize OK", rank, size
+
+     !$omp master
+     call MPI_Barrier(comm)
+     CALL MPI_COMM_FREE(comm, ierr)
+     !$omp end master
+
+     !$omp barrier
+
+     print*, "MPI_COMM_FREE OK", rank, size
 
     CALL xios_finalize()
@@ -94,160 +104,83 @@
 
 
-    
-    !$omp barrier
-    !call MPI_Barrier(MPI_COMM_WORLD)
-    !$omp barrier
-
-    call MPI_Abort()
-
-    
-   
-    CALL xios_get_handle("test",ctx_hdl)
-    print*, "xios_get_handle OK", rank, size 
-   
-    CALL xios_set_current_context(ctx_hdl)
-    print*, "xios_set_current_context OK", rank, size 
- 
-    CALL xios_get_calendar_type(calendar_type)
-    print*, "xios_get_calendar_type OK", rank, size 
-    
-    
-    CALL xios_set_axis_attr("axis_A",n_glo=llm ,value=lval) ;
-    CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj,type='curvilinear')
-    CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4)
-    CALL xios_set_domain_attr("domain_A",lonvalue_2D=lon,latvalue_2D=lat)
-    CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.)
-
-    CALL xios_get_handle("field_definition",fieldgroup_hdl)
-    CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B")
-    CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B")
-
-    CALL xios_get_handle("output",file_hdl)
-    CALL xios_add_child(file_hdl,field_hdl)
-    CALL xios_set_attr(field_hdl,field_ref="field_A_zoom",name="field_C")
-  
-    dtime%second = 3600
-    CALL xios_set_timestep(dtime)
-    print*, "xios_set_timestep OK", rank, size 
-
-    CALL xios_get_time_origin(date)
-    
-    PRINT *, "--> year length = ", xios_get_year_length_in_seconds(date%year)
-    PRINT *, "--> day length = ", xios_get_day_length_in_seconds()
-    CALL xios_date_convert_to_string(date, date_str)
-    PRINT *, "time_origin = ", date_str
-    PRINT *, "xios_date_get_second_of_year(time_origin) = ", xios_date_get_second_of_year(date)
-    PRINT *, "xios_date_get_day_of_year(time_origin) = ", xios_date_get_day_of_year(date)
-    PRINT *, "xios_date_get_fraction_of_year(time_origin) = ", xios_date_get_fraction_of_year(date)
-    PRINT *, "xios_date_get_second_of_day(time_origin) = ", xios_date_get_second_of_day(date)
-    PRINT *, "xios_date_get_fraction_of_day(time_origin) = ", xios_date_get_fraction_of_day(date)
-    dtime%timestep = 1
-    dtime = 0.5 * dtime
-    CALL xios_duration_convert_to_string(dtime, dtime_str)
-    PRINT *, "duration = ", dtime_str
-    date = date + 3 * (dtime + dtime)
-    CALL xios_date_convert_to_string(date, date_str)
-    PRINT *, "date = time_origin + 3 * (duration + duration) = ", date_str
-    PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date)
-    PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour)
-
-    ni=0 ; lonvalue(:,:)=0;
-    CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue_2D=lonvalue)
-    print *,"ni",ni
-
-    CALL xios_is_defined_field_attr("field_A",enabled=ok)
-    PRINT *,"field_A : attribute enabled is defined ? ",ok
-
-
+  !$omp end parallel
+
+
+  
+!   CALL xios_context_initialize("test",comm)
+
+!   CALL xios_get_handle("test",ctx_hdl)
+!   CALL xios_set_current_context(ctx_hdl)
+  
+  
+!   CALL xios_get_calendar_type(calendar_type)
+
+!   CALL xios_set_axis_attr("axis_A",n_glo=llm ,value=lval) ;
+!   CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj,type='curvilinear')
+!   CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4)
+!   CALL xios_set_domain_attr("domain_A",lonvalue_2D=lon,latvalue_2D=lat)
+!   CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.)
+
+!   CALL xios_get_handle("field_definition",fieldgroup_hdl)
+!   CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B")
+!   CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B")
+
+!   CALL xios_get_handle("output",file_hdl)
+!   CALL xios_add_child(file_hdl,field_hdl)
+!   CALL xios_set_attr(field_hdl,field_ref="field_A_zoom",name="field_C")
+  
+!   dtime%second = 3600
+!   CALL xios_set_timestep(dtime)
+
+!   ! The calendar is created as soon as the calendar type is defined. This way
+!   ! calendar operations can be used before the context definition is closed
+!   CALL xios_get_time_origin(date)
+!   PRINT *, "--> year length = ", xios_get_year_length_in_seconds(date%year)
+!   PRINT *, "--> day length = ", xios_get_day_length_in_seconds()
+!   CALL xios_date_convert_to_string(date, date_str)
+!   PRINT *, "time_origin = ", date_str
+!   PRINT *, "xios_date_get_second_of_year(time_origin) = ", xios_date_get_second_of_year(date)
+!   PRINT *, "xios_date_get_day_of_year(time_origin) = ", xios_date_get_day_of_year(date)
+!   PRINT *, "xios_date_get_fraction_of_year(time_origin) = ", xios_date_get_fraction_of_year(date)
+!   PRINT *, "xios_date_get_second_of_day(time_origin) = ", xios_date_get_second_of_day(date)
+!   PRINT *, "xios_date_get_fraction_of_day(time_origin) = ", xios_date_get_fraction_of_day(date)
+!   dtime%timestep = 1
+!   dtime = 0.5 * dtime
+!   CALL xios_duration_convert_to_string(dtime, dtime_str)
+!   PRINT *, "duration = ", dtime_str
+!   date = date + 3 * (dtime + dtime)
+!   CALL xios_date_convert_to_string(date, date_str)
+!   PRINT *, "date = time_origin + 3 * (duration + duration) = ", date_str
+!   PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date)
+!   PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour)
+
+!   ni=0 ; lonvalue(:,:)=0;
+!   CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue_2D=lonvalue)
+!   print *,"ni",ni
+!   !print *,"lonvalue",lonvalue;
+
+!   CALL xios_is_defined_field_attr("field_A",enabled=ok)
+!   PRINT *,"field_A : attribute enabled is defined ? ",ok
+  
 !   CALL xios_close_context_definition()
-  
-!   print*, "xios_close_context_definition OK", rank, size 
-
-
-
-  !$omp end parallel
-
-  call MPI_Abort(ierr)
-
-  
-  CALL xios_context_initialize("test",comm)
-
-  CALL xios_get_handle("test",ctx_hdl)
-  CALL xios_set_current_context(ctx_hdl)
-  
-  
-  CALL xios_get_calendar_type(calendar_type)
-
-  CALL xios_set_axis_attr("axis_A",n_glo=llm ,value=lval) ;
-  CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj,type='curvilinear')
-  CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4)
-  CALL xios_set_domain_attr("domain_A",lonvalue_2D=lon,latvalue_2D=lat)
-  CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.)
-
-  CALL xios_get_handle("field_definition",fieldgroup_hdl)
-  CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B")
-  CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B")
-
-  CALL xios_get_handle("output",file_hdl)
-  CALL xios_add_child(file_hdl,field_hdl)
-  CALL xios_set_attr(field_hdl,field_ref="field_A_zoom",name="field_C")
-  
-  dtime%second = 3600
-  CALL xios_set_timestep(dtime)
-
-  ! The calendar is created as soon as the calendar type is defined. This way
-  ! calendar operations can be used before the context definition is closed
-  CALL xios_get_time_origin(date)
-  PRINT *, "--> year length = ", xios_get_year_length_in_seconds(date%year)
-  PRINT *, "--> day length = ", xios_get_day_length_in_seconds()
-  CALL xios_date_convert_to_string(date, date_str)
-  PRINT *, "time_origin = ", date_str
-  PRINT *, "xios_date_get_second_of_year(time_origin) = ", xios_date_get_second_of_year(date)
-  PRINT *, "xios_date_get_day_of_year(time_origin) = ", xios_date_get_day_of_year(date)
-  PRINT *, "xios_date_get_fraction_of_year(time_origin) = ", xios_date_get_fraction_of_year(date)
-  PRINT *, "xios_date_get_second_of_day(time_origin) = ", xios_date_get_second_of_day(date)
-  PRINT *, "xios_date_get_fraction_of_day(time_origin) = ", xios_date_get_fraction_of_day(date)
-  dtime%timestep = 1
-  dtime = 0.5 * dtime
-  CALL xios_duration_convert_to_string(dtime, dtime_str)
-  PRINT *, "duration = ", dtime_str
-  date = date + 3 * (dtime + dtime)
-  CALL xios_date_convert_to_string(date, date_str)
-  PRINT *, "date = time_origin + 3 * (duration + duration) = ", date_str
-  PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date)
-  PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour)
-
-  ni=0 ; lonvalue(:,:)=0;
-  CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue_2D=lonvalue)
-  print *,"ni",ni
-  !print *,"lonvalue",lonvalue;
-
-  CALL xios_is_defined_field_attr("field_A",enabled=ok)
-  PRINT *,"field_A : attribute enabled is defined ? ",ok
-  
-  CALL xios_close_context_definition()
-  print*, "xios_close_context_definition OK"  
-
-  PRINT*,"field field_A is active ? ",xios_field_is_active("field_A")
-
-
-  call MPI_Barrier(comm, ierr)
-
-  !DO ts=1,24*10
-  DO ts=1,6
-    CALL xios_update_calendar(ts)
-    CALL xios_send_field("field_A",field_A)
-    CALL wait_us(5000)
-  ENDDO
-  
-
-  CALL xios_context_finalize()
-
-  DEALLOCATE(lon, lat, field_A, lonvalue)
-
-  CALL MPI_COMM_FREE(comm, ierr)
-
-  CALL xios_finalize()
-  print *, "Client : xios_finalize "
+!   print*, "xios_close_context_definition OK"  
+
+!   PRINT*,"field field_A is active ? ",xios_field_is_active("field_A")
+
+
+!   call MPI_Barrier(comm, ierr)
+
+!   !DO ts=1,24*10
+!   DO ts=1,6
+!     CALL xios_update_calendar(ts)
+!     CALL xios_send_field("field_A",field_A)
+!     CALL wait_us(5000)
+!   ENDDO
+  
+
+!   CALL xios_context_finalize()
+
+!   DEALLOCATE(lon, lat, field_A, lonvalue)
+
 
     else
