Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions source/adios2/operator/compress/CompressMGARD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ size_t CompressMGARD::Operate(const char *dataIn, const Dims &blockStart, const
double tolerance = 0.0;
double s = 0.0;
auto errorBoundType = mgard_x::error_bound_type::REL;
mgard_x::Config config;
config.lossless = mgard_x::lossless_type::Huffman_Zstd;

// input size under this bound will not compress
size_t thresholdSize = 100000;
Expand Down Expand Up @@ -135,6 +137,24 @@ size_t CompressMGARD::Operate(const char *dataIn, const Dims &blockStart, const
errorBoundType = mgard_x::error_bound_type::REL;
}
}
if (auto itLosslessType = m_Parameters.find("lossless_type");
itLosslessType != m_Parameters.end())
{
if (itLosslessType->second == "huffman")
{
config.lossless = mgard_x::lossless_type::Huffman;
}
else if (itLosslessType->second == "huffman_zstd")
{
config.lossless = mgard_x::lossless_type::Huffman_Zstd;
}
else
{
helper::Throw<std::invalid_argument>(
"Operator", "CompressMGARD", "Operate",
"MGARD only supports huffman/huffman_zstd lossless types");
}
}

// let mgard know the output buffer size
size_t sizeOut = helper::GetTotalSize(blockCount, helper::GetDataTypeSize(type));
Expand All @@ -147,9 +167,6 @@ size_t CompressMGARD::Operate(const char *dataIn, const Dims &blockStart, const
return 0;
}

mgard_x::Config config;
config.lossless = mgard_x::lossless_type::Huffman_Zstd;

PutParameter(bufferOut, bufferOutOffset, true);
void *compressedData = bufferOut + bufferOutOffset;
mgard_x::compress(mgardDim, mgardType, mgardCount, tolerance, s, errorBoundType, dataIn,
Expand Down
25 changes: 21 additions & 4 deletions source/adios2/operator/compress/CompressMGARDComplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ size_t CompressMGARDComplex::Operate(const char *dataIn, const Dims &blockStart,
double tolerance = 0.0;
double s = 0.0;
auto errorBoundType = mgard_x::error_bound_type::REL;
mgard_x::Config config;
config.lossless = mgard_x::lossless_type::Huffman_Zstd;

// input size under this bound will not compress
size_t thresholdSize = 100000;
Expand Down Expand Up @@ -129,6 +131,24 @@ size_t CompressMGARDComplex::Operate(const char *dataIn, const Dims &blockStart,
errorBoundType = mgard_x::error_bound_type::REL;
}
}
if (auto itLosslessType = m_Parameters.find("lossless_type");
itLosslessType != m_Parameters.end())
{
if (itLosslessType->second == "huffman")
{
config.lossless = mgard_x::lossless_type::Huffman;
}
else if (itLosslessType->second == "huffman_zstd")
{
config.lossless = mgard_x::lossless_type::Huffman_Zstd;
}
else
{
helper::Throw<std::invalid_argument>(
"Operator", "CompressMGARD", "Operate",
"MGARD only supports huffman/huffman_zstd lossless types");
}
}

// Calculate sizes
const size_t totalElements = helper::GetTotalSize(blockCount, 1); // Number of complex elements
Expand All @@ -143,9 +163,6 @@ size_t CompressMGARDComplex::Operate(const char *dataIn, const Dims &blockStart,
return 0;
}

mgard_x::Config config;
config.lossless = mgard_x::lossless_type::Huffman_Zstd;

// Check for device parameter
auto itDevice = m_Parameters.find("device");
if (itDevice != m_Parameters.end())
Expand Down Expand Up @@ -371,4 +388,4 @@ bool CompressMGARDComplex::IsDataTypeValid(const DataType type) const

} // end namespace compress
} // end namespace core
} // end namespace adios2
} // end namespace adios2
Loading