H5Z-ZFP icon indicating copy to clipboard operation
H5Z-ZFP copied to clipboard

print_h5repack_farg issue on Mac

Open allibco opened this issue 1 year ago • 0 comments

Despite trying different compilers, versions, etc., my colleague and I can't get print_h5repack_farg to work properly on our macs. For example:

cisl-arbutus:bin abaker$ ./print_h5repack_farg zfpmode=3 acc=1.0

Print cdvals for set of ZFP compression parameters... zfpmode=3 set zfp mode (1=rate,2=prec,3=acc,4=expert,5=rev) rate=3.5 set rate for rate mode of filter acc=1 set accuracy for accuracy mode of filter prec=0 set precision for precision mode of zfp filter minbits=0 set minbits for expert mode of zfp filter maxbits=0 set maxbits for expert mode of zfp filter maxprec=0 set maxprec for expert mode of zfp filter minexp=0 set minexp for expert mode of zfp filter help=0 this help message

h5repack -f argument... -f UD=32013,0,4,3,0,0,0

But it should return: h5repack -f argument... -f UD=32013,0,4,3,0,0,1072693248

Note that test_write_plugin works fine with the same zfpmode and acc value (and gives the correct CD values).

Peter Lindstrom says:

"I suspect that type punning is to blame, which in my experience can fail since it's UB, and the compiler can decide to ignore expressions that invoke UB.

I'm copying Mark Miller, who I know is very busy at the moment, but he may have some suggestions. It's probably a good idea to file an issue on GitHub so we don't forget to address this. If you do, please be sure to target the LLNL/H5Z-ZFP (not zfp) repo.

Mark, if you want to stick with type punning, I would strongly suggest using memcpy() instead of casts here and here, etc."

allibco avatar Nov 04 '24 17:11 allibco