Index: XIOS/dev/branch_yushan/bld.cfg
===================================================================
--- XIOS/dev/branch_yushan/bld.cfg	(revision 1071)
+++ XIOS/dev/branch_yushan/bld.cfg	(revision 1072)
@@ -33,8 +33,8 @@
 #bld::target libxios.a 
 #bld::target generate_fortran_interface.exe 
-bld::target xios_server.exe 
-#test_remap.exe
+#bld::target xios_server.exe 
+#bld::target test_remap.exe
 #bld::target test_new_features.exe test_unstruct_complete.exe 
-bld::target test_client.exe test_complete.exe
+bld::target test_omp.exe #test_complete.exe test_client.exe
 bld::exe_dep
 
@@ -63,2 +63,3 @@
 bld::excl_dep        use::netcdf
 bld::excl_dep        inc::mpif.h
+bld::excl_dep        use::omp_lib
Index: XIOS/dev/branch_yushan/extern/remap/src/clipper.cpp
===================================================================
--- XIOS/dev/branch_yushan/extern/remap/src/clipper.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/extern/remap/src/clipper.cpp	(revision 1072)
@@ -52,11 +52,19 @@
 
 static double const pi = 3.141592653589793238;
+#pragma omp threadprivate(pi)
+
 static double const two_pi = pi *2;
+#pragma omp threadprivate(two_pi)
+
 static double const def_arc_tolerance = 0.25;
+#pragma omp threadprivate(def_arc_tolerance)
 
 enum Direction { dRightToLeft, dLeftToRight };
 
 static int const Unassigned = -1;  //edge not currently 'owning' a solution
+#pragma omp threadprivate(Unassigned)
+
 static int const Skip = -2;        //edge that would otherwise close a path
+#pragma omp threadprivate(Skip)
 
 #define HORIZONTAL (-1.0E+40)
Index: XIOS/dev/branch_yushan/extern/remap/src/clipper.hpp
===================================================================
--- XIOS/dev/branch_yushan/extern/remap/src/clipper.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/extern/remap/src/clipper.hpp	(revision 1072)
@@ -73,9 +73,17 @@
   typedef int cInt;
   static cInt const loRange = 0x7FFF;
+  #pragma omp threadprivate(loRange)
+
   static cInt const hiRange = 0x7FFF;
+  #pragma omp threadprivate(hiRange)
+
 #else
   typedef signed long long cInt;
   static cInt const loRange = 0x3FFFFFFF;
+  #pragma omp threadprivate(loRange)
+
   static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL;
+  #pragma omp threadprivate(hiRange)
+  
   typedef signed long long long64;     //used by Int128 class
   typedef unsigned long long ulong64;
Index: XIOS/dev/branch_yushan/extern/remap/src/inside.cpp
===================================================================
--- XIOS/dev/branch_yushan/extern/remap/src/inside.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/extern/remap/src/inside.cpp	(revision 1072)
@@ -11,4 +11,5 @@
 
 static const double SNAP = 1e-11;
+#pragma omp threadprivate(SNAP)
 
 using namespace std;
Index: XIOS/dev/branch_yushan/extern/remap/src/parallel_tree.cpp
===================================================================
--- XIOS/dev/branch_yushan/extern/remap/src/parallel_tree.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/extern/remap/src/parallel_tree.cpp	(revision 1072)
@@ -16,4 +16,5 @@
 
 static const int assignLevel = 2;
+#pragma omp threadprivate(assignLevel)
 
 // only the circle is packed, rest of node will be initialized on unpacking
Index: XIOS/dev/branch_yushan/extern/remap/src/timerRemap.hpp
===================================================================
--- XIOS/dev/branch_yushan/extern/remap/src/timerRemap.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/extern/remap/src/timerRemap.hpp	(revision 1072)
@@ -27,4 +27,6 @@
     void print(void);
     static map<string,CTimer*> allTimer;
+    //#pragma omp threadprivate(allTimer)
+
     static double getTime(void);
     static CTimer& get(string name);
Index: XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp
===================================================================
--- XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp	(revision 1072)
@@ -19,4 +19,5 @@
     fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm));
     #endif
