Index: XIOS/dev/branch_yushan/bld.cfg
===================================================================
--- XIOS/dev/branch_yushan/bld.cfg	(revision 1077)
+++ XIOS/dev/branch_yushan/bld.cfg	(revision 1079)
@@ -33,5 +33,5 @@
 #bld::target libxios.a 
 #bld::target generate_fortran_interface.exe 
-#bld::target xios_server.exe 
+bld::target xios_server.exe 
 #bld::target test_remap.exe
 #bld::target test_new_features.exe test_unstruct_complete.exe 
Index: XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp
===================================================================
--- XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp	(revision 1077)
+++ XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp	(revision 1079)
@@ -26,5 +26,5 @@
     {
       fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm));
-      // printf("EP_Comm_c2f : MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm);
+      printf("EP_Comm_c2f : MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), comm.ep_comm_ptr);
     }
     
@@ -46,5 +46,5 @@
       MPI_Comm comm_ptr;
       comm_ptr = it->second;
-      // printf("EP_Comm_f2c : MAP find: %d, %d, %p\n", it->first.first, it->first.second, it->second);
+      printf("EP_Comm_f2c : MAP find: %d, %d, %p\n", it->first.first, it->first.second, comm_ptr.ep_comm_ptr);
       return  comm_ptr;
     }
Index: XIOS/dev/branch_yushan/src/client.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.cpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/client.cpp	(revision 1079)
@@ -38,6 +38,4 @@
 // localComm doesn't given
 
