Changeset 1097 for XIOS


Ignore:
Timestamp:
04/14/17 14:34:32 (7 years ago)
Author:
ymipsl
Message:

Expected performance enhancement when using append mode.
Instead to read the whole time axis, only the last record is read first, and eventually continue until to reach the record corresponding to the current timestep.
(currently untested)

YM

Location:
XIOS/trunk/src/io
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/io/nc4_data_output.cpp

    r1096 r1097  
    27432743 
    27442744          CArray<double,2> timeAxisBounds; 
    2745           SuperClassWriter::getTimeAxisBounds(timeAxisBounds, timeAxisBoundsId, isCollective); 
    2746           timeAxisBounds*=factorUnit ; 
     2745          std::vector<StdSize> dimSize(SuperClassWriter::getDimensions(timeAxisBoundsId)) ; 
    27472746           
    27482747          StdSize record = 0; 
    27492748          double dtime(time); 
    2750           for (int n = timeAxisBounds.extent(1) - 1; n >= 0; n--) 
     2749          for (StdSize n = dimSize[0] - 1; n >= 0; n--) 
    27512750          { 
    2752             if (timeAxisBounds(1, n) < dtime) 
     2751            SuperClassWriter::getTimeAxisBounds(timeAxisBounds, timeAxisBoundsId, isCollective, n); 
     2752            timeAxisBounds*=factorUnit ; 
     2753            if (timeAxisBounds(1, 0) < dtime) 
    27532754            { 
    27542755              record = n + 1; 
  • XIOS/trunk/src/io/onetcdf4.cpp

    r1050 r1097  
    247247      } 
    248248 
    249       //--------------------------------------------------------------- 
     249      void CONetCDF4::getTimeAxisBounds(CArray<double,2>& timeAxisBounds, const StdString& name, bool collective, size_t record) 
     250      { 
     251        int grpid = this->getCurrentGroup(); 
     252        int varid = this->getVariable(name); 
     253 
     254        std::vector<StdSize> start(2), count(2); 
     255        start[0] = record; 
     256        count[0] = 1 ; 
     257        start[1] = 0; 
     258        count[1] = 2; 
     259 
     260        timeAxisBounds.resize(2, 1); 
     261 
     262        if (this->wmpi && collective) 
     263          CNetCdfInterface::varParAccess(grpid, varid, NC_COLLECTIVE); 
     264        if (this->wmpi && !collective) 
     265          CNetCdfInterface::varParAccess(grpid, varid, NC_INDEPENDENT); 
     266 
     267        CNetCdfInterface::getVaraType(grpid, varid, &start[0], &count[0], timeAxisBounds.dataFirst()); 
     268      } 
     269 
     270 
    250271 
    251272      const CONetCDF4::CONetCDF4Path& CONetCDF4::getCurrentPath(void) const 
  • XIOS/trunk/src/io/onetcdf4.hpp

    r878 r1097  
    9797            const StdString& getTimeCounterName(void) const { return timeCounterName; }; 
    9898 
    99             void getTimeAxisBounds(CArray<double,2>& timeAxisBounds, const StdString& name, bool collective); 
     99            void getTimeAxisBounds(CArray<double,2>& timeAxisBounds, const StdString& name, bool collective ); 
     100            void getTimeAxisBounds(CArray<double,2>& timeAxisBounds, const StdString& name, bool collective, size_t record); 
    100101 
    101102            bool varExist(const StdString& varname); 
Note: See TracChangeset for help on using the changeset viewer.