+    
     std::map<std::pair<int, int>, MPI_Comm > ::iterator it;
     
@@ -50,14 +51,14 @@
     else
     {      
-      MPI_Comm return_comm;
-      if(omp_get_thread_num() == 0)
+      
+      #ifdef _openmpi
+      ::MPI_Comm base_comm = ::MPI_Comm_f2c(comm);
+      #elif _intelmpi
+      ::MPI_Comm base_comm = (::MPI_Comm)(comm);
+      #endif
+
+      if(base_comm != MPI_COMM_NULL_STD)
       {
-        #ifdef _openmpi
-        ::MPI_Comm base_comm = ::MPI_Comm_f2c(comm);
-        #elif _intelmpi
-        ::MPI_Comm base_comm = (::MPI_Comm)(comm);
-        #endif
-
-        if(base_comm != MPI_COMM_NULL_STD)
+        if(omp_get_thread_num() == 0)
         {
           int num_ep = omp_get_num_threads();
@@ -65,11 +66,14 @@
           MPI_Info info;
           MPI_Comm_create_endpoints(base_comm, num_ep, info, new_comm);
-          return_comm = new_comm[omp_get_thread_num()];
+          passage = new_comm;
         }
-        return MPI_COMM_NULL;
+        #pragma omp barrier
+
+        MPI_Comm return_comm = passage[omp_get_thread_num()];
+        return return_comm;
+        
       }
+      return MPI_COMM_NULL;
       
-      
-      return return_comm;
     }
   }
Index: XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_kernel.cpp
===================================================================
--- XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_kernel.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_kernel.cpp	(revision 1072)
@@ -420,5 +420,4 @@
             *newintercomm =  iter->second[my_position];
             found = true;
-            tag_list.erase(iter);
             break;
           }
@@ -428,15 +427,15 @@
 
     MPI_Barrier_local(local_comm);
-    // if(is_proc_master)
-    // {
-    //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++)
-    //   {
-    //     if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1])))
-    //     {
-    //       tag_list.erase(iter);
-    //       break;
-    //     }
-    //   }
-    // }
+    if(is_proc_master)
+    {
+      for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++)
+      {
+        if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1])))
+        {
+          tag_list.erase(iter);
+          break;
+        }
+      }
+    }
 
     int intercomm_ep_rank, intercomm_ep_rank_loc, intercomm_mpi_rank;
@@ -687,21 +686,24 @@
             *newintercomm =  iter->second[my_position];
             found = true;
+            // tag_list.erase(iter);
+            break;
+          }
+        }
+      }
+    }
+
+    MPI_Barrier_local(local_comm);
+
+    if(leader_rank_in_peer[0] < leader_rank_in_peer[1])
+    {
+      for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++)
+        {
+          if((*iter).first == make_pair(tag_label[0], tag_label[1]))
+          {
             tag_list.erase(iter);
             break;
           }
         }
-      }
-    }
-
-    // if(leader_rank_in_peer[0] < leader_rank_in_peer[1])
-    // {
-    //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++)
-    //     {
-    //       if((*iter).first == make_pair(tag_label[0], tag_label[1]))
-    //       {
-    //         tag_list.erase(iter);
-    //       }
-    //     }
-    // }
+    }
 
 
Index: XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_world.cpp
===================================================================
--- XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_world.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_world.cpp	(revision 1072)
@@ -417,5 +417,5 @@
 
             found = true;
-            tag_list.erase(iter);
+            //tag_list.erase(iter);
             break;
           }
@@ -426,14 +426,15 @@
     MPI_Barrier_local(local_comm);
 
-    // if(is_proc_master)
-    // {
-    //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++)
-    //   {
-    //     if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1])))
-    //     {
-    //       tag_list.erase(iter);
-    //     }
-    //   }
-    // }
+    if(is_proc_master)
+    {
+      for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++)
+      {
+        if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1])))
+        {
+          tag_list.erase(iter);
+          break;
+        }
+      }
+    }
 
     
@@ -934,5 +935,5 @@
 
             found = true;
-            tag_list.erase(iter);
+            //tag_list.erase(iter);
             break;
           }
@@ -943,14 +944,15 @@
     MPI_Barrier_local(local_comm);
 