-        printf("check : localComm == MPI_COMM_NULL = %d\n", localComm == MPI_COMM_NULL);
-
         if (localComm == MPI_COMM_NULL)
         {
@@ -69,5 +67,5 @@
           MPI_Comm_rank(CXios::globalComm,&rank);
 
-          printf("client init : codeId = %s, xiosCodeId = %s, rank = %d(%d), size = %d\n", codeId, CXios::xiosCodeId, rank, omp_get_thread_num(), size);
+          printf("client init : rank = %d, size = %d\n", rank, size);
           
 
@@ -107,5 +105,5 @@
           if (CXios::usingServer)
           {
-            int clientLeader=leaders[hashClient] ;
+            //int clientLeader=leaders[hashClient] ;
             serverLeader=leaders[hashServer] ;
 
@@ -116,8 +114,20 @@
             {
               info(50)<<"intercommCreate::client "<<rank<<" intraCommSize : "<<intraCommSize
-                 <<" intraCommRank :"<<intraCommRank<<"  serverLeader "<< serverLeader<<endl ;  
+                 <<" intraCommRank :"<<intraCommRank<<"  serverLeader "<< serverLeader
+                 <<" globalComm : "<< &(CXios::globalComm) << endl ;  
             }
             
             MPI_Intercomm_create(intraComm,0,CXios::globalComm,serverLeader,0,&interComm) ;
+
+            int interCommSize, interCommRank ;
+            MPI_Comm_size(interComm,&interCommSize) ;
+            MPI_Comm_rank(interComm,&interCommRank) ;
+
+            #pragma omp critical(_output)
+            {
+              info(50)<<" interCommRank :"<<interCommRank
+                 <<" interCommSize : "<< interCommSize << endl ;  
+            }
+
 
           }
@@ -176,10 +186,17 @@
     void CClient::registerContext(const string& id,MPI_Comm contextComm)
     {
+      //info(50) << "Client "<<getRank() << " start registerContext using info output" << endl;
+      printf("Client %d start registerContext\n", getRank());
+      //printf("Client start registerContext\n");
+
       CContext::setCurrent(id) ;
-      CContext* context=CContext::create(id);
+      printf("Client %d CContext::setCurrent OK\n", getRank());
+      CContext* context = CContext::create(id);
+      printf("Client %d context=CContext::create(%s) OK\n", getRank(), id);
+      
       StdString idServer(id);
       idServer += "_server";
 
-      if (!CXios::isServer)
+      if (!CXios::isServer)  // server mode
       {      
         int size,rank,globalRank ;
@@ -211,5 +228,7 @@
 
         MPI_Intercomm_create(contextComm,0,CXios::globalComm,serverLeader,10+globalRank,&contextInterComm) ;
-        //info(10)<<"Register new Context : "<<id<<endl ;
+        
+        #pragma omp critical (_output)
+        info(10)<<"Register new Context : "<<id<<endl ;
                       
 
@@ -217,7 +236,12 @@
         MPI_Intercomm_merge(contextInterComm,0,&inter) ;
         MPI_Barrier(inter) ;
+
+        #pragma omp critical (_output)
+        printf("Client %d : MPI_Intercomm_merge OK \n", getRank()) ;
         
         
         context->initClient(contextComm,contextInterComm) ;
+        #pragma omp critical (_output)
+        printf("Client %d : context->initClient(contextComm,contextInterComm) OK \n", getRank()) ;
         
 
@@ -225,5 +249,5 @@
         MPI_Comm_free(&inter);
       }
-      else
+      else  // attached mode
       {
         MPI_Comm contextInterComm ;
Index: XIOS/dev/branch_yushan/src/client.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.hpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/client.hpp	(revision 1079)
@@ -25,8 +25,8 @@
 
         static int serverLeader;
-        #pragma omp threadprivate(serverLeader)
+        //#pragma omp threadprivate(serverLeader)
 
         static bool is_MPI_Initialized ;
-        #pragma omp threadprivate(is_MPI_Initialized)
+        //#pragma omp threadprivate(is_MPI_Initialized)
 
         //! Get rank of the current process
@@ -52,8 +52,8 @@
 
         static StdOFStream m_infoStream;
-        #pragma omp threadprivate(m_infoStream) 
+        //#pragma omp threadprivate(m_infoStream) 
 
         static StdOFStream m_errorStream;
-        #pragma omp threadprivate(m_errorStream)
+        //#pragma omp threadprivate(m_errorStream)
 
         static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb);
Index: XIOS/dev/branch_yushan/src/cxios.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/cxios.cpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/cxios.cpp	(revision 1079)
@@ -22,4 +22,5 @@
   bool CXios::isServer ;
   MPI_Comm CXios::globalComm ;
+  
   bool CXios::usingOasis ;
   bool CXios::usingServer = false;
@@ -72,5 +73,5 @@
     { 
       num_ep = omp_get_num_threads();
-      printf("Client %d: num_ep = %d\n", omp_get_thread_num(), num_ep);
+      //printf("Client %d: num_ep = %d\n", omp_get_thread_num(), num_ep);
     }
     
@@ -78,5 +79,5 @@
     { 
       num_ep = omp_get_num_threads();
-      printf("Server %d: num_ep = %d\n", omp_get_thread_num(), num_ep); 
+      //printf("Server %d: num_ep = %d\n", omp_get_thread_num(), num_ep); 
     }
     
@@ -90,11 +91,12 @@
     
     #pragma omp barrier
-      
-    globalComm = passage[omp_get_thread_num()];
-
-    int tmp_rank;
-    MPI_Comm_rank(globalComm, &tmp_rank);
-    if(isClient) printf("client thread %d/%d\n", omp_get_thread_num(), tmp_rank);
-    if(isServer) printf("server thread %d/%d\n", omp_get_thread_num(), tmp_rank);
+
+      
+    CXios::globalComm = passage[omp_get_thread_num()];
+
+    // int tmp_rank;
+    // MPI_Comm_rank(CXios::globalComm, &tmp_rank);
+    // if(isClient) printf("client thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &(CXios::globalComm));
+    //if(isServer) printf("server thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &globalComm);
     
   }
@@ -112,8 +114,5 @@
     initialize() ;
 
-
-
     CClient::initialize(codeId,localComm,returnComm) ;
-
 
     if (CClient::getRank()==0) globalRegistry = new CRegistry(returnComm) ;
Index: XIOS/dev/branch_yushan/src/cxios.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/cxios.hpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/cxios.hpp	(revision 1079)
@@ -44,8 +44,8 @@
 
      static bool isClient ; //!< Check if xios is client
-     #pragma omp threadprivate(isClient)
+     //#pragma omp threadprivate(isClient)
 
      static bool isServer ; //!< Check if xios is server
-     #pragma omp threadprivate(isServer)
+     //#pragma omp threadprivate(isServer)
 
      static MPI_Comm globalComm ; //!< Global communicator
@@ -53,26 +53,26 @@
 
      static bool printLogs2Files; //!< Printing out logs into files
-     #pragma omp threadprivate(printLogs2Files)
+     //#pragma omp threadprivate(printLogs2Files)
 
      static bool usingOasis ; //!< Using Oasis
-     #pragma omp threadprivate(usingOasis)
+     //#pragma omp threadprivate(usingOasis)
 
      static bool usingServer ; //!< Using server (server mode)
-     #pragma omp threadprivate(usingServer)
+     //#pragma omp threadprivate(usingServer)
 
      static double bufferSizeFactor; //!< Factor used to tune the buffer size
-     #pragma omp threadprivate(bufferSizeFactor)
+     //#pragma omp threadprivate(bufferSizeFactor)
 
      static const double defaultBufferSizeFactor; //!< Default factor value
-     #pragma omp threadprivate(defaultBufferSizeFactor)
+     //#pragma omp threadprivate(defaultBufferSizeFactor)
 
      static StdSize minBufferSize; //!< Minimum buffer size
-     #pragma omp threadprivate(minBufferSize)
+     //#pragma omp threadprivate(minBufferSize)
 
      static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible)
