Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify operator API in preparation for adding into BP5, Part III #2874

Merged
merged 1 commit into from
Sep 21, 2021
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
26 changes: 0 additions & 26 deletions source/adios2/core/Operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,6 @@ void Operator::RunCallback2(void *arg0, const std::string &arg1,
CheckCallbackType("Callback2");
}

size_t Operator::BufferMaxSize(const size_t sizeIn) const
{
throw std::invalid_argument("ERROR: signature (const size_t) not supported "
"by derived class implemented with " +
m_Type + ", in call to BufferMaxSize\n");
}

#define declare_type(T) \
template <> \
size_t Operator::BufferMaxSize<T>(const T *dataIn, const Dims &dimensions, \
const Params &parameters) const \
{ \
return DoBufferMaxSize(dataIn, dimensions, helper::GetDataType<T>(), \
parameters); \
}
ADIOS2_FOREACH_ZFP_TYPE_1ARG(declare_type)
#undef declare_type

size_t Operator::Compress(const void * /*dataIn*/, const Dims & /*dimensions*/,
DataType /*type*/, void * /*bufferOut*/,
const Params & /*params*/, Params & /*info*/)
Expand All @@ -92,14 +74,6 @@ size_t Operator::Decompress(const void *bufferIn, const size_t sizeIn,
}

// PROTECTED
size_t Operator::DoBufferMaxSize(const void *dataIn, const Dims &dimensions,
DataType type, const Params &parameters) const
{
throw std::invalid_argument("ERROR: signature (const void*, const Dims& "
"std::string ) not supported "
"by derived class implemented with " +
m_Type + ", in call to BufferMaxSize\n");
}

Dims Operator::ConvertDims(const Dims &dimensions, const DataType type,
const size_t targetDims, const bool enforceDims,
Expand Down
29 changes: 0 additions & 29 deletions source/adios2/core/Operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,6 @@ class Operator
virtual void RunCallback2(void *, const std::string &, const std::string &,
const std::string &, const size_t, const Dims &,
const Dims &, const Dims &) const;
/**
* Returns a conservative buffer size to hold input data for classes
* @param sizeIn size of input data to be compressed in bytes
* @return recommended allocation for output buffer
*/
virtual size_t BufferMaxSize(const size_t sizeIn) const;

/**
* Used by Zfp
* Returns a conservative buffer size to hold input data for classes
* @param dataIn
* @param dimensions
* @return recommended allocation for output buffer in bytes
*/
template <class T>
size_t BufferMaxSize(const T *dataIn, const Dims &dimensions,
const Params &params) const;

/**
* @param dataIn
Expand All @@ -98,18 +81,6 @@ class Operator
/** Parameters associated with a particular Operator */
Params m_Parameters;

/**
* Used by CompressZfp
* Returns a conservative buffer size to hold input data for classes
* @param dataIn
* @param dimensions
* @param type
* @return conservative buffer size for allocation
*/
virtual size_t DoBufferMaxSize(const void *dataIn, const Dims &dimensions,
DataType type,
const Params &parameters) const;

/**
* Used by lossy compressors with a limitation on complex data types or
* dimentions Returns a adios2::Dims object that meets the requirement of a
Expand Down
5 changes: 0 additions & 5 deletions source/adios2/operator/compress/CompressBZIP2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ CompressBZIP2::CompressBZIP2(const Params &parameters)
{
}

size_t CompressBZIP2::BufferMaxSize(const size_t sizeIn) const
{
return static_cast<size_t>(std::ceil(1.1 * sizeIn) + 600);
}

size_t CompressBZIP2::Compress(const void *dataIn, const Dims &dimensions,
DataType type, void *bufferOut,
const Params &parameters, Params &info)
Expand Down
2 changes: 0 additions & 2 deletions source/adios2/operator/compress/CompressBZIP2.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class CompressBZIP2 : public Operator

~CompressBZIP2() = default;

size_t BufferMaxSize(const size_t sizeIn) const final;

/**
* Compression signature for legacy libraries that use void*
* @param dataIn
Expand Down
19 changes: 0 additions & 19 deletions source/adios2/operator/compress/CompressBlosc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,6 @@ CompressBlosc::CompressBlosc(const Params &parameters)
{
}

size_t CompressBlosc::BufferMaxSize(const size_t sizeIn) const
{
const size_t maxInputPerChunk = BLOSC_MAX_BUFFERSIZE;
const size_t numFullChunks = sizeIn / maxInputPerChunk;
const size_t sizeLastChunk = sizeIn % maxInputPerChunk;

const size_t maxOutputPerChunk = maxInputPerChunk + BLOSC_MAX_OVERHEAD;
const size_t maxOutputLastChunk = sizeLastChunk + BLOSC_MAX_OVERHEAD;

/* DataHeader is used to detect of old format which can only handle
* BLOSC_MAX_BUFFERSIZE (<2GiB) or the new adios2 chunked blosc format is
* used.
*/
const size_t maxRquiredDataMem = maxOutputPerChunk * numFullChunks +
maxOutputLastChunk + sizeof(DataHeader);

return maxRquiredDataMem;
}