-    // if(is_proc_master)
-    // {
-    //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++)
-    //   {
-    //     if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1])))
-    //     {
-    //       tag_list.erase(iter);
-    //     }
-    //   }
-    // }
+    if(is_proc_master)
+    {
+      for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++)
+      {
+        if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1])))
+        {
+          tag_list.erase(iter);
+          break;
+        }
+      }
+    }
 
     int intercomm_ep_rank, intercomm_ep_rank_loc, intercomm_mpi_rank;
Index: XIOS/dev/branch_yushan/src/attribute_map.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/attribute_map.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/attribute_map.hpp	(revision 1072)
@@ -69,4 +69,5 @@
             /// PropriÃ©tÃ© statique ///
             static CAttributeMap * Current;
+            //#pragma omp threadprivate (Current)
 
       };  // class CAttributeMap
Index: XIOS/dev/branch_yushan/src/buffer_client.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/buffer_client.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/buffer_client.hpp	(revision 1072)
@@ -16,4 +16,5 @@
     public:
       static size_t maxRequestSize;
+      //#pragma omp threadprivate(maxRequestSize)
 
       CClientBuffer(MPI_Comm intercomm, int serverRank, StdSize bufferSize, StdSize maxBufferedEvents);
Index: XIOS/dev/branch_yushan/src/client.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/client.cpp	(revision 1072)
@@ -39,5 +39,8 @@
           if (!is_MPI_Initialized)
           {
-            MPI_Init(NULL, NULL);
+            //MPI_Init(NULL, NULL);
+            int return_level;
+            MPI_Init_thread(NULL, NULL, 3, &return_level);
+            assert(return_level == 3);
           }
           CTimer::get("XIOS").resume() ;
@@ -46,5 +49,6 @@
 
           unsigned long hashClient=hashString(codeId) ;
-          unsigned long hashServer=hashString(CXios::xiosCodeId) ;
+          unsigned long hashServer; //=hashString(CXios::xiosCodeId) ;
+          hashServer=hashString("xios.x") ;
           unsigned long* hashAll ;
           int size ;
@@ -96,7 +100,12 @@
             MPI_Comm_size(intraComm,&intraCommSize) ;
             MPI_Comm_rank(intraComm,&intraCommRank) ;
-            info(50)<<"intercommCreate::client "<<rank<<" intraCommSize : "<<intraCommSize
-                 <<" intraCommRank :"<<intraCommRank<<"  serverLeader "<< serverLeader<<endl ;
+            #pragma omp critical(_output)
+            {
+              info(50)<<"intercommCreate::client "<<rank<<" intraCommSize : "<<intraCommSize
+                 <<" intraCommRank :"<<intraCommRank<<"  serverLeader "<< serverLeader<<endl ;  
+            }
+            
             MPI_Intercomm_create(intraComm,0,CXios::globalComm,serverLeader,0,&interComm) ;
+
           }
           else
@@ -289,8 +298,13 @@
 
       fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << getRank() << ext;
-      fb->open(fileNameClient.str().c_str(), std::ios::out);
-      if (!fb->is_open())
-        ERROR("void CClient::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)",
-              << std::endl << "Can not open <" << fileNameClient << "> file to write the client log(s).");
+      printf("getrank() = %d, file name = %s\n", getRank(), fileNameClient.str().c_str());
+      #pragma omp critical(_output)
+      {
+        fb->open(fileNameClient.str().c_str(), std::ios::out);
+        if (!fb->is_open())
+          ERROR("void CClient::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)",
+              << std::endl << "Can not open <" << fileNameClient << "> file to write the client log(s).");  
+      }
+      
     }
 
Index: XIOS/dev/branch_yushan/src/client.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/client.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/client.hpp	(revision 1072)
@@ -19,8 +19,17 @@
 
         static MPI_Comm intraComm;
+        #pragma omp threadprivate(intraComm)
+
         static MPI_Comm interComm;
+        #pragma omp threadprivate(interComm)
+
         static std::list<MPI_Comm> contextInterComms;
+        // #pragma omp threadprivate(contextInterComms)
+
         static int serverLeader;