-     #pragma omp threadprivate(isOptPerformance)
+     //#pragma omp threadprivate(isOptPerformance)
 
      static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers
-     #pragma omp threadprivate(globalRegistry)
+     //#pragma omp threadprivate(globalRegistry)
 
     public:
Index: XIOS/dev/branch_yushan/src/indent_xml.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/indent_xml.cpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/indent_xml.cpp	(revision 1079)
@@ -15,5 +15,5 @@
    {
       static unsigned int LineNB = 1;
-      #pragma omp threadprivate(LineNB)
+      //#pragma omp threadprivate(LineNB)
       
       if (CIndent::WithLine) out << LineNB++ << ". ";
Index: XIOS/dev/branch_yushan/src/io/netCdf_cf_constant.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/netCdf_cf_constant.hpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/io/netCdf_cf_constant.hpp	(revision 1079)
@@ -16,7 +16,6 @@
   static const StdString XIOS_CF_coordinates;
   static const StdString XIOS_CF_bounds;
+};
 
-  #pragma omp threadprivate(XIOS_CF_units, XIOS_CF_standard_name, XIOS_CF_coordinates, XIOS_CF_bounds)
-};
 const StdString CCFKeywords::XIOS_CF_units("units");
 const StdString CCFKeywords::XIOS_CF_standard_name("standard_name");
Index: XIOS/dev/branch_yushan/src/node/context.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/context.cpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/node/context.cpp	(revision 1079)
@@ -240,4 +240,11 @@
      hasClient=true;
      client = new CContextClient(this,intraComm, interComm, cxtServer);
+
+     int tmp_rank;
+     MPI_Comm_rank(intraComm, &tmp_rank);
+     
+     #pragma omp critical (_output)
+     printf("Client %d : client = new CContextClient(this,intraComm, interComm, cxtServer) \n", tmp_rank) ;
+     
      registryIn=new CRegistry(intraComm);
      registryIn->setPath(getId()) ;
@@ -247,4 +254,6 @@
      registryOut=new CRegistry(intraComm) ;
      registryOut->setPath(getId()) ;
+     #pragma omp critical (_output)
+     printf("Client %d : registryOut->setPath(getId()) \n", tmp_rank) ;
 
      ep_lib::MPI_Comm intraCommServer, interCommServer;
Index: XIOS/dev/branch_yushan/src/parse_expr/lex_parser.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/parse_expr/lex_parser.cpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/parse_expr/lex_parser.cpp	(revision 1079)
@@ -264,5 +264,5 @@
 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
-#pragma omp threadprivate(yy_buffer_stack_top, yy_buffer_stack_max, yy_buffer_stack)
+//#pragma omp threadprivate(yy_buffer_stack_top, yy_buffer_stack_max, yy_buffer_stack)
 
 /* We provide macros for accessing buffer states in case in the
@@ -284,5 +284,5 @@
 static char yy_hold_char;
 static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
-#pragma omp threadprivate(yy_hold_char, yy_n_chars)
+//#pragma omp threadprivate(yy_hold_char, yy_n_chars)
 
 yy_size_t yyleng;
@@ -292,5 +292,5 @@
 static int yy_init = 0;		/* whether we need to initialize */
 static int yy_start = 0;	/* start state number */
-#pragma omp threadprivate(yy_c_buf_p, yy_init, yy_start)
+//#pragma omp threadprivate(yy_c_buf_p, yy_init, yy_start)
 
 /* Flag which is used to allow yywrap()'s to do buffer switches
@@ -298,5 +298,5 @@
  */
 static int yy_did_buffer_switch_on_eof;
-#pragma omp threadprivate(yy_did_buffer_switch_on_eof)
+//#pragma omp threadprivate(yy_did_buffer_switch_on_eof)
 
 void yyrestart (FILE *input_file  );
@@ -987,5 +987,5 @@
 
     } ;
-#pragma omp threadprivate(yy_nxt)
+//#pragma omp threadprivate(yy_nxt)
 
 static yy_state_type yy_get_previous_state (void );
@@ -1032,5 +1032,5 @@
     } ;
 
-#pragma omp threadprivate(yy_accept, yy_last_accepting_state, yy_last_accepting_cpos, yy_NUL_trans)
+//#pragma omp threadprivate(yy_accept, yy_last_accepting_state, yy_last_accepting_cpos, yy_NUL_trans)
 
 extern int yy_flex_debug;
