Index: XIOS/dev/branch_yushan/src/client.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.cpp	(revision 1079)
+++ XIOS/dev/branch_yushan/src/client.cpp	(revision 1080)
@@ -193,5 +193,5 @@
       printf("Client %d CContext::setCurrent OK\n", getRank());
       CContext* context = CContext::create(id);
-      printf("Client %d context=CContext::create(%s) OK\n", getRank(), id);
+      printf("Client %d context=CContext::create(%s) OK, *context = %p\n", getRank(), id, &(*context));
       
       StdString idServer(id);
@@ -254,5 +254,5 @@
         MPI_Comm_dup(contextComm,&contextInterComm) ;
         CContext* contextServer = CContext::create(idServer);
-
+        
         // Firstly, initialize context on client side
         context->initClient(contextComm,contextInterComm, contextServer);
Index: XIOS/dev/branch_yushan/src/client.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.hpp	(revision 1079)
+++ XIOS/dev/branch_yushan/src/client.hpp	(revision 1080)
@@ -23,4 +23,5 @@
         static std::list<MPI_Comm> contextInterComms;
         // #pragma omp threadprivate(contextInterComms)
+        //std::list<MPI_Comm> contextInterComms;
 
         static int serverLeader;
Index: XIOS/dev/branch_yushan/src/group_factory.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/group_factory.hpp	(revision 1079)
+++ XIOS/dev/branch_yushan/src/group_factory.hpp	(revision 1080)
@@ -70,4 +70,5 @@
          /// PropriÃ©tÃ©s statiques ///
          static StdString CurrContext;
+         //#pragma omp threadprivate(CurrContext)
 
    }; // class CGroupFactory
Index: XIOS/dev/branch_yushan/src/node/context.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/context.cpp	(revision 1079)
+++ XIOS/dev/branch_yushan/src/node/context.cpp	(revision 1080)
@@ -243,9 +243,15 @@
      int tmp_rank;
      MPI_Comm_rank(intraComm, &tmp_rank);
+     MPI_Barrier(intraComm);
      
-     #pragma omp critical (_output)
-     printf("Client %d : client = new CContextClient(this,intraComm, interComm, cxtServer) \n", tmp_rank) ;
+     
      
      registryIn=new CRegistry(intraComm);
+
+     #pragma omp critical (_output)
+     printf("Client %d : registryIn=new CRegistry(intraComm), &registryIn = %p, registryIn = %p \n", tmp_rank, &registryIn, registryIn) ;
+
+     // registryIn=new CRegistry;
+     // registryIn->communicator = intraComm;
      registryIn->setPath(getId()) ;
      if (client->clientRank==0) registryIn->fromFile("xios_registry.bin") ;
@@ -1185,22 +1191,48 @@
   \return pointer to the new context or already-existed one with identity id
   */
+   //bkp
+//   CContext* CContext::create(const StdString& id)
+//   {
+//     CContext::setCurrent(id);
+
+//     bool hasctxt = CContext::has(id);
+//     CContext* context = CObjectFactory::CreateObject<CContext>(id).get();
+//     getRoot();
+//     if (!hasctxt) CGroupFactory::AddChild(root, context->getShared());
+
+// #define DECLARE_NODE(Name_, name_) \
+//     C##Name_##Definition::create(C##Name_##Definition::GetDefName());
+// #define DECLARE_NODE_PAR(Name_, name_)
+// #include "node_type.conf"
+
+//     return (context);
+//   }
+
+
   CContext* CContext::create(const StdString& id)
   {
     CContext::setCurrent(id);
 
+
     bool hasctxt = CContext::has(id);
-    CContext* context = CObjectFactory::CreateObject<CContext>(id).get();
-    getRoot();
-    if (!hasctxt) CGroupFactory::AddChild(root, context->getShared());
+    CContext* context[omp_get_num_threads()];
+    for(int i=0; i<omp_get_num_threads(); i++)
+    {
+
+     context[i] = CObjectFactory::CreateObject<CContext>(id).get();
+     getRoot();
+     if (!hasctxt) CGroupFactory::AddChild(root, context[i]->getShared());
 
 #define DECLARE_NODE(Name_, name_) \
-    C##Name_##Definition::create(C##Name_##Definition::GetDefName());
+     C##Name_##Definition::create(C##Name_##Definition::GetDefName());
 #define DECLARE_NODE_PAR(Name_, name_)
 #include "node_type.conf"
-
-    return (context);
+    }
+    int tmp_rank;
+    MPI_Comm_rank(MPI_COMM_WORLD, &tmp_rank);
+    printf("CContext::create : num_threads = %d, my_id = %d, return add = %p\n", omp_get_num_threads(), tmp_rank, &(context[omp_get_thread_num()]));
+    
+    return (context[omp_get_thread_num()]);
   }