+        #pragma omp threadprivate(serverLeader)
+
         static bool is_MPI_Initialized ;
+        #pragma omp threadprivate(is_MPI_Initialized)
 
         //! Get rank of the current process
@@ -43,6 +52,11 @@
       protected:
         static int rank;
+        #pragma omp threadprivate(rank)
+
         static StdOFStream m_infoStream;
+        #pragma omp threadprivate(m_infoStream) 
+
         static StdOFStream 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 1071)
+++ XIOS/dev/branch_yushan/src/cxios.cpp	(revision 1072)
@@ -22,4 +22,6 @@
   bool CXios::isServer ;
   MPI_Comm CXios::globalComm ;
+  // #pragma omp threadprivate(CXios::globalComm)
+
   bool CXios::usingOasis ;
   bool CXios::usingServer = false;
@@ -35,5 +37,9 @@
   {    
     set_new_handler(noMemory);
-    parseFile(rootFile);
+    //#pragma omp critical(_output)
+    #pragma omp master
+    {
+      parseFile(rootFile);  
+    }
     parseXiosConfig();
   }
@@ -45,4 +51,5 @@
   void CXios::parseXiosConfig()
   {
+
     usingOasis=getin<bool>("using_oasis",false) ;
     usingServer=getin<bool>("using_server",false) ;
@@ -63,20 +70,22 @@
     bufferSizeFactor = getin<double>("buffer_size_factor", defaultBufferSizeFactor);
     minBufferSize = getin<int>("min_buffer_size", 1024 * sizeof(double));
-
+ 
     int num_ep;
-    if(isClient) 
+    if(isClient)  
     { 
-      num_ep = 1;
+      num_ep = omp_get_num_threads();
+      printf("Client %d: num_ep = %d\n", omp_get_thread_num(), num_ep);
     }
     
     if(isServer) 
     { 
-      num_ep = 1; 
+      num_ep = omp_get_num_threads();
+      printf("Server %d: num_ep = %d\n", omp_get_thread_num(), num_ep); 
     }
     
     MPI_Info info;
-    MPI_Comm *ep_comm;
-    if(omp_get_thread_num()==0)
-    {
+    #pragma omp master
+    {
+      MPI_Comm *ep_comm;
       MPI_Comm_create_endpoints(MPI_COMM_WORLD, num_ep, info, ep_comm);  // servers should reach here too.
       passage = ep_comm;  
@@ -86,4 +95,9 @@
       
     globalComm = passage[omp_get_thread_num()];
+
+    int tmp_rank;
+    MPI_Comm_rank(MPI_COMM_WORLD, &tmp_rank);
+    if(isClient) printf("client thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &passage[omp_get_thread_num()]);
+    if(isServer) printf("server thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &passage[omp_get_thread_num()]);
     
   }
Index: XIOS/dev/branch_yushan/src/cxios.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/cxios.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/cxios.hpp	(revision 1072)
@@ -32,21 +32,47 @@
     public:
      static string rootFile ; //!< Configuration filename
+     //#pragma omp threadprivate(rootFile)
+
      static string xiosCodeId ; //!< Identity for XIOS
+     //#pragma omp threadprivate(xiosCodeId)
+
      static string clientFile; //!< Filename template for client
+     //#pragma omp threadprivate(clientFile)
+
      static string serverFile; //!< Filename template for server
+     //#pragma omp threadprivate(serverFile)
 
      static bool isClient ; //!< Check if xios is client
+     //#pragma omp threadprivate(isClient)
+
      static bool isServer ; //!< Check if xios is server
+     //#pragma omp threadprivate(isServer)
 
      static MPI_Comm globalComm ; //!< Global communicator
+     #pragma omp threadprivate(globalComm)
 
      static bool printLogs2Files; //!< Printing out logs into files
+     //#pragma omp threadprivate(printLogs2Files)
+
      static bool usingOasis ; //!< Using Oasis
+     //#pragma omp threadprivate(usingOasis)
+
      static bool usingServer ; //!< Using server (server mode)
+     //#pragma omp threadprivate(usingServer)
+
      static double bufferSizeFactor; //!< Factor used to tune the buffer size
+     //#pragma omp threadprivate(bufferSizeFactor)
+
      static const double defaultBufferSizeFactor; //!< Default factor value
+     //#pragma omp threadprivate(defaultBufferSizeFactor)
+
      static StdSize minBufferSize; //!< Minimum buffer size
+     //#pragma omp threadprivate(minBufferSize)
+
      static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible)
+     //#pragma omp threadprivate(isOptPerformance)
+
      static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers
+     //#pragma omp threadprivate(globalRegistry)
 
     public:
Index: XIOS/dev/branch_yushan/src/event_client.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/event_client.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/event_client.hpp	(revision 1072)
@@ -12,4 +12,5 @@
     public:
       static const size_t headerSize;
+      //#pragma omp threadprivate(headerSize)
 
       CEventClient(int classId, int typeId);
Index: XIOS/dev/branch_yushan/src/filter/spatial_transform_filter.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/filter/spatial_transform_filter.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/filter/spatial_transform_filter.hpp	(revision 1072)
@@ -103,4 +103,6 @@
       //! The allocated engines
       static std::map<CGridTransformation*, boost::shared_ptr<CSpatialTransformFilterEngine> > engines;
+      // #pragma omp threadprivate(engines)
+      
   }; // class CSpatialTransformFilterEngine
 } // namespace xios
Index: XIOS/dev/branch_yushan/src/indent.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/indent.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/indent.hpp	(revision 1072)
@@ -10,5 +10,9 @@
     public:
     static int defaultIncSize;
+    //#pragma omp threadprivate(defaultIncSize)
+    
     static int index ;
+    //#pragma omp threadprivate(index)
+    
     int incSize ;
     int offset ;
Index: XIOS/dev/branch_yushan/src/indent_xml.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/indent_xml.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/indent_xml.cpp	(revision 1072)
@@ -15,4 +15,6 @@
    {
       static unsigned int LineNB = 1;
+      #pragma omp threadprivate(LineNB)
+      
       if (CIndent::WithLine) out << LineNB++ << ". ";
       for(unsigned int i = 0; i < CIndent::Indent; out << CIndent::Increm , i++){}
Index: XIOS/dev/branch_yushan/src/indent_xml.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/indent_xml.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/indent_xml.hpp	(revision 1072)
@@ -22,6 +22,11 @@
          /// PropriÃ©tÃ©s  statiques ///
          static unsigned int Indent;
+         //#pragma omp threadprivate(Indent)
+
          static StdString    Increm;
+         //#pragma omp threadprivate(Increm)
+
          static bool         WithLine;
+         //#pragma omp threadprivate(WithLine)
 
    }; // class CIndent
Index: XIOS/dev/branch_yushan/src/interface/c/icdata.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/interface/c/icdata.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/interface/c/icdata.cpp	(revision 1072)
@@ -71,5 +71,5 @@
       else local_comm = MPI_COMM_NULL;
       #endif
-     
+      
 
       CXios::initClientSide(str, local_comm, return_comm);
Index: XIOS/dev/branch_yushan/src/io/netCdf_cf_constant.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/io/netCdf_cf_constant.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/io/netCdf_cf_constant.hpp	(revision 1072)
@@ -16,4 +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");
@@ -27,4 +29,6 @@
   static const std::set<StdString> XIOS_CF_Longitude_units;
 
+  // #pragma omp threadprivate(XIOS_CF_Latitude_units, XIOS_CF_Longitude_units)
+
 private:
   CCFConvention();
Index: XIOS/dev/branch_yushan/src/memtrack.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/memtrack.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/memtrack.cpp	(revision 1072)
@@ -68,4 +68,5 @@
         private:    // static member variables
             static BlockHeader *ourFirstNode;
+            //#pragma omp threadprivate(ourFirstNode)
     
         private:    // member variables
@@ -244,4 +245,6 @@
             static const unsigned int SIGNATURE1 = 0xCAFEBABE;
             static const unsigned int SIGNATURE2 = 0xFACEFACE;
+
+            //#pragma omp threadprivate(SIGNATURE1, SIGNATURE2)
         
         private:    // member variables
Index: XIOS/dev/branch_yushan/src/mpi.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/mpi.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/mpi.hpp	(revision 1072)
@@ -12,4 +12,5 @@
 
 #ifdef _usingEP
+  #include <omp.h>
   #include "../extern/src_ep_dev/ep_lib.hpp"
   using namespace ep_lib;
Index: XIOS/dev/branch_yushan/src/node/axis.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/axis.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/axis.hpp	(revision 1072)
@@ -167,5 +167,8 @@
          static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
          static std::map<StdString, ETranformationType> transformationMapList_;
+         // #pragma omp threadprivate(transformationMapList_)
+
          static bool dummyTransformationMapList_;
+         //#pragma omp threadprivate(dummyTransformationMapList_)
 
          DECLARE_REF_FUNC(Axis,axis)
Index: XIOS/dev/branch_yushan/src/node/compute_connectivity_domain.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/compute_connectivity_domain.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/compute_connectivity_domain.hpp	(revision 1072)
@@ -60,4 +60,6 @@
       static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
+      
   }; // class CComputeConnectivityDomain
 
