Changeset 2532


Ignore:
Timestamp:
07/20/23 11:55:20 (10 months ago)
Author:
jderouillat
Message:

Implement an API to use the ZFP compression plugin.

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

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk/src/io/netCdfInterface.cpp

    r2529 r2532  
    791791  { 
    792792    pluginLibName = "libhdf5sz.so"; 
     793  } 
     794  else if ( filterId == 32013 ) // 32013 = ZFP 
     795  { 
     796    pluginLibName = "libh5zzfp.so"; 
    793797  } 
    794798  if (cplugin) 
  • XIOS3/trunk/src/io/onetcdf4.cpp

    r2529 r2532  
    540540             CNetCdfInterface::defVarFilter(grpid, varid, 32017, cd_nelmts, cd_values); 
    541541           } 
     542           else if (compressionType=="ZFP") 
     543           { 
     544             CONetCDF4Plugin::interpretParametersZFP(compressionParams, &cd_nelmts, &cd_values); 
     545             CNetCdfInterface::defVarFilter(grpid, varid, 32013, cd_nelmts, cd_values); 
     546           } 
    542547           else 
    543548           { 
  • XIOS3/trunk/src/io/onetcdf4_plugin.hpp

    r2529 r2532  
    4646    } 
    4747       
     48    //! Compute HDF5 plugin parameters from ZFP parameters 
     49    static void interpretParametersZFP(const CArray<double,1>& inParams, size_t* nOutParams, unsigned int **outParams) 
     50    { 
     51      if (inParams.numElements()==0) // N = f( mode ) 
     52      { 
     53          ERROR("CONetCDF4Plugin::interpretParametersSZ(...)", "The 1st parameter of ZFP compressor is the mode, must be lower or equal to 5" ); 
     54      } 
     55       
     56      // https://github.com/LLNL/H5Z-ZFP/blob/master/test/test_write.c#L237 
     57      // https://github.com/LLNL/H5Z-ZFP/blob/master/src/H5Zzfp_version.h 
     58      if      (inParams(0) == 1) *nOutParams = 4; // RATE       (mode=1) : 1 double 
     59      else if (inParams(0) == 2) *nOutParams = 3; // PRECISION  (mode=2) : 2 unsigned int 
     60      else if (inParams(0) == 3) *nOutParams = 4; // ACCURACY   (mode=3) : 1 double 
     61      else if (inParams(0) == 4) *nOutParams = 6; // EXPERT     (mode=4) : 3 unsigned int + 1 int 
     62      else if (inParams(0) == 5) *nOutParams = 1; // REVERSIBLE (mode=5) : - 
     63 
     64      *outParams = new unsigned int[*nOutParams]; 
     65 
     66      // https://github.com/LLNL/H5Z-ZFP/blob/master/src/H5Zzfp_plugin.h 
     67      (*outParams)[0] = (unsigned int)(inParams(0)); 
     68      (*outParams)[1] = 0; 
     69      if ((inParams(0) == 1)||(inParams(0) == 3)) 
     70      { 
     71        memcpy( &((*outParams)[2]), &(inParams(1)), sizeof(double) ); 
     72      } 
     73      else if (inParams(0) == 2) 
     74      { 
     75        (*outParams)[2] = (unsigned int)(inParams(1)); 
     76      } 
     77      else if (inParams(0) == 4) 
     78      { 
     79        (*outParams)[2] = (unsigned int)(inParams(1)); 
     80        (*outParams)[3] = (unsigned int)(inParams(2)); 
     81        (*outParams)[4] = (unsigned int)(inParams(3)); 
     82        (*outParams)[5] = (unsigned int)(inParams(4)); 
     83      } 
     84 
     85    } 
    4886  }; 
    4987} 
Note: See TracChangeset for help on using the changeset viewer.