Skip to content

Commit

Permalink
Release 0.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
salasoom committed Oct 2, 2018
2 parents 87ff6e7 + fd28cef commit 25a554e
Show file tree
Hide file tree
Showing 107 changed files with 7,646 additions and 13,133 deletions.
104 changes: 88 additions & 16 deletions CMakeLists.txt
Expand Up @@ -30,6 +30,8 @@ project(ZFP VERSION ${ZFP_VERSION})
# Some boilerplate to setup nice output directories
#------------------------------------------------------------------------------#
include(GNUInstallDirs)
set(CMAKE_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/zfp
CACHE STRING "Installation CMake subdirectory")

list(INSERT CMAKE_MODULE_PATH 0 "${ZFP_SOURCE_DIR}/cmake")
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
Expand Down Expand Up @@ -88,22 +90,25 @@ cmake_dependent_option(BUILD_SHARED_LIBS

# PIC is always on for shared libs. This allows it to be selectable for
# static libs.
if(SHARED_LIBS_SUPPORTED)
cmake_dependent_option(ZFP_ENABLE_PIC
"Build with Position Independent Code" ON
"NOT BUILD_SHARED_LIBS" ON)
endif()
if(ZFP_ENABLE_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(DEFINED ZFP_ENABLE_PIC)
set(ZFP_ENABLE_PIC_DEFAULT ${ZFP_ENABLE_PIC})
elseif(DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
set(ZFP_ENABLE_PIC_DEFAULT ${CMAKE_POSITION_INDEPENDENT_CODE})
else()
set(ZFP_ENABLE_PIC_DEFAULT ${SHARED_LIBS_SUPPORTED})
endif()
cmake_dependent_option(ZFP_ENABLE_PIC
"Build with Position Independent Code" ${ZFP_ENABLE_PIC_DEFAULT}
"SHARED_LIBS_SUPPORTED" OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ${ZFP_ENABLE_PIC})

# Compile-time options.

set(ZFP_BIT_STREAM_WORD_SIZE 64 CACHE STRING
"Use smaller bit stream word type for finer rate granularity")
set_property(CACHE ZFP_BIT_STREAM_WORD_SIZE PROPERTY STRINGS "8;16;32;64")

option(ZFP_WITH_OPENMP "Enable OpenMP parallel compression" ON)
option(ZFP_WITH_CUDA "Enable CUDA parallel compression" OFF)

option(ZFP_WITH_BIT_STREAM_STRIDED
"Enable strided access for progressive zfp streams" OFF)
Expand All @@ -129,12 +134,36 @@ if((DEFINED ZFP_UINT64) AND (DEFINED ZFP_UINT64_SUFFIX))
list(APPEND zfp_defs ZFP_UINT64_SUFFIX=${ZFP_UINT64_SUFFIX})
endif()

if(ZFP_WITH_OPENMP)
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
# This odd cmake pattern here let's the OpenMP feature be either auto-detected,
# explicitly enabled, or explicitly disabled, instead of just on or off.
if(DEFINED ZFP_WITH_OPENMP)
option(ZFP_WITH_OPENMP "Enable OpenMP parallel compression"
${ZFP_WITH_OPENMP})
if(ZFP_WITH_OPENMP)
find_package(OpenMP COMPONENTS C REQUIRED)
endif()
else()
find_package(OpenMP COMPONENTS C)
option(ZFP_WITH_OPENMP "Enable OpenMP parallel compression" ${OPENMP_FOUND})
endif()

# Some compilers don't use explicit libraries on the link line for OpenMP but
# instead need to treat the OpenMP C flags as both compile and link flags
# i.e. -fopenmp for compiling and -lgomp for linking, use -fomp for both
# compiling and linking
if(ZFP_WITH_OPENMP AND NOT OpenMP_C_LIBRARIES)
set(OpenMP_C_LIBRARIES ${OpenMP_C_FLAGS})
endif()

if(ZFP_WITH_CUDA)
# use CUDA_BIN_DIR hint
set(ENV{CUDA_BIN_PATH} ${CUDA_BIN_DIR})
find_package(CUDA)
if(NOT CUDA_FOUND)
message(FATAL_ERROR "ZFP_WITH_CUDA is enabled, but a CUDA installation was not found.")
endif()
if(${CUDA_VERSION_MAJOR} LESS 7)
message(FATAL_ERROR "zfp requires at least CUDA 7.0.")
endif()
endif()

Expand Down Expand Up @@ -162,11 +191,32 @@ if(ZFP_WITH_CACHE_PROFILE)
list(APPEND zfp_defs ZFP_CACHE_PROFILE)
endif()

# Link libm only if necessary
include(CheckCSourceCompiles)
check_c_source_compiles("#include<math.h>\nfloat f; int main(){sqrt(f);return 0;}" HAVE_MATH)
if(NOT HAVE_MATH)
set(CMAKE_REQUIRED_LIBRARIES m)
check_c_source_compiles("#include<math.h>\nfloat f; int main(){sqrt(f);return 0;}" HAVE_LIBM_MATH)
unset(CMAKE_REQUIRED_LIBRARIES)
if(NOT HAVE_LIBM_MATH)
message(FATAL_ERROR "Unable to use C math library functions (with or without -lm)")
endif()
endif()

#------------------------------------------------------------------------------#
# Add source code
#------------------------------------------------------------------------------#
set(ZFP_LIBRARY_PREFIX "" CACHE STRING
"Prefix to prepend to the output library name")
mark_as_advanced(ZFP_LIBRARY_PREFIX)

add_subdirectory(src)

option(BUILD_CFP "Build CFP arrays library" OFF)
if(BUILD_CFP)
add_subdirectory(cfp)
endif()

option(BUILD_UTILITIES "Build command line utilities for zfp" ON)
if(BUILD_UTILITIES)
add_subdirectory(utils)
Expand All @@ -192,6 +242,28 @@ install(DIRECTORY array/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
#------------------------------------------------------------------------------#
# Build type: one of None, Debug, Release, RelWithDebInfo, MinSizeRel
#------------------------------------------------------------------------------#
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Type of CMake build" FORCE)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE Release)
endif()

#------------------------------------------------------------------------------#
# Packaging
#------------------------------------------------------------------------------#

# Add all targets to the build-tree export set
export(TARGETS zfp NAMESPACE zfp::
FILE "${PROJECT_BINARY_DIR}/zfp-targets.cmake")
configure_file(zfp-config.cmake.in
"${PROJECT_BINARY_DIR}/zfp-config.cmake" @ONLY)
configure_file(zfp-config-version.cmake.in
"${PROJECT_BINARY_DIR}/zfp-config-version.cmake" @ONLY)

# Install the zfp-config.cmake and zfp-config-version.cmake
install(FILES
"${PROJECT_BINARY_DIR}/zfp-config.cmake"
"${PROJECT_BINARY_DIR}/zfp-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}")

# Install the export set for use with the install-tree
install(EXPORT zfp-targets NAMESPACE zfp::
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}")
23 changes: 23 additions & 0 deletions Config
Expand Up @@ -13,6 +13,11 @@ CXX = g++
# common compiler options -----------------------------------------------------

FLAGS = -O3 -fPIC -Wall -pedantic -I../include
SOFLAGS =

# macOS compiler options (uncomment on macOS) ---------------------------------

# SOFLAGS += -undefined dynamic_lookup

# OpenMP compiler options -----------------------------------------------------

Expand Down Expand Up @@ -46,6 +51,24 @@ OMPFLAGS = -fopenmp
# count cache misses
# DEFS += -DZFP_WITH_CACHE_PROFILE

# build targets ---------------------------------------------------------------

BUILD_CFP = 0
BUILD_UTILITIES = 1
BUILD_EXAMPLES = 0
BUILD_TESTING = 1
BUILD_SHARED_LIBS = 0

ifneq ($(BUILD_SHARED_LIBS),0)
LIBRARY = shared
LIBZFP = libzfp.so
LIBCFP = libcfp.so
else
LIBRARY = static
LIBZFP = libzfp.a
LIBCFP = libcfp.a
endif

# conditionals ----------------------------------------------------------------

# enable OpenMP?
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
Copyright (c) 2014-2018, Lawrence Livermore National Security, LLC.
Produced at the Lawrence Livermore National Laboratory.
Written by Peter Lindstrom and Markus Salasoo.
Written by Peter Lindstrom, Markus Salasoo, and Matt Larsen.
LLNL-CODE-663824.
All rights reserved.

Expand Down
21 changes: 18 additions & 3 deletions Makefile
@@ -1,21 +1,36 @@
# see Config file for compile-time settings
include Config

MAKEFLAGS += --no-print-directory


# default: build all targets enabled in Config
all:
@cd src; $(MAKE) clean static
@echo $(LIBRARY)
@cd src; $(MAKE) clean $(LIBRARY)
ifneq ($(BUILD_CFP),0)
@cd cfp/src; $(MAKE) clean $(LIBRARY)
endif
ifneq ($(BUILD_UTILITIES),0)
@cd utils; $(MAKE) clean all
endif
ifneq ($(BUILD_TESTING),0)
@cd tests; $(MAKE) clean all
endif
ifneq ($(BUILD_EXAMPLES),0)
@cd examples; $(MAKE) clean all
endif

shared:
@cd src; $(MAKE) shared

# run basic regression tests
test:
@cd tests; $(MAKE) test


# clean all
clean:
@cd src; $(MAKE) clean
@cd cfp/src; $(MAKE) clean
@cd utils; $(MAKE) clean
@cd tests; $(MAKE) clean
@cd examples; $(MAKE) clean
77 changes: 42 additions & 35 deletions README.md
Expand Up @@ -46,34 +46,37 @@ DOCUMENTATION
-------------

Full
[documentation](http://zfp.readthedocs.io/en/release0.5.3/)
[documentation](http://zfp.readthedocs.io/en/release0.5.4/)
is available online via Read the Docs. A
[PDF](http://readthedocs.org/projects/zfp/downloads/pdf/release0.5.3/)
[PDF](http://readthedocs.org/projects/zfp/downloads/pdf/release0.5.4/)
version is also available.


INSTALLATION
------------

zfp consists of three distinct parts: a compression library written in C;
a set of C++ header files that implement compressed arrays; and a set of
C and C++ examples. The main compression codec is written in C and should
conform to both the ISO C89 and C99 standards. The C++ array classes are
implemented entirely in header files and can be included as is, but since
they call the compression library, applications must link with libzfp.
a set of C++ header files with C wrappers that implement compressed arrays;
and a set of C and C++ examples. The main compression codec is written in
C and should conform to both the ISO C89 and C99 standards. The C++ array
classes are implemented entirely in header files and can be included as is,
but since they call the compression library, applications must link with
libzfp.

On Linux, macOS, and MinGW, zfp is easiest compiled using gcc and gmake.
CMake support is also available, e.g. for Windows builds. See below for
CMake support is also available, e.g., for Windows builds. See below for
instructions on GNU and CMake builds.

zfp has successfully been built and tested using these compilers:

gcc versions 4.4.7, 4.7.2, 4.8.2, 4.9.2, 5.4.1, 6.3.0
icc versions 12.0.5, 12.1.5, 15.0.4, 16.0.1, 17.0.0, 18.0.0
clang version 3.6.0
xlc version 12.1
gcc versions 4.4.7, 4.9.4, 5.5.0, 6.1.0, 6.4.0, 7.1.0, 7.3.0, 8.1.0
icc versions 15.0.6, 16.0.4, 17.0.2, 18.0.2, 19.0.0
clang versions 3.9.1, 4.0.0, 5.0.0, 6.0.0
MinGW version 5.3.0
Visual Studio versions 14.0 (2015), 14.1 (2017)
Visual Studio versions 14 (2015), 15 (2017)

zfp conforms to various language standards, including C89, C99, C++98,
C++11, and C++14.

NOTE: zfp requires 64-bit compiler and operating system support.

Expand All @@ -84,23 +87,8 @@ To compile zfp using gcc, type
make

from this directory. This builds libzfp as a static library as well as
utilities and example programs. To optionally create a shared library,
type

make shared

and set LD_LIBRARY_PATH to point to ./lib. To test the compressor, type

make test

If the compilation or regression tests fail, it is possible that some of
the macros in the file 'Config' have to be adjusted. Also, the tests may
fail due to minute differences in the computed floating-point fields
being compressed (as indicated by checksum errors). It is surprisingly
difficult to portably generate a floating-point array that agrees
bit-for-bit across platforms. If most tests succeed and the failures
result in byte sizes and error values reasonably close to the expected
values, then it is likely that the compressor is working correctly.
utilities and example programs. See documentation for complete build
instructions.

## CMake builds

Expand All @@ -115,13 +103,32 @@ To also build the examples, replace the cmake line with

cmake -DBUILD_EXAMPLES=ON ..

To build zfp using Visual Studio on Windows, start an MSBuild shell and type
To build zfp using Visual Studio on Windows, start a DOS shell, cd to the
top-level zfp directory, and type

mkdir build
cd build
cmake ..
msbuild /p:Configuration=Release zfp.sln
msbuild /p:Configuration=Debug zfp.sln
cmake --build . --config Release

This builds zfp in release mode. Replace 'Release' with 'Debug' to build
zfp in debug mode. See the instructions for Linux on how to change the
cmake line to also build the example programs.

## Testing

To test that zfp is working properly, type

make test

or using CMake

ctest

This builds zfp in both debug and release mode. See the instructions for
Linux on how to change the cmake line to also build the example programs.
If the compilation or regression tests fail, it is possible that some of the
macros in the file 'Config' have to be adjusted. Also, the tests may fail
due to minute differences in the computed floating-point fields being
compressed, which will be indicated by checksum errors. If most tests
succeed and the failures result in byte sizes and error values reasonably
close to the expected values, then it is likely that the compressor is
working correctly.
23 changes: 23 additions & 0 deletions VERSIONS.md
@@ -1,5 +1,28 @@
# zfp Release Notes

## 0.5.4 (October 1, 2018)

- Added support for CUDA fixed-rate compression and decompression.

- Added views into compressed arrays for thread safety, nested array
indexing, slicing, and array subsetting.

- Added C language bindings for compressed arrays.

- Added support for compressing and decompressing 4D data.

- Changes:
- Execution policy now applies to both compression and decompression.
- Compressed array accessors now return Scalar type instead of
const Scalar& to avoid stale references to evicted cache lines.

- Bug fixes:
- Handling of negative strides.
- Command line tool handling of arrays with more than 2^32 elements.
- bitstream C++ compatibility.
- Respect minimum cache size request.


## 0.5.3 (March 28, 2018)

- Added support for OpenMP multithreaded compression (but not decompression).
Expand Down

0 comments on commit 25a554e

Please sign in to comment.