Index: XIOS/dev/branch_yushan/src/node/context.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/context.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/context.hpp	(revision 1072)
@@ -209,4 +209,5 @@
          // Context root
          static shared_ptr<CContextGroup> root;
+         // #pragma omp threadprivate(root)
 
          // Determine context on client or not
Index: XIOS/dev/branch_yushan/src/node/domain.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/domain.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/domain.hpp	(revision 1072)
@@ -213,4 +213,5 @@
          static std::map<StdString, ETranformationType> transformationMapList_;
          static bool _dummyTransformationMapList;
+         //#pragma omp threadprivate(_dummyTransformationMapList)
 
          DECLARE_REF_FUNC(Domain,domain)
Index: XIOS/dev/branch_yushan/src/node/expand_domain.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/expand_domain.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/expand_domain.hpp	(revision 1072)
@@ -60,4 +60,6 @@
       static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
+      
   }; // class CExpandDomain
 
Index: XIOS/dev/branch_yushan/src/node/extract_axis_to_scalar.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/extract_axis_to_scalar.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/extract_axis_to_scalar.hpp	(revision 1072)
@@ -60,4 +60,5 @@
       static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
   }; // class CExtractAxisToScalar
 
Index: XIOS/dev/branch_yushan/src/node/extract_domain_to_axis.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/extract_domain_to_axis.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/extract_domain_to_axis.hpp	(revision 1072)
@@ -60,4 +60,5 @@
       static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
   }; // class CExtractDomainToAxis
 
