Changeset 1135


Ignore:
Timestamp:
05/17/17 11:02:34 (4 years ago)
Author:
ymipsl
Message:
  • Add new timer for better profiling. The full timer output will be provided only for info_level=100
  • Add new file attribute : convention_str (string) : this string will overide the default value wrote in the file (CF-1.6 or UGRID)

YM

Location:
XIOS/trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/client.cpp

    r1032 r1135  
    4242          } 
    4343          CTimer::get("XIOS").resume() ; 
    44           CTimer::get("XIOS init").resume() ; 
     44          CTimer::get("XIOS init/finalize").resume() ; 
    4545          boost::hash<string> hashString ; 
    4646 
     
    132132 
    133133        CTimer::get("XIOS").resume() ; 
    134         CTimer::get("XIOS init").resume() ; 
     134        CTimer::get("XIOS init/finalize").resume() ; 
    135135 
    136136        if (CXios::usingServer) 
     
    235235      MPI_Comm_free(&intraComm); 
    236236 
    237       CTimer::get("XIOS finalize").suspend() ; 
     237      CTimer::get("XIOS init/finalize").suspend() ; 
    238238      CTimer::get("XIOS").suspend() ; 
    239239 
     
    245245       
    246246      info(20) << "Client side context is finalized"<<endl ; 
     247      report(0) <<" Performance report : Whole time from XIOS init and finalize: "<< CTimer::get("XIOS init/finalize").getCumulatedTime()<<" s"<<endl ; 
    247248      report(0) <<" Performance report : total time spent for XIOS : "<< CTimer::get("XIOS").getCumulatedTime()<<" s"<<endl ; 
    248249      report(0)<< " Performance report : time spent for waiting free buffer : "<< CTimer::get("Blocking time").getCumulatedTime()<<" s"<<endl ; 
    249       report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS").getCumulatedTime()*100.<<" %"<<endl ; 
     250      report(0)<< " Performance report : Ratio : "<< CTimer::get("Blocking time").getCumulatedTime()/CTimer::get("XIOS init/finalize").getCumulatedTime()*100.<<" %"<<endl ; 
    250251      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 ; 
    251252//      report(0)<< " Memory report : Current buffer_size : "<<CXios::bufferSize<<endl ; 
    252253      report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; 
    253254      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 ; 
     255      report(100)<<CTimer::getAllCumulatedTime()<<endl ; 
    254256   } 
    255257 
  • XIOS/trunk/src/config/file_attribute.conf

    r1096 r1135  
    1414DECLARE_ENUM2(format,        netcdf4, netcdf4_classic) 
    1515DECLARE_ENUM2(convention,    CF, UGRID) 
     16DECLARE_ATTRIBUTE(StdString, convention_str) 
    1617DECLARE_ENUM2(par_access,    collective, independent) 
    1718DECLARE_ATTRIBUTE(bool,      append) 
  • XIOS/trunk/src/io/nc4_data_output.cpp

    r1108 r1135  
    1111#include "netCdfException.hpp" 
    1212#include "exception.hpp" 
     13#include "timer.hpp" 
    1314#include "uuid.hpp" 
    14  
    1515namespace xios 
    1616{ 
     
    18321832         singleDomain = (file->nbDomains == 1); 
    18331833 
     1834         StdString conv_str ; 
     1835         if (file->convention_str.isEmpty()) 
     1836         { 
     1837            if (SuperClassWriter::useCFConvention) conv_str="CF-1.6" ; 
     1838            else conv_str="UGRID" ; 
     1839         } 
     1840         else conv_str=file->convention_str ; 
     1841            
    18341842         try 
    18351843         { 
    1836        if (SuperClassWriter::useCFConvention) 
    1837              this->writeFileAttributes(filename, description, 
    1838                                        StdString("CF-1.6"), 
    1839                                        StdString("An IPSL model"), 
    1840                                        this->getTimeStamp()); 
    1841            else 
    1842              this->writeFileAttributes(filename, description, 
    1843                                        StdString("UGRID"), 
    1844                                        StdString("An IPSL model"), 
    1845                                        this->getTimeStamp()); 
    1846  
     1844           this->writeFileAttributes(filename, description, 
     1845                                      conv_str, 
     1846                                      StdString("An IPSL model"), 
     1847                                      this->getTimeStamp()); 
    18471848 
    18481849           if (!appendMode) 
     
    19891990        CGrid* grid = field->grid; 
    19901991 
    1991         if (field->getNStep()<1) return ; 
     1992        if (field->getNStep()<1)  
     1993        { 
     1994          return; 
     1995        } 
    19921996         
    19931997        if (!grid->doGridHaveDataToWrite()) 
    1994           if (SuperClass::type == MULTI_FILE || !isCollective) return; 
    1995  
     1998          if (SuperClass::type == MULTI_FILE || !isCollective) 
     1999          { 
     2000            return; 
     2001          } 
     2002 
     2003           
    19962004        StdString fieldid = field->getFieldOutputName(); 
    19972005 
     
    21182126              case (MULTI_FILE) : 
    21192127              { 
     2128                 CTimer::get("Files : writing data").resume(); 
    21202129                 SuperClassWriter::writeData(fieldData, fieldid, isCollective, field->getNStep() - 1); 
     2130                 CTimer::get("Files : writing data").suspend(); 
    21212131                 if (wtime) 
    21222132                 { 
     2133                   CTimer::get("Files : writing time axis").resume(); 
    21232134                   if ( wtimeData) 
    21242135                   { 
    2125                      SuperClassWriter::writeData(time_data, timeAxisId, isCollective, field->getNStep() - 1); 
    2126                      SuperClassWriter::writeData(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1); 
    2127                    } 
     2136//                     SuperClassWriter::writeData(time_data, timeAxisId, isCollective, field->getNStep() - 1); 
     2137//                     SuperClassWriter::writeData(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1); 
     2138                       SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, field->getNStep() - 1, isRoot); 
     2139                       SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1, isRoot); 
     2140                  } 
    21282141                   if (wtimeCounter) 
    21292142                   { 
    2130                      SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1); 
    2131                      if (timeCounterType!=record) SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1); 
     2143//                     SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1); 
     2144//                     if (timeCounterType!=record) SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1); 
     2145                     SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1,isRoot); 
     2146                     if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot); 
    21322147                   } 
     2148                   CTimer::get("Files : writing time axis").suspend(); 
    21332149                 } 
    21342150                 break; 
     
    22562272                } 
    22572273 
     2274 
     2275                CTimer::get("Files : writing data").resume(); 
    22582276                SuperClassWriter::writeData(fieldData, fieldid, isCollective, field->getNStep() - 1, &start, &count); 
     2277                CTimer::get("Files : writing data").suspend(); 
     2278 
    22592279                 if (wtime) 
    22602280                 { 
     2281                   CTimer::get("Files : writing time axis").resume(); 
    22612282                   if ( wtimeData) 
    22622283                   { 
    2263                      SuperClassWriter::writeData(time_data, timeAxisId, isCollective, field->getNStep() - 1); 
    2264                      SuperClassWriter::writeData(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1); 
     2284//                     SuperClassWriter::writeData(time_data, timeAxisId, isCollective, field->getNStep() - 1); 
     2285//                     SuperClassWriter::writeData(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1); 
     2286                     SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, field->getNStep() - 1, isRoot); 
     2287                     SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1, isRoot); 
    22652288                   } 
    22662289                   if (wtimeCounter) 
    22672290                   { 
    2268                      SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1); 
    2269                      if (timeCounterType!=record) SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1); 
     2291//                     SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1); 
     2292//                     if (timeCounterType!=record) SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1); 
     2293                     SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1,isRoot); 
     2294                     if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot); 
     2295 
    22702296                   } 
     2297                   CTimer::get("Files : writing time axis").suspend();   
    22712298                 } 
    22722299 
  • XIOS/trunk/src/io/onetcdf4.cpp

    r1097 r1135  
    77#include "netCdfInterface.hpp" 
    88#include "netCdfException.hpp" 
     9#include "timer.hpp" 
    910 
    1011namespace xios 
     
    5556         if (!append || !std::ifstream(filename.c_str())) 
    5657         { 
     58            CTimer::get("Files : create").resume(); 
    5759            if (wmpi) 
    5860               CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL, this->ncidp); 
    5961            else 
    6062               CNetCdfInterface::create(filename, mode, this->ncidp); 
    61  
     63            CTimer::get("Files : create").suspend(); 
     64  
    6265            this->appendMode = false; 
    6366         } 
     
    6568         { 
    6669            mode |= NC_WRITE; 
     70            CTimer::get("Files : open").resume(); 
    6771            if (wmpi) 
    6872               CNetCdfInterface::openPar(filename, mode, *comm, MPI_INFO_NULL, this->ncidp); 
    6973            else 
    7074               CNetCdfInterface::open(filename, mode, this->ncidp); 
    71  
     75            CTimer::get("Files : open").suspend(); 
    7276            this->appendMode = true; 
    7377         } 
     
    8387      void CONetCDF4::close() 
    8488      { 
     89        CTimer::get("Files : close").resume(); 
    8590        CNetCdfInterface::close(this->ncidp); 
     91        CTimer::get("Files : close").suspend(); 
    8692      } 
    8793 
     
    557563 
    558564         this->getWriteDataInfos(name, 0, array_size,  sstart, scount, NULL, NULL); 
     565 
    559566         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
     567 
    560568      } 
    561569 
     
    583591 
    584592         this->getWriteDataInfos(name, record, array_size,  sstart, scount, NULL, NULL); 
    585          if (using_netcdf_internal) 
    586          { 
    587            if (!isRoot) 
    588            { 
    589              sstart[0] = sstart[0] + 1; 
    590              scount[0] = 0; 
    591            } 
    592          } 
    593593         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
    594594       } 
    595595 
     596      void CONetCDF4::writeTimeAxisDataBounds(const CArray<double, 1>& data, const StdString& name, 
     597                                        bool collective, StdSize record, bool isRoot) 
     598      { 
     599         int grpid = this->getCurrentGroup(); 
     600         int varid = this->getVariable(name); 
     601 
     602         map<int,size_t>::iterator it=timeAxis.find(varid); 
     603         if (it == timeAxis.end()) timeAxis[varid] = record; 
     604         else 
     605         { 
     606           if (it->second >= record) return; 
     607           else it->second =record; 
     608         } 
     609 
     610         StdSize array_size = 1; 
     611         std::vector<StdSize> sstart, scount; 
     612 
     613         if (this->wmpi && collective) 
     614            CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); 
     615         if (this->wmpi && !collective) 
     616            CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 
     617 
     618         this->getWriteDataInfos(name, record, array_size,  sstart, scount, NULL, NULL); 
     619         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
     620       } 
     621 
     622 
    596623      //--------------------------------------------------------------- 
    597624 
  • XIOS/trunk/src/io/onetcdf4.hpp

    r1097 r1135  
    7171            void writeTimeAxisData(const CArray<double,1>& data, const StdString& name, 
    7272                                   bool collective, StdSize record, bool Isroot); 
     73            void writeTimeAxisDataBounds(const CArray<double,1>& data, const StdString& name, 
     74                                   bool collective, StdSize record, bool Isroot); 
    7375            /// Accesseur /// 
    7476            const CONetCDF4Path& getCurrentPath(void) const; 
  • XIOS/trunk/src/io/onetcdf4_impl.hpp

    r1050 r1135  
    44#include "onetcdf4.hpp" 
    55#include "netCdfInterface.hpp" 
     6#include "timer.hpp" 
    67 
    78namespace xios 
     
    2324    CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 
    2425 
     26    CTimer::get("Files : get data infos").resume(); 
    2527    this->getWriteDataInfos 
    2628    (name, record, array_size,  sstart, scount, start, count); 
     29    CTimer::get("Files : get data infos").suspend(); 
     30 
    2731    if (data.numElements() != array_size) 
    2832    { 
     
    5256    CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 
    5357 
    54     this->getWriteDataInfos 
    55     (name, record, array_size,  sstart, scount, start, count); 
     58    CTimer::get("CONetCDF4::writeData getWriteDataInfos").resume(); 
     59    this->getWriteDataInfos(name, record, array_size,  sstart, scount, start, count); 
     60    CTimer::get("CONetCDF4::writeData getWriteDataInfos").suspend(); 
     61  
    5662    if (data.numElements()*stringArrayLen != array_size) 
    5763    { 
     
    7076      PtrArrayStr[it->size()]='\0' ; 
    7177    } 
     78    CTimer::get("CONetCDF4::writeData writeData_").resume(); 
    7279    this->writeData_(grpid, varid, sstart, scount, ArrayStr); 
     80    CTimer::get("CONetCDF4::writeData writeData_").suspend(); 
    7381    delete [] ArrayStr ; 
    7482  } 
  • XIOS/trunk/src/node/context.cpp

    r1091 r1135  
    1414#include "type.hpp" 
    1515#include "xios_spl.hpp" 
     16#include "timer.hpp" 
    1617 
    1718 
     
    389390   void CContext::closeDefinition(void) 
    390391   { 
     392     CTimer::get("Context : close definition").resume() ; 
    391393     // There is nothing client need to send to server 
    392394     if (hasClient) 
     
    442444      startPrefetchingOfEnabledReadModeFiles(); 
    443445    } 
     446    CTimer::get("Context : close definition").suspend() ; 
    444447   } 
    445448 
  • XIOS/trunk/src/node/field.cpp

    r1120 r1135  
    125125  void CField::sendUpdateData(const CArray<double,1>& data) 
    126126  { 
    127     CTimer::get("XIOS Send Data").resume(); 
     127    CTimer::get("Field : send data").resume(); 
    128128 
    129129    CContext* context = CContext::getCurrent(); 
     
    177177    } 
    178178 
    179     CTimer::get("XIOS Send Data").suspend(); 
     179    CTimer::get("Field : send data").suspend(); 
    180180  } 
    181181 
     
    187187    list<CEventServer::SSubEvent>::iterator it; 
    188188    string fieldId; 
    189  
     189    CTimer::get("Field : recv data").resume(); 
    190190    for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) 
    191191    { 
     
    197197    } 
    198198    get(fieldId)->recvUpdateData(ranks,buffers); 
     199    CTimer::get("Field : recv data").suspend(); 
    199200  } 
    200201 
  • XIOS/trunk/src/node/file.cpp

    r1098 r1135  
    1616#include "context_client.hpp" 
    1717#include "mpi.hpp" 
     18#include "timer.hpp" 
    1819 
    1920namespace xios { 
     
    274275      if (mode.isEmpty() || mode.getValue() == mode_attr::write) 
    275276      { 
     277        CTimer::get("Files : create headers").resume(); 
    276278        if (!isOpen) createHeader(); 
     279        CTimer::get("Files : create headers").suspend(); 
    277280        checkSync(); 
    278281      } 
    279282      else 
    280283      { 
     284        CTimer::get("Files : open headers").resume(); 
    281285        if (!isOpen) openInReadMode(); 
     286        CTimer::get("Files : open headers").suspend(); 
    282287      } 
    283288      checkSplit(); 
  • XIOS/trunk/src/server.cpp

    r1032 r1135  
    163163      report(0)<<"Performance report : Time spent in processing events : "<<CTimer::get("Process events").getCumulatedTime()<<endl  ; 
    164164      report(0)<<"Performance report : Ratio : "<<CTimer::get("Process events").getCumulatedTime()/CTimer::get("XIOS server").getCumulatedTime()*100.<<"%"<<endl  ; 
     165      report(100)<<CTimer::getAllCumulatedTime()<<endl ; 
    165166    } 
    166167 
  • XIOS/trunk/src/timer.cpp

    r652 r1135  
    33#include <string> 
    44#include <map> 
     5#include <iostream> 
     6#include <sstream> 
    57#include "tracer.hpp" 
    68 
     
    5759    return it->second; 
    5860  } 
     61 
     62  string CTimer::getAllCumulatedTime(void) 
     63  { 
     64    std::ostringstream strOut ; 
     65    for(std::map<std::string,CTimer>::iterator it=allTimer.begin();it!=allTimer.end();++it) 
     66      strOut<<"Timer : "<<it->first<<"    -->   cumulated time : "<<it->second.getCumulatedTime()<<std::endl ; 
     67    return strOut.str() ; 
     68  } 
    5969} 
  • XIOS/trunk/src/timer.hpp

    r688 r1135  
    2323      static double getTime(void); 
    2424      static CTimer& get(std::string name); 
     25      static std::string getAllCumulatedTime(void) ; 
    2526  }; 
    2627} 
Note: See TracChangeset for help on using the changeset viewer.