Changeset 1342


Ignore:
Timestamp:
11/21/17 16:03:00 (5 years ago)
Author:
yushan
Message:

log files

Location:
XIOS/dev/branch_openmp/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/src/buffer_client.cpp

    r1338 r1342  
    3030    buffer[1] = new char[bufferSize]; 
    3131    retBuffer = new CBufferOut(buffer[current], bufferSize); 
    32     //info(10) << "CClientBuffer: allocated 2 x " << bufferSize << " bytes for server " << serverRank << " with a maximum of " << maxBufferedEvents << " buffered events" << endl; 
     32    #pragma omp critical (_output) 
     33    info(10) << "CClientBuffer: allocated 2 x " << bufferSize << " bytes for server " << serverRank << " with a maximum of " << maxBufferedEvents << " buffered events" << endl; 
    3334  } 
    3435 
  • XIOS/dev/branch_openmp/src/calendar.cpp

    r1334 r1342  
    117117      const CDate& CCalendar::update(int step) 
    118118      { 
    119         //info(20) << "update step : " << step << " timestep " << this->timestep << std::endl; 
     119        #pragma omp critical (_output) 
     120        info(20) << "update step : " << step << " timestep " << this->timestep << std::endl; 
    120121        return (this->currentDate = this->getInitDate() + step * this->timestep); 
    121122      } 
  • XIOS/dev/branch_openmp/src/client.cpp

    r1338 r1342  
    2626    StdOFStream CClient::m_errorStream; 
    2727 
     28    StdOFStream CClient::array_infoStream[16]; 
     29 
    2830    void CClient::initialize(const string& codeId,MPI_Comm& localComm,MPI_Comm& returnComm) 
    2931    { 
     
    186188 
    187189        MPI_Intercomm_create(contextComm,0,CXios::globalComm,serverLeader,10+globalRank,&contextInterComm) ; 
    188         #pragma omp critical (std_output) 
    189         { 
    190           //info(10)<<"Register new Context : "<<id<<endl ; 
     190        #pragma omp critical (_output) 
     191        { 
     192          info(10)<<"Register new Context : "<<id<<endl ; 
    191193        } 
    192194 
     
    254256        MPI_Finalize() ; 
    255257      } 
     258      #pragma omp critical (_output) 
     259      info(20) << "Client side context is finalized"<<endl ; 
    256260       
    257       //info(20) << "Client side context is finalized"<<endl ; 
    258       //report(0) <<" Performance report : Whole time from XIOS init and finalize: "<< CTimer::get("XIOS init/finalize").getCumulatedTime()<<" s"<<endl ; 
    259       //report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ; 
    260       //report(0)<< " Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ; 
    261       //report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS init/finalize").getCumulatedTime()*100.<<" %"<<endl ; 
    262       //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 ; 
    263 //      report(0)<< " Memory report : Current buffer_size : "<<CXios::bufferSize<<endl ; 
    264       //report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; 
    265       //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 ; 
    266       //report(100)<<CTimer::getAllCumulatedTime()<<endl ; 
     261 
     262      /*#pragma omp critical (_output) 
     263      { 
     264        report(0) <<" Performance report : Whole time from XIOS init and finalize: "<< CTimer::get("XIOS init/finalize").getCumulatedTime()<<" s"<<endl ; 
     265        report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ; 
     266        report(0)<< " Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ; 
     267        report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS init/finalize").getCumulatedTime()*100.<<" %"<<endl ; 
     268        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 ; 
     269        report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; 
     270        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 ; 
     271        report(100)<<CTimer::getAllCumulatedTime()<<endl ; 
     272      }*/ 
    267273   } 
    268274 
     
    307313    void CClient::openInfoStream(const StdString& fileName) 
    308314    { 
    309       std::filebuf* fb = m_infoStream.rdbuf(); 
    310       openStream(fileName, ".out", fb); 
    311  
    312       info.write2File(fb); 
    313       report.write2File(fb); 
     315      info_FB[omp_get_thread_num()] = array_infoStream[omp_get_thread_num()].rdbuf(); 
     316           
     317      openStream(fileName, ".out", info_FB[omp_get_thread_num()]); 
     318 
     319      info.write2File(info_FB[omp_get_thread_num()]); 
     320      report.write2File(info_FB[omp_get_thread_num()]); 
    314321    } 
    315322 
  • XIOS/dev/branch_openmp/src/client.hpp

    r1331 r1342  
    5656      #pragma omp threadprivate(m_errorStream) 
    5757 
     58      static StdOFStream array_infoStream[16]; 
     59 
    5860      static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb); 
    5961  }; 
  • XIOS/dev/branch_openmp/src/context_server.cpp

    r1338 r1342  
    254254    { 
    255255      finished=true; 
    256       //info(20)<<"Server Side context <"<<context->getId()<<"> finalized"<<endl; 
     256      #pragma omp critical (_output) 
     257      info(20)<<"Server Side context <"<<context->getId()<<"> finalized"<<endl; 
    257258      std::map<int, StdSize>::const_iterator itbMap = mapBufferSize_.begin(), 
    258259                                             iteMap = mapBufferSize_.end(), itMap; 
  • XIOS/dev/branch_openmp/src/cxios.cpp

    r1331 r1342  
    124124    if (printLogs2Files) 
    125125    { 
     126      #pragma omp critical 
    126127      CClient::openInfoStream(clientFile); 
    127128      CClient::openErrorStream(clientFile); 
     
    139140     if (CClient::getRank()==0) 
    140141     { 
     142       #pragma omp critical (_output) 
    141143       info(80)<<"Write data base Registry"<<endl<<globalRegistry->toString()<<endl ; 
    142144       globalRegistry->toFile("xios_registry.bin") ; 
  • XIOS/dev/branch_openmp/src/log.cpp

    r1328 r1342  
    11#include "log.hpp" 
     2#include <string> 
     3#include <iostream> 
     4#include <string> 
    25 
    36namespace xios 
    47{ 
     8  std::filebuf* info_FB[16]; 
     9 
     10 
    511  CLog info("info") ; 
    612  CLog report("report") ; 
    713  CLog error("error", cerr.rdbuf()) ; 
     14 
     15   
     16  CLog& CLog::operator()(int l) 
     17    { 
     18      if (l<=level) 
     19      { 
     20        omp_set_lock( &mutex ); 
     21        rdbuf(strBuf_array[omp_get_thread_num()]);  
     22        *this<<"-> "<<name<<" : " ; 
     23        omp_unset_lock( &mutex ); 
     24      } 
     25      else rdbuf(NULL) ; 
     26      return *this; 
     27    } 
    828} 
  • XIOS/dev/branch_openmp/src/log.hpp

    r1328 r1342  
    55#include <iostream> 
    66#include <string> 
     7#include <stdio.h> 
     8#include <omp.h> 
    79 
    810namespace xios 
     
    1416    public : 
    1517    CLog(const string& name_, std::streambuf* sBuff = cout.rdbuf()) 
    16       : ostream(sBuff), level(0), name(name_), strBuf_(sBuff) {} 
    17     CLog& operator()(int l) 
     18      : ostream(sBuff), level(0), name(name_), strBuf_(sBuff)  
    1819    { 
    19       if (l<=level) 
    20       { 
    21         rdbuf(strBuf_); 
    22         *this<<"-> "<<name<<" : " ; 
    23       } 
    24       else rdbuf(NULL) ; 
    25       return *this; 
     20      omp_init_lock( &mutex ); 
     21      for(int i=0; i<16; i++) 
     22        strBuf_array[i] = sBuff; 
    2623    } 
     24 
     25    ~CLog() 
     26    { 
     27      omp_destroy_lock( &mutex ); 
     28    } 
     29 
     30    CLog& operator()(int l); 
    2731    void setLevel(int l) {level=l; } 
    2832    int getLevel() {return level ;} 
     
    4650     * \param [in] pointer to new streambuf 
    4751    */ 
    48     void changeStreamBuff(std::streambuf* sBuff) { strBuf_ = sBuff; rdbuf(sBuff); } 
     52    void changeStreamBuff(std::streambuf* sBuff)  
     53    {  
     54      strBuf_ = sBuff;  
     55      strBuf_array[omp_get_thread_num()] = sBuff; 
     56      rdbuf(sBuff); 
     57    } 
    4958 
    5059    int level ; 
    5160    string name ; 
    5261    std::streambuf* strBuf_; 
     62    std::streambuf* strBuf_array[16]; 
     63    omp_lock_t mutex; 
    5364  }; 
    5465 
     
    5667  extern CLog report; 
    5768  extern CLog error; 
     69 
     70  extern std::filebuf* info_FB[16]; 
    5871} 
    5972#endif 
  • XIOS/dev/branch_openmp/src/node/context.cpp

    r1338 r1342  
    12051205   void CContext::updateCalendar(int step) 
    12061206   { 
    1207       //info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
     1207      #pragma omp critical (_output) 
     1208      info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
    12081209      calendar->update(step); 
    1209       //info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 
     1210      #pragma omp critical (_output) 
     1211      info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 
    12101212#ifdef XIOS_MEMTRACK_LIGHT 
     1213      #pragma omp critical (_output) 
    12111214      info(50) << " Current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ; 
    12121215#endif 
  • XIOS/dev/branch_openmp/src/node/field.cpp

    r1341 r1342  
    316316    while (currentDate >= lastDataRequestedFromServer) 
    317317    { 
    318       //info(20) << "currentDate : " << currentDate << endl ; 
    319       //info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ; 
    320       //info(20) << "file->output_freq.getValue() : " << file->output_freq.getValue() << endl ; 
    321       //info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; 
    322  
     318      #pragma omp critical (_output) 
     319      { 
     320        info(20) << "currentDate : " << currentDate << endl ; 
     321        info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ; 
     322        info(20) << "file->output_freq.getValue() : " << file->output_freq.getValue() << endl ; 
     323        info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; 
     324      } 
    323325      dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file->output_freq); 
    324326    } 
Note: See TracChangeset for help on using the changeset viewer.