Index: XIOS/dev/branch_yushan/src/node/generate_rectilinear_domain.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/generate_rectilinear_domain.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/generate_rectilinear_domain.hpp	(revision 1072)
@@ -60,4 +60,5 @@
       static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
   }; // class CGenerateRectilinearDomain
 
Index: XIOS/dev/branch_yushan/src/node/interpolate_axis.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/interpolate_axis.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/interpolate_axis.hpp	(revision 1072)
@@ -62,4 +62,6 @@
       static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
+      
   }; // class CInterpolateAxis
 
Index: XIOS/dev/branch_yushan/src/node/interpolate_domain.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/interpolate_domain.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/interpolate_domain.hpp	(revision 1072)
@@ -60,4 +60,5 @@
       static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
   }; // class CInterpolateDomain
 
Index: XIOS/dev/branch_yushan/src/node/inverse_axis.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/inverse_axis.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/inverse_axis.hpp	(revision 1072)
@@ -59,4 +59,5 @@
       static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
 
   }; // class CInverseAxis
Index: XIOS/dev/branch_yushan/src/node/reduce_axis_to_scalar.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/reduce_axis_to_scalar.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/reduce_axis_to_scalar.hpp	(revision 1072)
@@ -59,4 +59,5 @@
       static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
   }; // class CReduceAxisToScalar
 
Index: XIOS/dev/branch_yushan/src/node/reduce_domain_to_axis.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/reduce_domain_to_axis.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/reduce_domain_to_axis.hpp	(revision 1072)
@@ -60,4 +60,5 @@
       static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
   }; // class CReduceDomainToAxis
 
