Skip to content

Commit

Permalink
1. move version check to config.load()
Browse files Browse the repository at this point in the history
2. config.save() now use less space
3. update h5z-sz3 with readme and compact cd_value array
  • Loading branch information
ayzk committed Aug 31, 2024
1 parent a952c77 commit 8a6220d
Show file tree
Hide file tree
Showing 10 changed files with 677 additions and 497 deletions.
19 changes: 6 additions & 13 deletions include/SZ3/api/sz.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,20 @@ template<class T>
void SZ_decompress(SZ3::Config &conf, char *cmpData, size_t cmpSize, T *&decData) {
using namespace SZ3;
auto confPos = (const uchar *) cmpData;
auto cmpDataPos = confPos + conf.size_est();
conf.load(confPos);
if (conf.sz3MagicNumber != SZ3_MAGIC_NUMBER) {
throw std::invalid_argument("magic number mismatch, the input data is not compressed by SZ3");
}
if (versionStr(conf.sz3DataVer) != SZ3_DATA_VER) {
std::stringstream ss;
printf("program v%s , program-data %s , input data v%s\n", SZ3_VER, SZ3_DATA_VER, versionStr(conf.sz3DataVer).data());
ss << "Please use SZ3 v" << conf.sz3DataVer << " to decompress the data" << std::endl;
throw std::invalid_argument(ss.str());
}

if (decData == nullptr) {
decData = new T[conf.num];
}
if (conf.N == 1) {
SZ_decompress_impl<T, 1>(conf, confPos, cmpSize, decData);
SZ_decompress_impl<T, 1>(conf, cmpDataPos, cmpSize, decData);
} else if (conf.N == 2) {
SZ_decompress_impl<T, 2>(conf, confPos, cmpSize, decData);
SZ_decompress_impl<T, 2>(conf, cmpDataPos, cmpSize, decData);
} else if (conf.N == 3) {
SZ_decompress_impl<T, 3>(conf, confPos, cmpSize, decData);
SZ_decompress_impl<T, 3>(conf, cmpDataPos, cmpSize, decData);
} else if (conf.N == 4) {
SZ_decompress_impl<T, 4>(conf, confPos, cmpSize, decData);
SZ_decompress_impl<T, 4>(conf, cmpDataPos, cmpSize, decData);
} else {
printf("Data dimension higher than 4 is not supported.\n");
exit(0);
Expand Down
2 changes: 1 addition & 1 deletion include/SZ3/decomposition/InterpolationDecomposition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace SZ3 {
// compress given the error bound
std::vector<int> compress(const Config &conf, T *data) {
std::copy_n(conf.dims.begin(), N, global_dimensions.begin());
blocksize = conf.interpBlockSize;
blocksize = 32;
interpolator_id = conf.interpAlgo;
direction_sequence_id = conf.interpDirection;

Expand Down
Loading

0 comments on commit 8a6220d

Please sign in to comment.