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

zfp: fix version compatibility for 1.0+ #3312

Merged
merged 1 commit into from
Aug 15, 2022
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
13 changes: 9 additions & 4 deletions cmake/DetectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ if(BZIP2_FOUND)
endif()

# ZFP
if(ADIOS2_USE_ZFP STREQUAL AUTO)
find_package(ZFP 0.5.1 CONFIG)
elseif(ADIOS2_USE_ZFP)
find_package(ZFP 0.5.1 REQUIRED CONFIG)
if(ADIOS2_USE_ZFP)
find_package(ZFP 1.0.0 CONFIG)
if(NOT ZFP_FOUND)
if(ADIOS2_USE_ZFP STREQUAL AUTO)
find_package(ZFP 0.5.3 CONFIG)
else()
find_package(ZFP 0.5.3 REQUIRED CONFIG)
endif()
endif()
endif()
if(ZFP_FOUND)
set(ADIOS2_HAVE_ZFP TRUE)
Expand Down
12 changes: 3 additions & 9 deletions source/adios2/operator/compress/CompressZFP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@
#include <sstream>
#include <zfp.h>

/* CMake will make sure zfp >= 5.0.1 */
#if ZFP_VERSION_RELEASE > 1 && !defined(ZFP_DEFAULT_EXECUTION_POLICY)

/* ZFP will default to SERIAL if CUDA is not available */
/* CMake will make sure zfp >= 0.5.3
ZFP will default to SERIAL if CUDA is not available */
#ifdef ADIOS2_HAVE_ZFP_CUDA
#define ZFP_DEFAULT_EXECUTION_POLICY zfp_exec_cuda
#else
#define ZFP_DEFAULT_EXECUTION_POLICY zfp_exec_serial
#endif

#endif

namespace adios2
{
namespace core
Expand Down Expand Up @@ -80,7 +76,7 @@ size_t CompressZFP::Operate(const char *dataIn, const Dims &blockStart,
PutParameter(bufferOut, bufferOutOffset,
static_cast<uint8_t>(ZFP_VERSION_MINOR));
PutParameter(bufferOut, bufferOutOffset,
static_cast<uint8_t>(ZFP_VERSION_RELEASE));
static_cast<uint8_t>(ZFP_VERSION_PATCH));
PutParameters(bufferOut, bufferOutOffset, m_Parameters);
// zfp V1 metadata end

Expand Down Expand Up @@ -302,7 +298,6 @@ zfp_stream *GetZFPStream(const Dims &dimensions, DataType type,
auto itPrecision = parameters.find("precision");
const bool hasPrecision = itPrecision != parameters.end();

#if ZFP_VERSION_RELEASE > 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chuckatkins is this also valid for 0.5.3?

auto itBackend = parameters.find("backend");
const bool hasBackend = itBackend != parameters.end();

Expand Down Expand Up @@ -332,7 +327,6 @@ zfp_stream *GetZFPStream(const Dims &dimensions, DataType type,

zfp_stream_set_execution(stream, policy);
}
#endif

if ((hasAccuracy && hasPrecision) || (hasAccuracy && hasRate) ||
(hasPrecision && hasRate) ||
Expand Down