Index: XIOS/dev/branch_yushan/src/node/reduce_domain_to_scalar.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/reduce_domain_to_scalar.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/reduce_domain_to_scalar.hpp	(revision 1072)
@@ -60,4 +60,5 @@
       static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
   }; // class CReduceDomainToScalar
 
Index: XIOS/dev/branch_yushan/src/node/scalar.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/scalar.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/scalar.hpp	(revision 1072)
@@ -89,4 +89,5 @@
            static std::map<StdString, ETranformationType> transformationMapList_;
            static bool dummyTransformationMapList_;
+           //#pragma omp threadprivate(dummyTransformationMapList_)
 
 
Index: XIOS/dev/branch_yushan/src/node/transformation.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/transformation.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/transformation.hpp	(revision 1072)
@@ -35,4 +35,5 @@
       typedef std::map<ETranformationType, CreateTransformationCallBack> CallBackMap;
       static CallBackMap* transformationCreationCallBacks_;
+      //#pragma omp threadprivate(transformationCreationCallBacks_)
 
       static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn);
Index: XIOS/dev/branch_yushan/src/node/zoom_axis.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/zoom_axis.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/zoom_axis.hpp	(revision 1072)
@@ -60,4 +60,5 @@
       static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
   }; // class CZoomAxis
 
Index: XIOS/dev/branch_yushan/src/node/zoom_domain.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/node/zoom_domain.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/node/zoom_domain.hpp	(revision 1072)
@@ -60,4 +60,6 @@
       static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node);
       static bool _dummyRegistered;
+      //#pragma omp threadprivate(_dummyRegistered)
+      
   }; // class CZoomDomain
 
Index: XIOS/dev/branch_yushan/src/parse_expr/lex_parser.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/parse_expr/lex_parser.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/parse_expr/lex_parser.cpp	(revision 1072)
@@ -264,4 +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)
 
 /* We provide macros for accessing buffer states in case in the
@@ -283,4 +284,6 @@
 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)
+
 yy_size_t yyleng;
 
@@ -289,4 +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)
 
 /* Flag which is used to allow yywrap()'s to do buffer switches
@@ -294,4 +298,5 @@
  */
 static int yy_did_buffer_switch_on_eof;
+#pragma omp threadprivate(yy_did_buffer_switch_on_eof)
 
 void yyrestart (FILE *input_file  );
@@ -982,4 +987,5 @@
 
     } ;
+#pragma omp threadprivate(yy_nxt)
 
 static yy_state_type yy_get_previous_state (void );
@@ -1025,4 +1031,6 @@
         0,    0,    0,    0,    0
     } ;
+
+#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 1071)
+++ XIOS/dev/branch_yushan/src/server.cpp	(revision 1072)
@@ -268,6 +268,12 @@
        int flag = false ;
        static void* buffer ;
+       #pragma omp threadprivate(buffer)
+
        static MPI_Request request ;
+       #pragma omp threadprivate(request)
+
        static bool recept=false ;
+       #pragma omp threadprivate(recept)
+
        int rank ;
        int count ; 
@@ -364,6 +370,12 @@
        int flag ;
        static void* buffer ;
+       #pragma omp threadprivate(buffer)
+
        static MPI_Request request ;
+       #pragma omp threadprivate(request)
+
        static bool recept=false ;
+       #pragma omp threadprivate(recept)
+       
        int rank ;
        int count ;
Index: XIOS/dev/branch_yushan/src/server.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/server.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/server.hpp	(revision 1072)
@@ -29,7 +29,12 @@
 
         static MPI_Comm intraComm;
+        //#pragma omp threadprivate(intraComm)
+
         static list<MPI_Comm> interComm;
+        //#pragma omp threadprivate(interComm)
+
         static std::list<MPI_Comm> contextInterComms;
         static CEventScheduler* eventScheduler;
+        //#pragma omp threadprivate(eventScheduler)
         
         struct contextMessage
@@ -40,8 +45,12 @@
 
         static bool isRoot;
+        //#pragma omp threadprivate(isRoot)
 
         static map<string,CContext*> contextList;
         static bool finished;
+        //#pragma omp threadprivate(finished)
+
         static bool is_MPI_Initialized;
