Changeset 453 for XIOS/trunk


Ignore:
Timestamp:
01/09/14 09:41:57 (10 years ago)
Author:
ymipsl
Message:

Work-arround for fixing bug in netcdf4/hdf5 : the chunk size cannot exceed 2GB, so some problem was encountered for very big configuration.

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/output/onetcdf4.cpp

    r438 r453  
    246246         std::vector<StdSize> dimsizes ; 
    247247         StdSize size ; 
     248         StdSize totalSize ; 
     249         StdSize maxSize=1024*1024*256 ; // == 2GB/8 if output double 
    248250          
    249251         int grpid = this->getCurrentGroup(); 
     
    262264          
    263265         CheckError(nc_def_var (grpid, name.c_str(), type, dimids.size(), &(dimids[0]), &varid)); 
     266 
     267// set chunksize : size of one record 
     268// but must not be > 2GB (netcdf or HDF5 problem) 
     269         totalSize=1 ; 
     270         for(vector<StdSize>::reverse_iterator it=dimsizes.rbegin(); it!=dimsizes.rend();++it) 
     271         { 
     272           totalSize*= *it ; 
     273           if (totalSize>=maxSize) *it=1 ; 
     274         } 
     275 
    264276         CheckError(nc_def_var_chunking (grpid, varid, NC_CHUNKED, &(dimsizes[0]))); 
    265277         CheckError(nc_def_var_fill(grpid, varid, true, NULL)); 
Note: See TracChangeset for help on using the changeset viewer.