-
-
 
      //! Server side: Receive a message to do some post processing
Index: XIOS/dev/branch_yushan/src/node/context.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/context.hpp	(revision 1079)
+++ XIOS/dev/branch_yushan/src/node/context.hpp	(revision 1080)
@@ -21,5 +21,5 @@
 
 
-   /// ////////////////////// DÃ©clarations ////////////////////// ///
+   /// ////////////////////// Dclarations ////////////////////// ///
    class CContextGroup;
    class CContextAttributes;
@@ -224,4 +224,5 @@
          CRegistry* registryIn ;  //!< input registry which is read from file
          CRegistry* registryOut ; //!< output registry which will be wrote on file at the finalize
+         //#pragma omp threadprivate(registryIn, registryOut)
 
       private:
Index: XIOS/dev/branch_yushan/src/object_factory.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/object_factory.hpp	(revision 1079)
+++ XIOS/dev/branch_yushan/src/object_factory.hpp	(revision 1080)
@@ -60,4 +60,5 @@
          /// PropriÃ©tÃ©s statiques ///
          static StdString CurrContext;
+         //#pragma omp threadprivate(CurrContext)
 
    }; // class CObjectFactory
Index: XIOS/dev/branch_yushan/src/registry.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/registry.hpp	(revision 1079)
+++ XIOS/dev/branch_yushan/src/registry.hpp	(revision 1080)
@@ -28,5 +28,9 @@
 /** Constructor, the communicator is used for bcast or gather operation between MPI processes */
      
-      CRegistry(const ep_lib::MPI_Comm& comm=MPI_COMM_WORLD) : communicator(comm) {}
+      //CRegistry(const ep_lib::MPI_Comm& comm=MPI_COMM_WORLD) : communicator(comm) {}
+      CRegistry(const ep_lib::MPI_Comm& comm=MPI_COMM_WORLD)
+      {
+        communicator = comm;
+      }
       
      
Index: XIOS/dev/branch_yushan/src/test/test_omp.f90
===================================================================
--- XIOS/dev/branch_yushan/src/test/test_omp.f90	(revision 1079)
+++ XIOS/dev/branch_yushan/src/test/test_omp.f90	(revision 1080)
@@ -36,4 +36,6 @@
 
   CALL MPI_INIT_THREAD(3, provided, ierr)
+  print*, "provided = ", provided
+  
   CALL init_wait
 
@@ -79,11 +81,18 @@
   print*, "xios init OK", rank, size
 
+
    CALL xios_context_initialize("test",comm)
-
    print*, "xios_context init OK", rank, size 
-
-  !CALL xios_context_finalize()
-
-  
+   
+    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_context_finalize()  
   !print*, "xios_context finalize OK", rank, size 
 
@@ -175,10 +184,10 @@
   print *, "Client : xios_finalize "
 
-   else
-
-   CALL xios_init_server
-   print *, "Server : xios_finalize "
-  
-   endif
+    else
+
+    CALL xios_init_server
+    print *, "Server : xios_finalize "
+  
+    endif
     
 
Index: XIOS/dev/branch_yushan/src/xml_parser.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/xml_parser.cpp	(revision 1079)
+++ XIOS/dev/branch_yushan/src/xml_parser.cpp	(revision 1080)
@@ -11,5 +11,5 @@
    namespace xml
    {
-      /// ////////////////////// DÃ©finitions ////////////////////// ///
+      /// ////////////////////// Dfinitions ////////////////////// ///
 
       void CXMLParser::ParseFile(const StdString & filename, const std::set<StdString>& parseContextList)
