Index: XIOS/dev/dev_trunk_omp/src/client.cpp
===================================================================
--- XIOS/dev/dev_trunk_omp/src/client.cpp	(revision 1598)
+++ XIOS/dev/dev_trunk_omp/src/client.cpp	(revision 1601)
@@ -12,4 +12,5 @@
 #include "buffer_client.hpp"
 #include "string_tools.hpp"
+using namespace ep_lib;
 
 namespace xios
@@ -18,5 +19,5 @@
     MPI_Comm CClient::intraComm ;
     MPI_Comm CClient::interComm ;
-    std::list<MPI_Comm> CClient::contextInterComms;
+    std::list<MPI_Comm> *CClient::contextInterComms_ptr = 0;
     int CClient::serverLeader ;
     bool CClient::is_MPI_Initialized ;
@@ -24,6 +25,9 @@
     StdOFStream CClient::m_infoStream;
     StdOFStream CClient::m_errorStream;
+
+    StdOFStream CClient::array_infoStream[16];
+
     MPI_Comm& CClient::getInterComm(void)   { return (interComm); }
-     
+
 ///---------------------------------------------------------------
 /*!
@@ -106,8 +110,11 @@
             MPI_Comm_size(intraComm,&intraCommSize) ;
             MPI_Comm_rank(intraComm,&intraCommRank) ;
-            info(50)<<"intercommCreate::client "<<rank_<<" intraCommSize : "<<intraCommSize
+
+            MPI_Intercomm_create(intraComm, 0, CXios::globalComm, serverLeader, 0, &interComm) ;
+            #pragma omp critical (_output)
+            {
+              info(50)<<"intercommCreate::client "<<rank_<<" intraCommSize : "<<intraCommSize
                    <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< serverLeader<<endl ;
-             MPI_Intercomm_create(intraComm, 0, CXios::globalComm, serverLeader, 0, &interComm) ;
-             //rank_ = intraCommRank;
+            }
           }
           else
@@ -191,5 +198,6 @@
         CContext::setCurrent(id);
 
-        contextInterComms.push_back(contextInterComm);
+        if(contextInterComms_ptr == NULL) contextInterComms_ptr = new std::list<MPI_Comm>;
+        contextInterComms_ptr->push_back(contextInterComm);
       }
       else
@@ -217,4 +225,5 @@
 
         MPI_Intercomm_create(contextComm,0,CXios::globalComm,serverLeader,10+globalRank,&contextInterComm) ;
+        #pragma omp critical (_output)
         info(10)<<"Register new Context : "<<id<<endl ;
         MPI_Comm inter ;
@@ -224,5 +233,7 @@
         context->initClient(contextComm,contextInterComm) ;
 
-        contextInterComms.push_back(contextInterComm);
+        if(contextInterComms_ptr == NULL) contextInterComms_ptr = new std::list<MPI_Comm>;
+        contextInterComms_ptr->push_back(contextInterComm);
+
         MPI_Comm_free(&inter);
         delete [] buff ;
@@ -277,5 +288,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));
       MPI_Comm_free(&interComm);
@@ -287,18 +298,23 @@
       if (!is_MPI_Initialized)
       {
-        if (CXios::usingOasis) oasis_finalize();
-        else MPI_Finalize() ;
-      }
-      
+        //if (CXios::usingOasis) oasis_finalize();
+        //else
+        MPI_Finalize() ;
+      }
+      #pragma omp critical (_output)
       info(20) << "Client side context is finalized"<<endl ;
-      report(0) <<" Performance report : Whole time from XIOS init and finalize: "<< CTimer::get("XIOS init/finalize").getCumulatedTime()<<" s"<<endl ;
-      report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ;
-      report(0)<< " Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ;
-      report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS init/finalize").getCumulatedTime()*100.<<" %"<<endl ;
-      report(0)<< " Performance report : This ratio must be close to zero. Otherwise it may be usefull to increase buffer size or numbers of server"<<endl ;
+
+      #pragma omp critical (_output)
+      {
+        report(0) <<" Performance report : Whole time from XIOS init and finalize: "<< CTimer::get("XIOS init/finalize").getCumulatedTime()<<" s"<<endl ;
+        report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ;
+        report(0)<< " Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ;
+        report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS init/finalize").getCumulatedTime()*100.<<" %"<<endl ;
+        report(0)<< " Performance report : This ratio must be close to zero. Otherwise it may be usefull to increase buffer size or numbers of server"<<endl ;
 //      report(0)<< " Memory report : Current buffer_size : "<<CXios::bufferSize<<endl ;
-      report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ;
-      report(0)<< " Memory report : increasing it by a factor will increase performance, depending of the volume of data wrote in file at each time step of the file"<<endl ;
-      report(100)<<CTimer::getAllCumulatedTime()<<endl ;
+        report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ;
+        report(0)<< " Memory report : increasing it by a factor will increase performance, depending of the volume of data wrote in file at each time step of the file"<<endl ;
+        report(100)<<CTimer::getAllCumulatedTime()<<endl ;
+      }
    }
 
@@ -355,9 +371,10 @@
     void CClient::openInfoStream(const StdString& fileName)
     {
-      std::filebuf* fb = m_infoStream.rdbuf();
-      openStream(fileName, ".out", fb);
-
-      info.write2File(fb);
-      report.write2File(fb);
+      info_FB[omp_get_thread_num()] = array_infoStream[omp_get_thread_num()].rdbuf();
+          
+      openStream(fileName, ".out", info_FB[omp_get_thread_num()]);
+
+      info.write2File(info_FB[omp_get_thread_num()]);
+      report.write2File(info_FB[omp_get_thread_num()]);
     }
 