+        //#pragma omp threadprivate(is_MPI_Initialized)
 
       public:
@@ -65,6 +74,11 @@
       private:
         static int rank;
+        //#pragma omp threadprivate(rank)
+
         static StdOFStream m_infoStream;
+        //#pragma omp threadprivate(m_infoStream)
+
         static StdOFStream 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/test/test_client.f90
===================================================================
--- XIOS/dev/branch_yushan/src/test/test_client.f90	(revision 1071)
+++ XIOS/dev/branch_yushan/src/test/test_client.f90	(revision 1072)
@@ -3,4 +3,5 @@
   USE xios
   USE mod_wait
+  use omp_lib
   IMPLICIT NONE
   INCLUDE "mpif.h"
@@ -32,5 +33,5 @@
   INTEGER :: i,j,l,ts,n
 
-!!! MPI Initialization
+!!! MPI Initialization   
 
   CALL MPI_INIT(ierr)
@@ -44,5 +45,4 @@
   CALL MPI_COMM_RANK(comm,rank,ierr)
   CALL MPI_COMM_SIZE(comm,size,ierr)
-  
 
   DO j=1,nj_glo
Index: XIOS/dev/branch_yushan/src/transformation/Functions/reduction.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/transformation/Functions/reduction.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/transformation/Functions/reduction.hpp	(revision 1072)
@@ -59,4 +59,5 @@
   typedef std::map<EReductionType, CreateOperationCallBack> CallBackMap;
   static CallBackMap* reductionCreationCallBacks_;
+  #pragma omp threadprivate(reductionCreationCallBacks_)
 
   static bool registerOperation(EReductionType reduceType, CreateOperationCallBack createFn);
@@ -66,4 +67,5 @@
   static bool initReductionOperation(std::map<StdString,EReductionType>& m);
   static bool _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 1071)
+++ XIOS/dev/branch_yushan/src/transformation/grid_transformation_factory_impl.hpp	(revision 1072)
@@ -57,7 +57,10 @@
   typedef std::map<ETranformationType, CreateTransformationCallBack> CallBackMap;
   static CallBackMap* transformationCreationCallBacks_;
+  #pragma omp threadprivate(transformationCreationCallBacks_)
+  
   static bool registerTransformation(ETranformationType transType, CreateTransformationCallBack createFn);
   static bool unregisterTransformation(ETranformationType transType);
   static bool initializeTransformation_;
+  #pragma omp threadprivate(initializeTransformation_)
 };
 
Index: XIOS/dev/branch_yushan/src/xios_server.f90
===================================================================
--- XIOS/dev/branch_yushan/src/xios_server.f90	(revision 1071)
+++ XIOS/dev/branch_yushan/src/xios_server.f90	(revision 1072)
@@ -4,7 +4,8 @@
   IMPLICIT NONE
   INCLUDE "mpif.h"
-  INTEGER :: ierr
+  INTEGER :: ierr, th_level
     
     CALL MPI_INIT(ierr)
+    !CALL MPI_INIT_thread(3, th_level, ierr)
     CALL init_wait
     CALL xios_init_server
Index: XIOS/dev/branch_yushan/src/xml_node.hpp
===================================================================
--- XIOS/dev/branch_yushan/src/xml_node.hpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/xml_node.hpp	(revision 1072)
@@ -49,4 +49,5 @@
 
             static StdString RootName;
+            //#pragma omp threadprivate(RootName)
 
       }; //class CXMLParser
Index: XIOS/dev/branch_yushan/src/xml_parser.cpp
===================================================================
--- XIOS/dev/branch_yushan/src/xml_parser.cpp	(revision 1071)
+++ XIOS/dev/branch_yushan/src/xml_parser.cpp	(revision 1072)
@@ -15,4 +15,5 @@
       void CXMLParser::ParseFile(const StdString & filename, const std::set<StdString>& parseContextList)
       {
+         //printf("thread %d, parsefile = %s\n", omp_get_thread_num(), filename.c_str());
          StdIFStream ifs ( filename.c_str() , StdIFStream::in );
          if ( (ifs.rdstate() & std::ifstream::failbit ) != 0 )