Index: XIOS/dev/branch_yushan/src/server.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/server.cpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/server.cpp	(revision 1079)
@@ -268,11 +268,11 @@
        int flag = false ;
        static void* buffer ;
-       #pragma omp threadprivate(buffer)
+       //#pragma omp threadprivate(buffer)
 
        static MPI_Request request ;
-       #pragma omp threadprivate(request)
+       //#pragma omp threadprivate(request)
 
        static bool recept=false ;
-       #pragma omp threadprivate(recept)
+       //#pragma omp threadprivate(recept)
 
        int rank ;
@@ -370,11 +370,11 @@
        int flag ;
        static void* buffer ;
-       #pragma omp threadprivate(buffer)
+       //#pragma omp threadprivate(buffer)
 
        static MPI_Request request ;
-       #pragma omp threadprivate(request)
+       //#pragma omp threadprivate(request)
 
        static bool recept=false ;
-       #pragma omp threadprivate(recept)
+       //#pragma omp threadprivate(recept)
        
        int rank ;
@@ -432,5 +432,5 @@
        
 
-       CContext* context=CContext::create(contextId);
+       CContext* context = CContext::create(contextId);
        contextList[contextId]=context;
        context->initServer(intraComm,contextIntercomm);
Index: XIOS/dev/branch_yushan/src/test/test_client.f90
===================================================================
--- XIOS/dev/branch_yushan/src/test/test_client.f90	(revision 1077)
+++ XIOS/dev/branch_yushan/src/test/test_client.f90	(revision 1079)
@@ -37,6 +37,6 @@
   CALL init_wait
 
-  CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr)
-  if(rank < 2) then
+  !CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr)
+  !if(rank < 2) then
 
   
@@ -153,10 +153,10 @@
   print *, "Client : xios_finalize "
 
-   else
+!    else
 
-   CALL xios_init_server
-   print *, "Server : xios_finalize "
+!    CALL xios_init_server
+!    print *, "Server : xios_finalize "
   
-   endif
+!    endif
     
 
Index: XIOS/dev/branch_yushan/src/test/test_omp.f90
===================================================================
--- XIOS/dev/branch_yushan/src/test/test_omp.f90	(revision 1077)
+++ XIOS/dev/branch_yushan/src/test/test_omp.f90	(revision 1079)
@@ -79,7 +79,7 @@
   print*, "xios init OK", rank, size
 
-!   CALL xios_context_initialize("test",comm)
+   CALL xios_context_initialize("test",comm)
 
-!   print*, "xios_context init OK", rank, size 
+   print*, "xios_context init OK", rank, size 
 
   !CALL xios_context_finalize()
@@ -88,6 +88,9 @@
   !print*, "xios_context finalize OK", rank, size 
 
+
+
   !$omp end parallel
 
+  call MPI_Abort(ierr)
 
   
Index: XIOS/dev/branch_yushan/src/transformation/Functions/reduction.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/transformation/Functions/reduction.hpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/transformation/Functions/reduction.hpp	(revision 1079)
@@ -59,5 +59,5 @@
   typedef std::map<EReductionType, CreateOperationCallBack> CallBackMap;
   static CallBackMap* reductionCreationCallBacks_;
-  #pragma omp threadprivate(reductionCreationCallBacks_)
+  //#pragma omp threadprivate(reductionCreationCallBacks_)
 
   static bool registerOperation(EReductionType reduceType, CreateOperationCallBack createFn);
@@ -67,5 +67,5 @@
   static bool initReductionOperation(std::map<StdString,EReductionType>& m);
   static bool _dummyInit;
-  #pragma omp threadprivate(_dummyInit)
+  //#pragma omp threadprivate(_dummyInit)
 };
 
Index: XIOS/dev/branch_yushan/src/transformation/grid_transformation_factory_impl.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/transformation/grid_transformation_factory_impl.hpp	(revision 1077)
+++ XIOS/dev/branch_yushan/src/transformation/grid_transformation_factory_impl.hpp	(revision 1079)
@@ -57,10 +57,10 @@
   typedef std::map<ETranformationType, CreateTransformationCallBack> CallBackMap;
   static CallBackMap* transformationCreationCallBacks_;
-  #pragma omp threadprivate(transformationCreationCallBacks_)
+  //#pragma omp threadprivate(transformationCreationCallBacks_)
   
   static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn);
   static bool unregisterTransformation(ETranformationType transType);
   static bool initializeTransformation_;
-  #pragma omp threadprivate(initializeTransformation_)
+  //#pragma omp threadprivate(initializeTransformation_)
 };
 
