项目作者: Parallel-NetCDF

项目描述 :
Integration of SZ compression into PnetCDF
高级语言: C
项目地址: git://github.com/Parallel-NetCDF/PnetCDF-SZ.git
创建时间: 2017-12-08T18:50:41Z
项目社区:https://github.com/Parallel-NetCDF/PnetCDF-SZ

开源协议:

下载


This project is for developing SZ compression feature into PnetCDF library.

  • SZ algorithm is an error-bounded lossy compressor developed by Di Sheng at the Argonne National Laboratiry.
  • PnetCDF is a parallel I/O library providing high-performance data access to Unidata’s NetCDF files,

Build utility program bin2nc. It converts a binary file to a NetCDF file

  1. % make bin2nc

Convert a binary file in Little Endian form to a NetCDF file

  1. % ./bin2nc testdouble_8_8_128.dat

Rename the file extension to “.nc”

  1. % mv testdouble_8_8_128.dat.nc testdouble_8_8_128.nc

Check file header of the newly generated NetCDF file

  1. % ncdump -h testdouble_8_8_128.nc
  2. netcdf testdouble_8_8_128 {
  3. dimensions:
  4. Z = 128 ;
  5. Y = 8 ;
  6. X = 8 ;
  7. variables:
  8. int scalar ;
  9. scalar:test = "dummy text attribute" ;
  10. double var3d(Z, Y, X) ;
  11. var3d:SZ\ test\ dataset = "x86/testdouble_8_8_128.dat" ;
  12. var3d:hidtory = "2017-12-08 12:36:51" ;
  13. // global attributes:
  14. :SZ\ URL = "https://collab.cels.anl.gov/display/ESR/SZ" ;
  15. :Purpose = "This file is created to test integrated SZ compression and decompression in PnetCDF" ;
  16. }

check file format

  1. % ncdump -k testdouble_8_8_128.nc
  2. classic

Build utility program pnc_sz, a prototyped PnetCDF program with SZ compression and decompression feature.

  1. % make pnc_sz

The usage of pnc_sz can be obtained from command “./pnc_sz -h”

  1. Usage: pnc_sz [-h] | [-d] [-k] [-z sz.conf] [-v var1[,...]] input_file
  2. [-h] Print help
  3. [-d] Perform data decompression
  4. [-k] Decompressed output file format.
  5. 1: classic, 2: 64-bit offset, 5: CDF-5 (default)
  6. [-z sz.conf] Input SZ configure file
  7. [-v var1[,...]] Compress variable(s) <var1>,... only and remove non-selected variables
  8. [-V var1[,...]] Compress variable(s) <var1>,... and store all variables (both compressed and non-compressed)
  9. input_file Input netCDF file name

Test run on 4 MPI processes to compress variables in input NetCDF file. Note scalar variables are not compressed.

Befure testing, you are recommended to set the following environmental variable in .bashrc or so, otherwise, the decompression (mpirun -np 4 ./pnc_sz -d -z ….) might take a very long time.
export PNETCDF_HINTS=”nc_header_align_size=1048576”

  1. % mpiexec -n 4 ./pnc_sz -z sz.config testdouble_8_8_128.nc

A new file with file name extension “.sz” was created. Check file header of the new NetCDF file.

  1. % ncdump -h testdouble_8_8_128.nc.sz
  2. netcdf testdouble_8_8_128.nc {
  3. dimensions:
  4. Z = 128 ;
  5. Y = 8 ;
  6. X = 8 ;
  7. SZ.var3d = 18744 ;
  8. variables:
  9. byte var3d(SZ.var3d) ;
  10. var3d:SZ\ test\ dataset = "x86/testdouble_8_8_128.dat" ;
  11. var3d:hidtory = "2017-12-08 12:36:51" ;
  12. var3d:SZ.nc_type = 6 ;
  13. var3d:SZ.ndims = 3 ;
  14. var3d:SZ.dimids = 0, 1, 2 ;
  15. var3d:SZ.nblocks = 4 ;
  16. var3d:SZ.block_lens = 4686, 4686, 4686, 4686 ;
  17. var3d:SZ.starts = 0LL, 0LL, 0LL, 32LL, 0LL, 0LL, 64LL, 0LL, 0LL, 96LL, 0LL, 0LL ;
  18. var3d:SZ.counts = 32LL, 8LL, 8LL, 32LL, 8LL, 8LL, 32LL, 8LL, 8LL, 32LL, 8LL, 8LL ;
  19. // global attributes:
  20. :SZ\ URL = "https://collab.cels.anl.gov/display/ESR/SZ" ;
  21. :Purpose = "This file is created to test integrated SZ compression and decompression in PnetCDF" ;
  22. }

check file format

  1. % ncdump -k testdouble_8_8_128.nc.sz
  2. cdf5

Test run on 3 MPI processes to decompress variables in input NetCDF file.

  1. % mpiexec -n 3 ./pnc_sz -d -z sz.config testdouble_8_8_128.nc.sz

A new file with file name extension “.unsz” was created. Check file header of the new NetCDF file.

  1. % ncdump -k testdouble_8_8_128.nc.sz.unsz
  2. netcdf testdouble_8_8_128.nc.sz {
  3. dimensions:
  4. Z = 128 ;
  5. Y = 8 ;
  6. X = 8 ;
  7. variables:
  8. double var3d(Z, Y, X) ;
  9. var3d:SZ\ test\ dataset = "x86/testdouble_8_8_128.dat" ;
  10. var3d:hidtory = "2017-12-08 12:36:51" ;
  11. // global attributes:
  12. :SZ\ URL = "https://collab.cels.anl.gov/display/ESR/SZ" ;
  13. :Purpose = "This file is created to test integrated SZ compression and decompression in PnetCDF" ;
  14. }

check file format

  1. % ncdump -h testdouble_8_8_128.nc.sz.unsz
  2. cdf5

Contact: @wkliao