size_t CompressBlosc::Compress(const void *dataIn, const Dims &dimensions,
DataType type, void *bufferOut,
const Params &parameters, Params &info)
Expand Down
2 changes: 0 additions & 2 deletions source/adios2/operator/compress/CompressBlosc.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class CompressBlosc : public Operator

~CompressBlosc() = default;

size_t BufferMaxSize(const size_t sizeIn) const final;

/**
* Compression signature for legacy libraries that use void*
* @param dataIn
Expand Down
5 changes: 0 additions & 5 deletions source/adios2/operator/compress/CompressLibPressio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,6 @@ CompressLibPressio::CompressLibPressio(const Params &parameters)
{
}

size_t CompressLibPressio::BufferMaxSize(const size_t sizeIn) const
{
return static_cast<size_t>(std::ceil(1.1 * sizeIn) + 600);
}

size_t CompressLibPressio::Compress(const void *dataIn, const Dims &dimensions,
DataType varType, void *bufferOut,
const Params &parameters, Params &info)
Expand Down
2 changes: 0 additions & 2 deletions source/adios2/operator/compress/CompressLibPressio.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class CompressLibPressio : public Operator

~CompressLibPressio() = default;

size_t BufferMaxSize(const size_t sizeIn) const final;

/**
* Compression signature for legacy libraries that use void*
* @param dataIn
Expand Down
5 changes: 0 additions & 5 deletions source/adios2/operator/compress/CompressSZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ namespace compress

CompressSZ::CompressSZ(const Params &parameters) : Operator("sz", parameters) {}

size_t CompressSZ::BufferMaxSize(const size_t sizeIn) const
{
return static_cast<size_t>(std::ceil(1.1 * sizeIn) + 600);
}

size_t CompressSZ::Compress(const void *dataIn, const Dims &dimensions,
DataType varType, void *bufferOut,
const Params &parameters, Params &info)
Expand Down
2 changes: 0 additions & 2 deletions source/adios2/operator/compress/CompressSZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class CompressSZ : public Operator

~CompressSZ() = default;

size_t BufferMaxSize(const size_t sizeIn) const final;

/**
* Compression signature for legacy libraries that use void*
* @param dataIn
Expand Down
13 changes: 0 additions & 13 deletions source/adios2/operator/compress/CompressZFP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,6 @@ CompressZFP::CompressZFP(const Params &parameters) : Operator("zfp", parameters)
{
}

size_t CompressZFP::DoBufferMaxSize(const void *dataIn, const Dims &dimensions,
DataType type,
const Params &parameters) const
{
Dims convertedDims = ConvertDims(dimensions, type, 3);
zfp_field *field = GetZFPField(dataIn, convertedDims, type);
zfp_stream *stream = GetZFPStream(convertedDims, type, parameters);
const size_t maxSize = zfp_stream_maximum_size(stream, field);
zfp_field_free(field);
zfp_stream_close(stream);
return maxSize;
}

size_t CompressZFP::Compress(const void *dataIn, const Dims &dimensions,
DataType type, void *bufferOut,
const Params &parameters, Params &info)
Expand Down
3 changes: 0 additions & 3 deletions source/adios2/operator/compress/CompressZFP.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ class CompressZFP : public Operator
zfp_stream *GetZFPStream(const Dims &dimensions, DataType type,
const Params &parameters) const;

size_t DoBufferMaxSize(const void *dataIn, const Dims &dimensions,
DataType type, const Params &parameters) const final;

/**
* check status from BZip compression and decompression functions
* @param status returned by BZip2 library
Expand Down