pax_global_header 0000666 0000000 0000000 00000000064 15217434361 0014520 g ustar 00root root 0000000 0000000 52 comment=09c50ca121c11b0f93c8427662e28244b4a3e0b6
c-blosc2-3.1.5/ 0000775 0000000 0000000 00000000000 15217434361 0013132 5 ustar 00root root 0000000 0000000 c-blosc2-3.1.5/.editorconfig 0000664 0000000 0000000 00000000423 15217434361 0015606 0 ustar 00root root 0000000 0000000 ; Top-most EditorConfig file
root = true
; Global settings
[*]
end_of_line = LF
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
; C source files
[*.{h,c}]
indent_size = 2
; CMake
[CMakeLists.txt]
indent_size = 4
[*.cmake]
indent_size = 4
c-blosc2-3.1.5/.gitattributes 0000664 0000000 0000000 00000000035 15217434361 0016023 0 ustar 00root root 0000000 0000000 * text=auto
*.md text eol=lf
c-blosc2-3.1.5/.github/ 0000775 0000000 0000000 00000000000 15217434361 0014472 5 ustar 00root root 0000000 0000000 c-blosc2-3.1.5/.github/FUNDING.yml 0000664 0000000 0000000 00000000026 15217434361 0016305 0 ustar 00root root 0000000 0000000 github: FrancescAlted
c-blosc2-3.1.5/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 15217434361 0016655 5 ustar 00root root 0000000 0000000 c-blosc2-3.1.5/.github/ISSUE_TEMPLATE/bug_report.md 0000664 0000000 0000000 00000001062 15217434361 0021346 0 ustar 00root root 0000000 0000000 ---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Provide a minimal program reproducing the error.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Logs**
If applicable, add logs to help explain your problem.
**System information:**
- OS: [e.g. OSX]
- Compiler [e.g. gcc, clang]
- Version [e.g. 2.0.1]
**Additional context**
Add any other context about the problem here.
c-blosc2-3.1.5/.github/dependabot.yml 0000664 0000000 0000000 00000000371 15217434361 0017323 0 ustar 00root root 0000000 0000000 # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
c-blosc2-3.1.5/.github/workflows/ 0000775 0000000 0000000 00000000000 15217434361 0016527 5 ustar 00root root 0000000 0000000 c-blosc2-3.1.5/.github/workflows/cmake.yml 0000664 0000000 0000000 00000011755 15217434361 0020343 0 ustar 00root root 0000000 0000000 name: CI CMake
on: [push, pull_request]
jobs:
ci-cmake:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu GCC
os: ubuntu-latest
compiler: gcc
- name: Ubuntu GCC No Plugins
os: ubuntu-latest
compiler: gcc
cmake-args: -D BUILD_PLUGINS=OFF
# Out of source build
- name: Ubuntu GCC OSB
os: ubuntu-latest
compiler: gcc
build-dir: ../build
build-src-dir: ../c-blosc2
- name: Ubuntu GCC External LZ4
os: ubuntu-latest
compiler: gcc
packages: liblz4-1 liblz4-dev
cmake-args: -D PREFER_EXTERNAL_LZ4=ON
- name: Ubuntu GCC External ZLIB
os: ubuntu-latest
compiler: gcc
packages: zlib1g-dev
cmake-args: -D PREFER_EXTERNAL_ZLIB=ON
# Not too recent Zstd libs (< 1.4.4) in distros perform pretty bad on compression
# ratios when using dictionaries, making some tests not passing.
# Commenting this out for the time being.
# - name: Ubuntu GCC External ZSTD
# os: ubuntu-latest
# compiler: gcc
# packages: zstd libzstd-dev
# cmake-args: -D PREFER_EXTERNAL_ZSTD=ON
# For some reason, some tests do not pass on ARM SF and HF. Not sure what's going on,
# but having ARM AARCH64 working is good enough for now, so commenting the former out.
# - name: Ubuntu GCC ARM SF
# os: ubuntu-latest
# packages: qemu qemu-user gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libc-dev-armel-cross
# cmake-args: -D CMAKE_TOOLCHAIN_FILE=cmake/toolchain-armsf.cmake
# - name: Ubuntu GCC ARM HF
# os: ubuntu-latest
# packages: qemu qemu-user gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc-dev-armel-cross
# cmake-args: -D CMAKE_TOOLCHAIN_FILE=cmake/toolchain-armhf.cmake
# - name: Ubuntu GCC AARCH64
# os: ubuntu-latest
# packages: qemu-system-aarch64 qemu-user gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc-dev-arm64-cross
# cmake-args: -D CMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake
- name: Ubuntu GCC AARCH64 (native)
os: ubuntu-latest
arch: arm64
compiler: gcc
- name: Ubuntu Clang
os: ubuntu-latest
compiler: clang
- name: Ubuntu Clang No AVX2
os: ubuntu-latest
compiler: clang
cmake-args: -D DEACTIVATE_AVX2=ON
- name: Ubuntu Clang No AVX512
os: ubuntu-latest
compiler: clang
cmake-args: -D DEACTIVATE_AVX512=ON
- name: Ubuntu Clang No ZLIB
os: ubuntu-latest
compiler: clang
cmake-args: -D DEACTIVATE_ZLIB=ON
- name: Ubuntu Clang No ZSTD
os: ubuntu-latest
compiler: clang
cmake-args: -D DEACTIVATE_ZSTD=ON
- name: Windows Clang Win64
os: windows-latest
compiler: clang-cl
cmake-args: -G Ninja
- name: Windows MSVC Win64
os: windows-latest
compiler: cl
cmake-args: -A x64
- name: Windows GCC Ninja
os: windows-latest
compiler: gcc
cmake-args: -G Ninja
- name: Windows GCC MinGW
os: windows-latest
compiler: gcc
cmake-args: -G "MinGW Makefiles"
- name: macOS Clang
os: macOS-latest
compiler: clang
- name: macOS GCC
os: macOS-latest
compiler: gcc
steps:
- uses: actions/checkout@v7
- name: Install packages (Ubuntu)
if: runner.os == 'Linux' && matrix.packages
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.packages }}
- name: Install packages (Windows)
if: runner.os == 'Windows'
run: choco install ninja ${{ matrix.packages }}
- name: Install packages (macOS)
if: runner.os == 'macOS'
run: brew install ninja ${{ matrix.packages }}
- name: Generate project files
run: cmake -S ${{ matrix.build-src-dir || '.' }} -B ${{ matrix.build-dir || '.' }} ${{ matrix.cmake-args }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} -D BUILD_SHARED_LIBS=OFF -D CMAKE_C_COMPILER=${{ matrix.compiler }} -D CMAKE_CXX_COMPILER=${{ matrix.compiler }}
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
LDFLAGS: ${{ matrix.ldflags }}
CI: true
- name: Compile source code
run: cmake --build ${{ matrix.build-dir || '.' }} --config ${{ matrix.build-config || 'Release' }}
- name: Run test cases
run: ctest -C Release --output-on-failure --max-width 120
working-directory: ${{ matrix.build-dir || '.' }}
c-blosc2-3.1.5/.github/workflows/fuzz.yml 0000664 0000000 0000000 00000001146 15217434361 0020252 0 ustar 00root root 0000000 0000000 name: CI Fuzz
on: [push, pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'c-blosc2'
dry-run: false
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'c-blosc2'
fuzz-seconds: 600
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@v7
if: failure()
with:
name: artifacts
path: ./out/artifacts
c-blosc2-3.1.5/.gitignore 0000664 0000000 0000000 00000000116 15217434361 0015120 0 ustar 00root root 0000000 0000000 bench/bench
build*
.idea
.*.swp
cmake-build-*
/doc/doxygen/xml/
/doc/xml
.vs/
c-blosc2-3.1.5/.guix-channel 0000664 0000000 0000000 00000000066 15217434361 0015517 0 ustar 00root root 0000000 0000000 (channel
(version 0)
(directory ".guix/modules"))
c-blosc2-3.1.5/.guix/ 0000775 0000000 0000000 00000000000 15217434361 0014164 5 ustar 00root root 0000000 0000000 c-blosc2-3.1.5/.guix/modules/ 0000775 0000000 0000000 00000000000 15217434361 0015634 5 ustar 00root root 0000000 0000000 c-blosc2-3.1.5/.guix/modules/c-blosc2-package.scm 0000664 0000000 0000000 00000010263 15217434361 0021337 0 ustar 00root root 0000000 0000000 ;;; This file follows the suggestions in the article "From development
;;; environments to continuous integration—the ultimate guide to software
;;; development with Guix" by Ludovic Courtès at the Guix blog:
;;; .
(define-module (c-blosc2-package)
#:use-module (guix)
#:use-module (guix build-system cmake)
#:use-module (guix git-download)
#:use-module ((guix licenses)
#:prefix license:)
#:use-module (gnu packages compression)
#:use-module (ice-9 regex)
#:use-module (ice-9 textual-ports))
(define (current-source-root)
(dirname (dirname (current-source-directory))))
(define (get-c-blosc2-version)
(let ((version-path (string-append (current-source-root) "/include/blosc2.h"))
(version-rx (make-regexp
"^\\s*#\\s*define\\s*BLOSC2_VERSION_STRING\\s*\"([^\"]*)\".*"
regexp/newline)))
(call-with-input-file version-path
(lambda (port)
(let* ((version-body (get-string-all port))
(version-match (regexp-exec version-rx version-body)))
(and version-match
(match:substring version-match 1)))))))
(define vcs-file?
;; Return true if the given file is under version control.
(or (git-predicate (current-source-root))
(const #t)))
(define-public c-blosc2
(package
(name "c-blosc2")
(version (get-c-blosc2-version))
(source (local-file "../.."
"c-blosc2-checkout"
#:recursive? #t
#:select? (lambda (path stat)
(and (vcs-file? path stat)
(not (string-contains path
"/internal-complibs"))))))
(build-system cmake-build-system)
(arguments
;; Disable AVX2 by default as in Guix' c-blosc package.
`(#:configure-flags '("-DBUILD_STATIC=OFF"
"-DDEACTIVATE_AVX2=ON"
"-DDEACTIVATE_AVX512=ON"
"-DPREFER_EXTERNAL_LZ4=ON"
"-DPREFER_EXTERNAL_ZLIB=ON"
"-DPREFER_EXTERNAL_ZSTD=ON")))
(inputs (list lz4 zlib
;; The only input with a separate libs-only output.
`(,zstd "lib")))
(home-page "https://blosc.org")
(synopsis "Blocking, shuffling and lossless compression library")
(description
"Blosc is a high performance compressor optimized for binary
data (i.e. floating point numbers, integers and booleans, although it can
handle string data too). It has been designed to transmit data to the
processor cache faster than the traditional, non-compressed, direct memory
fetch approach via a @code{memcpy()} system call. Blosc main goal is not just
to reduce the size of large datasets on-disk or in-memory, but also to
accelerate memory-bound computations.
C-Blosc2 is the new major version of C-Blosc, and is backward compatible with
both the C-Blosc1 API and its in-memory format. However, the reverse thing is
generally not true for the format; buffers generated with C-Blosc2 are not
format-compatible with C-Blosc1 (i.e. forward compatibility is not
supported).")
(license license:bsd-3)))
(define (package-with-configure-flags p flags)
"Return P with FLAGS as additional 'configure' flags."
(package/inherit p
(arguments (substitute-keyword-arguments (package-arguments p)
((#:configure-flags original-flags
#~(list))
#~(append #$original-flags
#$flags))))))
(define-public c-blosc2-with-avx2
(package
(inherit (package-with-configure-flags c-blosc2
#~(list "-DDEACTIVATE_AVX2=OFF")))
(name "c-blosc2-with-avx2")))
(define-public c-blosc2-with-avx512
(package
(inherit (package-with-configure-flags c-blosc2
#~(list "-DDEACTIVATE_AVX2=OFF"
"-DDEACTIVATE_AVX512=OFF")))
(name "c-blosc2-with-avx512")))
c-blosc2
c-blosc2-3.1.5/.mailmap 0000664 0000000 0000000 00000000435 15217434361 0014555 0 ustar 00root root 0000000 0000000 Francesc Alted FrancescAlted
Francesc Alted FrancescAlted
Francesc Alted FrancescAlted
Francesc Alted FrancescAlted
c-blosc2-3.1.5/.readthedocs.yaml 0000664 0000000 0000000 00000001217 15217434361 0016362 0 ustar 00root root 0000000 0000000 # .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "mambaforge-4.10"
conda:
environment: doc/environment.yml
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: doc/conf.py
# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf
# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: doc/requirements.txt
c-blosc2-3.1.5/ANNOUNCE.md 0000664 0000000 0000000 00000002770 15217434361 0014670 0 ustar 00root root 0000000 0000000 # Announcing C-Blosc2 3.1.5
A fast, compressed, and persistent binary data store library for C.
## What is new?
This is a maintenance release that fixes the decompression of all-zeros
buffers whose length is not a multiple of ``typesize``. Such chunks were
previously rejected even though all-zeros decompression is just a ``memset``
and works regardless of element alignment. This affected, for example,
python-blosc2's ``compress2`` → ``decompress2`` round-trip for all-zeros
payloads with a length not divisible by the type size.
This release introduces no API/ABI changes.
For more info, see the release notes in:
https://github.com/Blosc/c-blosc2/blob/main/RELEASE_NOTES.md
## What is it?
Blosc2 is a high-performance data container optimized for binary data.
Blosc2 is the next generation of Blosc, an
[award-winning library](https://www.blosc.org/posts/prize-push-Blosc2)
that has been around for more than a decade.
Blosc2 expands the capabilities of Blosc by providing a higher level
container that is able to store many chunks on it (hence the super-block name).
It supports storing data on both memory and disk using the same API.
Also, it adds more compressors and filters.
## Download sources
The github repository is over here:
https://github.com/Blosc/c-blosc2
Blosc is distributed using the BSD license, see LICENSE.txt
for details.
## Mailing list
There is an official Blosc mailing list at:
blosc@googlegroups.com
https://groups.google.com/g/blosc
Enjoy Data!
- The Blosc Development Team
c-blosc2-3.1.5/Blosc2Config.cmake.in 0000664 0000000 0000000 00000013020 15217434361 0017007 0 ustar 00root root 0000000 0000000 # only add PUBLIC dependencies as well
# https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-a-package-configuration-file
include(CMakeFindDependencyMacro)
# Search in _ROOT:
# https://cmake.org/cmake/help/v3.12/policy/CMP0074.html
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# locate the installed FindABC.cmake modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Modules")
# this section stores which configuration options were set
set(HAVE_THREADS @HAVE_THREADS@)
set(HAVE_IPP @HAVE_IPP@)
set(HAVE_LZ4_CONFIG @HAVE_LZ4_CONFIG@)
set(HAVE_ZLIB_NG @HAVE_ZLIB_NG@)
set(HAVE_ZLIB_NG_CONFIG @HAVE_ZLIB_NG_CONFIG@)
set(HAVE_ZSTD_CONFIG @HAVE_ZSTD_CONFIG@)
set(DEACTIVATE_IPP @DEACTIVATE_IPP@)
set(DEACTIVATE_ZLIB @DEACTIVATE_ZLIB@)
set(DEACTIVATE_ZSTD @DEACTIVATE_ZSTD@)
set(PREFER_EXTERNAL_LZ4 @PREFER_EXTERNAL_LZ4@)
set(PREFER_EXTERNAL_ZLIB @PREFER_EXTERNAL_ZLIB@)
set(PREFER_EXTERNAL_ZSTD @PREFER_EXTERNAL_ZSTD@)
set(BLOSC_DEPENDENCY_MODE "@BLOSC_DEPENDENCY_MODE@")
set(HAVE_ZFP @HAVE_ZFP@)
set(BLOSC_ZFP_PROVIDER "@BLOSC_ZFP_PROVIDER@")
set(LZ4_FETCHED @LZ4_FETCHED@)
set(ZLIB_NG_FETCHED @ZLIB_NG_FETCHED@)
set(ZSTD_FETCHED @ZSTD_FETCHED@)
# find dependencies and their targets, which are used in our Blosc2Targets.cmake
# additionally, the Blosc2_..._FOUND variables are used to support
# find_package(Blosc2 ... COMPONENTS ... ...)
# this enables downstream projects to express the need for specific features.
set(CMAKE_THREAD_PREFER_PTHREAD TRUE) # pre 3.1
set(THREADS_PREFER_PTHREAD_FLAG TRUE) # CMake 3.1+
if(HAVE_THREADS)
find_dependency(Threads)
set(Blosc2_THREADS_FOUND TRUE)
else()
set(Blosc2_THREADS_FOUND FALSE)
endif()
if(NOT DEACTIVATE_IPP AND HAVE_IPP)
find_dependency(IPP)
set(Blosc2_IPP_FOUND FALSE)
else()
set(Blosc2_IPP_FOUND TRUE)
endif()
if(NOT LZ4_FETCHED)
if(HAVE_LZ4_CONFIG)
find_dependency(lz4 CONFIG)
else()
find_dependency(LZ4 MODULE)
endif()
endif()
set(Blosc2_LZ4_FOUND TRUE)
if(DEACTIVATE_ZLIB)
set(Blosc2_ZLIB_FOUND FALSE)
elseif(ZLIB_NG_FETCHED)
set(Blosc2_ZLIB_FOUND TRUE)
else()
if(HAVE_ZLIB_NG)
if(HAVE_ZLIB_NG_CONFIG)
find_dependency(zlib-ng CONFIG)
else()
find_dependency(ZLIB_NG MODULE)
endif()
else()
find_dependency(ZLIB)
endif()
set(Blosc2_ZLIB_FOUND TRUE)
endif()
if(DEACTIVATE_ZSTD)
set(Blosc2_ZSTD_FOUND FALSE)
elseif(ZSTD_FETCHED)
set(Blosc2_ZSTD_FOUND TRUE)
else()
if(HAVE_ZSTD_CONFIG)
find_dependency(zstd CONFIG)
else()
find_dependency(ZSTD MODULE)
endif()
set(Blosc2_ZSTD_FOUND TRUE)
endif()
if(HAVE_ZFP)
set(Blosc2_ZFP_FOUND TRUE)
if(BLOSC_ZFP_PROVIDER STREQUAL "EXTERNAL")
find_package(zfp CONFIG QUIET)
if(NOT zfp_FOUND)
find_package(ZFP CONFIG QUIET)
endif()
if(NOT zfp_FOUND AND NOT ZFP_FOUND)
find_dependency(ZFP MODULE)
endif()
set(BLOSC_ZFP_TARGET "")
foreach(BLOSC_ZFP_CANDIDATE zfp ZFP::zfp zfp::zfp ZFP::ZFP)
if(TARGET ${BLOSC_ZFP_CANDIDATE} AND NOT BLOSC_ZFP_TARGET)
set(BLOSC_ZFP_TARGET ${BLOSC_ZFP_CANDIDATE})
endif()
endforeach()
if(BLOSC_ZFP_TARGET AND NOT TARGET zfp)
add_library(zfp INTERFACE IMPORTED)
target_link_libraries(zfp INTERFACE ${BLOSC_ZFP_TARGET})
endif()
endif()
else()
set(Blosc2_ZFP_FOUND FALSE)
endif()
# define central Blosc2::blosc2_shared/static targets
include("${CMAKE_CURRENT_LIST_DIR}/Blosc2Targets.cmake")
# check if components are fulfilled and set Blosc2__FOUND vars
# Blosc2_FIND_COMPONENTS is a list set by find_package(... COMPONENTS ... ...)
# likewise Blosc2_FIND_REQUIRED_... per component specified
foreach(comp ${Blosc2_FIND_COMPONENTS})
if(NOT Blosc2_${comp}_FOUND)
if(Blosc2_FIND_REQUIRED_${comp})
set(Blosc2_FOUND FALSE)
endif()
endif()
endforeach()
# Defines imported targets for Blosc2 inside a Python wheel
# ------------------------------
# Shared library target
# ------------------------------
if(NOT TARGET Blosc2::blosc2_shared)
add_library(Blosc2::blosc2_shared SHARED IMPORTED GLOBAL)
if(WIN32)
# MSVC: import library (.lib) + runtime DLL (.dll)
set_target_properties(Blosc2::blosc2_shared PROPERTIES
IMPORTED_IMPLIB "${CMAKE_CURRENT_LIST_DIR}/../blosc2_shared.lib"
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/../blosc2_shared.dll"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../../include"
)
else()
# Linux/macOS
set_target_properties(Blosc2::blosc2_shared PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/../blosc2_shared.so"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../../include"
)
endif()
endif()
# ------------------------------
# Static library target
# ------------------------------
if(NOT TARGET Blosc2::blosc2_static)
add_library(Blosc2::blosc2_static STATIC IMPORTED GLOBAL)
if(MSVC)
# Windows static library uses .lib
set_target_properties(Blosc2::blosc2_static PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/../blosc2_static.lib"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../../include"
)
else()
# Linux/macOS static library uses .a
set_target_properties(Blosc2::blosc2_static PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/../blosc2_static.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../../include"
)
endif()
endif()
c-blosc2-3.1.5/CMakeLists.txt 0000664 0000000 0000000 00000110365 15217434361 0015700 0 ustar 00root root 0000000 0000000 # Blosc - Blocked Shuffling and Compression Library
#
# Copyright (c) 2021 Blosc Development Team
# https://blosc.org
# License: BSD 3-Clause (see LICENSE.txt)
#
# See LICENSE.txt for details about copyright and rights to use.
# CMake build system for Blosc
# ============================
#
# Available options:
#
# BUILD_STATIC: default ON
# build the static version of the Blosc library
# BUILD_SHARED: default ON
# build the shared library version of the Blosc library
# BUILD_TESTS: default ON
# build test programs and generates the "test" target
# BUILD_FUZZERS: default ON
# build fuzz test programs and generates the "fuzz" target
# BUILD_BENCHMARKS: default ON
# build the benchmark programs
# BUILD_EXAMPLES: default ON
# build the examples programs
# BUILD_PLUGINS: default ON
# build the plugins programs
# BUILD_LITE: default OFF
# build a lite version (only with BloscLZ and LZ4/LZ4HC) of the blosc library
# DEACTIVATE_AVX2: default OFF
# do not attempt to build with AVX2 instructions
# DEACTIVATE_AVX512: default OFF
# do not attempt to build with AVX512 instructions
# DEACTIVATE_ZLIB: default OFF
# do not include support for the Zlib library
# DEACTIVATE_ZSTD: default OFF
# do not include support for the Zstd library
# WITH_ZLIB_OPTIM: default ON
# set WITH_OPTIM when building the fetched zlib-ng library; setting OFF is useful for wasm32 targets
# PREFER_EXTERNAL_LZ4: default OFF
# when found, use the installed LZ4 libs instead of fetching upstream sources
# PREFER_EXTERNAL_ZLIB: default OFF
# when found, use the installed Zlib/Zlib-ng libs instead of fetching upstream sources
# PREFER_EXTERNAL_ZSTD: default OFF
# when found, use the installed Zstd libs instead of fetching upstream sources
# TEST_INCLUDE_BENCH_SHUFFLE_1: default ON
# add a test that runs the benchmark program passing "shuffle" with 1
# thread as second parameter
# TEST_INCLUDE_BENCH_SHUFFLE_N: default ON
# add a test that runs the benchmark program passing "shuffle" with all
# threads as second parameter
# TEST_INCLUDE_BENCH_BITSHUFFLE_1: default ON
# add a test that runs the benchmark program passing "bitshuffle" with 1
# thread as second parameter
# TEST_INCLUDE_BENCH_BITSHUFFLE_N: default ON
# add a test that runs the benchmark program passing "bitshuffle" with
# all threads as second parameter
# TEST_INCLUDE_BENCH_SUITE: default OFF
# add a test that runs the benchmark program passing "suite"
# as first parameter
# TEST_INCLUDE_BENCH_HARDSUITE: default OFF
# add a test that runs the benchmark program passing "hardsuite"
# as first parameter
# TEST_INCLUDE_BENCH_EXTREMESUITE: default OFF
# add a test that runs the benchmark program passing "extremesuite"
# as first parameter
# TEST_INCLUDE_BENCH_DEBUGSUITE: default OFF
# add a test that runs the benchmark program passing "debugsuite"
# as first parameter
#
# Components:
#
# LIB: includes blosc2.so
# DEV: static includes blosc2.a and blosc2.h
if(NOT WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
endif()
cmake_minimum_required(VERSION 3.16.3)
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.4)
cmake_policy(SET CMP0063 NEW)
endif()
# The project can have ASM (zstd 1.5.2 is starting to use it)
project(blosc LANGUAGES C ASM)
# parse the full version numbers from blosc2.h
file(READ include/blosc2.h _blosc2_h_contents)
string(REGEX REPLACE ".*#define[ \t]+BLOSC2_VERSION_MAJOR[ \t]+([0-9]+).*"
"\\1" BLOSC2_VERSION_MAJOR ${_blosc2_h_contents})
string(REGEX REPLACE ".*#define[ \t]+BLOSC2_VERSION_MINOR[ \t]+([0-9]+).*"
"\\1" BLOSC2_VERSION_MINOR ${_blosc2_h_contents})
string(REGEX REPLACE ".*#define[ \t]+BLOSC2_VERSION_RELEASE[ \t]+([0-9]+).*"
"\\1" BLOSC2_VERSION_PATCH ${_blosc2_h_contents})
string(REGEX REPLACE ".*#define[ \t]+BLOSC2_VERSION_STRING[ \t]+\"([-0-9A-Za-z.]+)\".*"
"\\1" BLOSC2_VERSION_STRING ${_blosc2_h_contents})
message("Configuring for Blosc version: " ${BLOSC2_VERSION_STRING})
# options
option(BUILD_STATIC
"Build a static version of the blosc library." ON)
option(BUILD_SHARED
"Build a shared library version of the blosc library." ON)
option(BUILD_TESTS
"Build test programs from the blosc compression library" ON)
option(BUILD_FUZZERS
"Build fuzzer programs from the blosc compression library" ${BUILD_STATIC})
option(BUILD_BENCHMARKS
"Build benchmark programs from the blosc compression library" ON)
option(BUILD_EXAMPLES
"Build example programs from the blosc compression library" ON)
option(BUILD_PLUGINS
"Build plugins programs from the blosc compression library" ON)
option(BUILD_LITE
"Build a lite version (only with BloscLZ and LZ4/LZ4HC) of the blosc library." OFF)
option(DEACTIVATE_AVX2
"Do not attempt to build with AVX2 instructions" OFF)
option(DEACTIVATE_AVX512
"Do not attempt to build with AVX512 instructions" OFF)
option(DEACTIVATE_ZLIB
"Do not include support for the Zlib library." OFF)
option(DEACTIVATE_ZSTD
"Do not include support for the Zstd library." OFF)
option(PREFER_EXTERNAL_LZ4
"Find and use external LZ4 library instead of fetching sources." OFF)
option(PREFER_EXTERNAL_ZLIB
"Find and use external ZLIB library instead of fetching sources." OFF)
option(PREFER_EXTERNAL_ZSTD
"Find and use external ZSTD library instead of fetching sources." OFF)
option(WITH_ZLIB_OPTIM
"Set WITH_OPTIM for ZLIB, turning off is useful for compiling for wasm32 targets." ON)
set(BLOSC_DEPENDENCY_MODE "BUNDLED" CACHE STRING
"Dependency resolution mode: BUNDLED uses fetched dependencies, EXTERNAL requires system dependencies, AUTO tries system dependencies before fetching.")
set_property(CACHE BLOSC_DEPENDENCY_MODE PROPERTY STRINGS BUNDLED EXTERNAL AUTO)
set(BLOSC_ENABLE_ZFP "AUTO" CACHE STRING
"ZFP codec support: AUTO enables it when available, ON requires it, OFF disables it.")
set_property(CACHE BLOSC_ENABLE_ZFP PROPERTY STRINGS AUTO ON OFF)
set(BLOSC_LZ4_VERSION "1.10.0" CACHE STRING
"lz4 version to use when fetching internal sources.")
set(BLOSC_LZ4_SOURCE_DIR "" CACHE PATH
"Optional local lz4 checkout to use instead of downloading sources.")
set(BLOSC_ZLIBNG_VERSION "2.3.3" CACHE STRING
"zlib-ng version to use when fetching internal sources.")
set(BLOSC_ZLIBNG_SOURCE_DIR "" CACHE PATH
"Optional local zlib-ng checkout to use instead of downloading sources.")
set(BLOSC_ZSTD_VERSION "1.5.7" CACHE STRING
"zstd version to use when fetching internal sources.")
set(BLOSC_ZSTD_SOURCE_DIR "" CACHE PATH
"Optional local zstd checkout to use instead of downloading sources.")
set(BLOSC_ZFP_VERSION "1.0.1" CACHE STRING
"zfp version to use when fetching plugin sources.")
set(BLOSC_ZFP_SOURCE_DIR "" CACHE PATH
"Optional local zfp checkout to use instead of downloading plugin sources.")
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(GNUInstallDirs)
if(MINGW)
# This gets us DLL resource information when compiling on MinGW.
if(NOT CMAKE_RC_COMPILER)
set(CMAKE_RC_COMPILER windres.exe)
endif()
endif()
if(ENABLE_ASAN)
message(STATUS "Enabling ASAN")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Os -fno-omit-frame-pointer -fsanitize=address")
endif()
if(BUILD_PLUGINS AND BUILD_LITE)
message(FATAL_ERROR "Both plugins and lite Blosc versions can not be built at the same time.")
endif()
if(BUILD_LITE)
set(DEACTIVATE_ZLIB ON)
set(DEACTIVATE_ZSTD ON)
endif()
string(TOUPPER "${BLOSC_DEPENDENCY_MODE}" BLOSC_DEPENDENCY_MODE)
set(BLOSC_DEPENDENCY_MODE "${BLOSC_DEPENDENCY_MODE}" CACHE STRING
"Dependency resolution mode: BUNDLED uses fetched dependencies, EXTERNAL requires system dependencies, AUTO tries system dependencies before fetching." FORCE)
if(NOT BLOSC_DEPENDENCY_MODE STREQUAL "BUNDLED" AND
NOT BLOSC_DEPENDENCY_MODE STREQUAL "EXTERNAL" AND
NOT BLOSC_DEPENDENCY_MODE STREQUAL "AUTO")
message(FATAL_ERROR "BLOSC_DEPENDENCY_MODE must be one of BUNDLED, EXTERNAL, or AUTO")
endif()
string(TOUPPER "${BLOSC_ENABLE_ZFP}" BLOSC_ENABLE_ZFP)
set(BLOSC_ENABLE_ZFP "${BLOSC_ENABLE_ZFP}" CACHE STRING
"ZFP codec support: AUTO enables it when available, ON requires it, OFF disables it." FORCE)
if(NOT BLOSC_ENABLE_ZFP STREQUAL "AUTO" AND
NOT BLOSC_ENABLE_ZFP STREQUAL "ON" AND
NOT BLOSC_ENABLE_ZFP STREQUAL "OFF")
message(FATAL_ERROR "BLOSC_ENABLE_ZFP must be one of AUTO, ON, or OFF")
endif()
# Threads
set(CMAKE_THREAD_PREFER_PTHREAD TRUE) # pre 3.1
set(THREADS_PREFER_PTHREAD_FLAG TRUE) # CMake 3.1+
if(WIN32)
# try to use the system library
find_package(Threads)
else()
find_package(Threads REQUIRED)
endif()
if(Threads_FOUND)
set(HAVE_THREADS ON)
else()
set(HAVE_THREADS OFF)
endif()
set(BLOSC_FIND_EXTERNAL_LZ4 FALSE)
set(BLOSC_REQUIRE_EXTERNAL_LZ4 FALSE)
if(BLOSC_DEPENDENCY_MODE STREQUAL "EXTERNAL")
set(BLOSC_FIND_EXTERNAL_LZ4 TRUE)
set(BLOSC_REQUIRE_EXTERNAL_LZ4 TRUE)
elseif(BLOSC_DEPENDENCY_MODE STREQUAL "AUTO" OR PREFER_EXTERNAL_LZ4)
set(BLOSC_FIND_EXTERNAL_LZ4 TRUE)
endif()
if(BLOSC_FIND_EXTERNAL_LZ4)
find_package(LZ4 CONFIG NAMES lz4)
if(LZ4_FOUND)
set(HAVE_LZ4_CONFIG TRUE)
else()
find_package(LZ4 MODULE)
endif()
endif()
if(NOT LZ4_FOUND AND BLOSC_REQUIRE_EXTERNAL_LZ4)
message(FATAL_ERROR "BLOSC_DEPENDENCY_MODE=EXTERNAL requires an external LZ4 package. Install LZ4 or use BLOSC_DEPENDENCY_MODE=BUNDLED/AUTO.")
endif()
if(NOT LZ4_FOUND)
include(FetchContent)
set(LZ4_BUILD_CLI OFF CACHE BOOL "" FORCE)
set(LZ4_BUILD_LEGACY_LZ4C OFF CACHE BOOL "" FORCE)
set(LZ4_BUNDLED_MODE ON CACHE BOOL "" FORCE)
set(LZ4_POSITION_INDEPENDENT_LIB ON CACHE BOOL "" FORCE)
if(BLOSC_LZ4_SOURCE_DIR)
message(STATUS "Using lz4 via FetchContent from local checkout: ${BLOSC_LZ4_SOURCE_DIR}")
FetchContent_Declare(
lz4
SOURCE_DIR "${BLOSC_LZ4_SOURCE_DIR}"
SOURCE_SUBDIR build/cmake)
else()
message(STATUS "Using lz4 ${BLOSC_LZ4_VERSION} via FetchContent download")
FetchContent_Declare(
lz4
URL "https://github.com/lz4/lz4/archive/refs/tags/v${BLOSC_LZ4_VERSION}.tar.gz"
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
SOURCE_SUBDIR build/cmake)
endif()
FetchContent_GetProperties(lz4)
if(NOT lz4_POPULATED)
if(POLICY CMP0169)
cmake_policy(PUSH)
cmake_policy(SET CMP0169 OLD)
endif()
FetchContent_Populate(lz4)
if(POLICY CMP0169)
cmake_policy(POP)
endif()
add_subdirectory("${lz4_SOURCE_DIR}/build/cmake" "${lz4_BINARY_DIR}" EXCLUDE_FROM_ALL)
endif()
set(LZ4_FETCHED TRUE)
set(LZ4_FOUND TRUE)
set(LZ4_SOURCE_DIR "${lz4_SOURCE_DIR}")
set(LZ4_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/blosc2/thirdparty/lz4")
if(TARGET lz4_static)
set_target_properties(lz4_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_property(TARGET lz4_static PROPERTY INTERFACE_INCLUDE_DIRECTORIES
"$"
"$")
endif()
endif()
if(NOT DEACTIVATE_ZLIB)
set(BLOSC_FIND_EXTERNAL_ZLIB FALSE)
set(BLOSC_REQUIRE_EXTERNAL_ZLIB FALSE)
if(BLOSC_DEPENDENCY_MODE STREQUAL "EXTERNAL")
set(BLOSC_FIND_EXTERNAL_ZLIB TRUE)
set(BLOSC_REQUIRE_EXTERNAL_ZLIB TRUE)
elseif(BLOSC_DEPENDENCY_MODE STREQUAL "AUTO" OR PREFER_EXTERNAL_ZLIB)
set(BLOSC_FIND_EXTERNAL_ZLIB TRUE)
endif()
if(BLOSC_FIND_EXTERNAL_ZLIB)
find_package(ZLIB_NG CONFIG NAMES zlib-ng)
if(ZLIB_NG_FOUND)
set(HAVE_ZLIB_NG TRUE)
set(HAVE_ZLIB_NG_CONFIG TRUE)
else()
find_package(ZLIB_NG MODULE)
if(ZLIB_NG_FOUND)
set(HAVE_ZLIB_NG TRUE)
else()
find_package(ZLIB)
endif()
endif()
endif()
if(NOT (ZLIB_NG_FOUND OR ZLIB_FOUND) AND BLOSC_REQUIRE_EXTERNAL_ZLIB)
message(FATAL_ERROR "BLOSC_DEPENDENCY_MODE=EXTERNAL requires an external zlib-ng or zlib package. Install one or use BLOSC_DEPENDENCY_MODE=BUNDLED/AUTO.")
endif()
if(NOT (ZLIB_NG_FOUND OR ZLIB_FOUND))
include(FetchContent)
if (NOT WITH_ZLIB_OPTIM)
set(WITH_OPTIM OFF CACHE BOOL "Disable zlib-ng architecture optimizations when fetched via FetchContent" FORCE)
set(WITH_RUNTIME_CPU_DETECTION OFF CACHE BOOL "Disable zlib-ng runtime CPU detection when fetched via FetchContent" FORCE)
endif()
set(SKIP_INSTALL_ALL ON CACHE BOOL "Skip zlib-ng install targets when fetched via FetchContent" FORCE)
set(BUILD_TESTING OFF CACHE BOOL "Disable zlib-ng tests when fetched via FetchContent" FORCE)
set(WITH_GTEST OFF CACHE BOOL "Disable zlib-ng GTest when fetched via FetchContent" FORCE)
set(WITH_FUZZERS OFF CACHE BOOL "Disable zlib-ng fuzzers when fetched via FetchContent" FORCE)
set(WITH_BENCHMARKS OFF CACHE BOOL "Disable zlib-ng benchmarks when fetched via FetchContent" FORCE)
set(WITH_BENCHMARK_APPS OFF CACHE BOOL "Disable zlib-ng benchmark apps when fetched via FetchContent" FORCE)
if(BLOSC_ZLIBNG_SOURCE_DIR)
message(STATUS "Using zlib-ng via FetchContent from local checkout: ${BLOSC_ZLIBNG_SOURCE_DIR}")
FetchContent_Declare(
zlib_ng
SOURCE_DIR "${BLOSC_ZLIBNG_SOURCE_DIR}")
else()
message(STATUS "Using zlib-ng ${BLOSC_ZLIBNG_VERSION} via FetchContent download")
FetchContent_Declare(
zlib_ng
URL "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/${BLOSC_ZLIBNG_VERSION}.tar.gz"
DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
endif()
FetchContent_MakeAvailable(zlib_ng)
set(HAVE_ZLIB_NG TRUE)
set(ZLIB_NG_FETCHED TRUE)
set(ZLIB_NG_FOUND TRUE)
set(ZLIB_NG_BUILD_DIR "${zlib_ng_BINARY_DIR}")
set(ZLIB_NG_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/blosc2/thirdparty/zlib-ng")
set(ZLIB_NG_INSTALL_TARGET "")
if(TARGET zlib-ng-static)
get_target_property(ZLIB_NG_INSTALL_TARGET zlib-ng-static ALIASED_TARGET)
if(NOT ZLIB_NG_INSTALL_TARGET)
set(ZLIB_NG_INSTALL_TARGET zlib-ng-static)
endif()
elseif(TARGET zlib-ng)
get_target_property(ZLIB_NG_INSTALL_TARGET zlib-ng ALIASED_TARGET)
if(NOT ZLIB_NG_INSTALL_TARGET)
set(ZLIB_NG_INSTALL_TARGET zlib-ng)
endif()
endif()
if(ZLIB_NG_INSTALL_TARGET)
set_target_properties(${ZLIB_NG_INSTALL_TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_property(TARGET ${ZLIB_NG_INSTALL_TARGET} PROPERTY INTERFACE_INCLUDE_DIRECTORIES
"$"
"$"
"$")
endif()
endif()
set(HAVE_ZLIB TRUE)
endif()
if(NOT DEACTIVATE_ZSTD)
set(BLOSC_FIND_EXTERNAL_ZSTD FALSE)
set(BLOSC_REQUIRE_EXTERNAL_ZSTD FALSE)
if(BLOSC_DEPENDENCY_MODE STREQUAL "EXTERNAL")
set(BLOSC_FIND_EXTERNAL_ZSTD TRUE)
set(BLOSC_REQUIRE_EXTERNAL_ZSTD TRUE)
elseif(BLOSC_DEPENDENCY_MODE STREQUAL "AUTO" OR PREFER_EXTERNAL_ZSTD)
set(BLOSC_FIND_EXTERNAL_ZSTD TRUE)
endif()
if(BLOSC_FIND_EXTERNAL_ZSTD)
find_package(ZSTD CONFIG NAMES zstd)
if(ZSTD_FOUND)
set(HAVE_ZSTD_CONFIG TRUE)
else()
find_package(ZSTD MODULE)
endif()
endif()
if(NOT ZSTD_FOUND AND BLOSC_REQUIRE_EXTERNAL_ZSTD)
message(FATAL_ERROR "BLOSC_DEPENDENCY_MODE=EXTERNAL requires an external Zstd package. Install Zstd or use BLOSC_DEPENDENCY_MODE=BUNDLED/AUTO.")
endif()
if(NOT ZSTD_FOUND)
include(FetchContent)
set(ZSTD_BUILD_PROGRAMS OFF CACHE BOOL "Disable zstd programs when fetched via FetchContent" FORCE)
set(ZSTD_BUILD_SHARED OFF CACHE BOOL "Disable shared zstd library when fetched via FetchContent" FORCE)
set(ZSTD_BUILD_STATIC ON CACHE BOOL "Enable static zstd library when fetched via FetchContent" FORCE)
set(ZSTD_BUILD_TESTS OFF CACHE BOOL "Disable zstd tests when fetched via FetchContent" FORCE)
set(ZSTD_BUILD_CONTRIB OFF CACHE BOOL "Disable zstd contrib targets when fetched via FetchContent" FORCE)
set(ZSTD_MULTITHREAD_SUPPORT OFF CACHE BOOL "Disable zstd multithread support when fetched via FetchContent" FORCE)
if(BLOSC_ZSTD_SOURCE_DIR)
message(STATUS "Using zstd via FetchContent from local checkout: ${BLOSC_ZSTD_SOURCE_DIR}")
FetchContent_Declare(
zstd
SOURCE_DIR "${BLOSC_ZSTD_SOURCE_DIR}"
SOURCE_SUBDIR build/cmake)
else()
message(STATUS "Using zstd ${BLOSC_ZSTD_VERSION} via FetchContent download")
FetchContent_Declare(
zstd
URL "https://github.com/facebook/zstd/archive/refs/tags/v${BLOSC_ZSTD_VERSION}.tar.gz"
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
SOURCE_SUBDIR build/cmake)
endif()
FetchContent_GetProperties(zstd)
if(NOT zstd_POPULATED)
if(POLICY CMP0169)
cmake_policy(PUSH)
cmake_policy(SET CMP0169 OLD)
endif()
FetchContent_Populate(zstd)
if(POLICY CMP0169)
cmake_policy(POP)
endif()
add_subdirectory("${zstd_SOURCE_DIR}/build/cmake" "${zstd_BINARY_DIR}" EXCLUDE_FROM_ALL)
endif()
set(HAVE_ZSTD TRUE)
set(ZSTD_FETCHED TRUE)
set(ZSTD_FOUND TRUE)
set(ZSTD_BUILD_DIR "${zstd_BINARY_DIR}")
set(ZSTD_SOURCE_DIR "${zstd_SOURCE_DIR}")
set(ZSTD_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/blosc2/thirdparty/zstd")
if(TARGET libzstd_static)
set_target_properties(libzstd_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_property(TARGET libzstd_static PROPERTY INTERFACE_INCLUDE_DIRECTORIES
"$"
"$")
# Silence GCC false positives in fetched legacy zstd sources on some Linux/amd64 builds.
target_compile_options(libzstd_static PRIVATE
$<$:-Wno-maybe-uninitialized>)
endif()
else()
set(HAVE_ZSTD TRUE)
endif()
endif()
set(HAVE_ZFP FALSE)
set(BLOSC_ZFP_PROVIDER "NONE")
set(BLOSC_ZFP_TARGET "")
set(ZFP_FOUND FALSE)
if(BUILD_PLUGINS AND NOT BLOSC_ENABLE_ZFP STREQUAL "OFF")
set(BLOSC_FIND_EXTERNAL_ZFP FALSE)
set(BLOSC_ALLOW_BUNDLED_ZFP FALSE)
if(BLOSC_DEPENDENCY_MODE STREQUAL "EXTERNAL")
set(BLOSC_FIND_EXTERNAL_ZFP TRUE)
elseif(BLOSC_DEPENDENCY_MODE STREQUAL "AUTO")
set(BLOSC_FIND_EXTERNAL_ZFP TRUE)
set(BLOSC_ALLOW_BUNDLED_ZFP TRUE)
else()
set(BLOSC_ALLOW_BUNDLED_ZFP TRUE)
endif()
if(BLOSC_ENABLE_ZFP STREQUAL "ON" AND NOT BLOSC_DEPENDENCY_MODE STREQUAL "EXTERNAL")
set(BLOSC_ALLOW_BUNDLED_ZFP TRUE)
endif()
if(BLOSC_FIND_EXTERNAL_ZFP)
find_package(zfp CONFIG QUIET)
if(NOT zfp_FOUND)
find_package(ZFP CONFIG QUIET)
endif()
if(NOT zfp_FOUND AND NOT ZFP_FOUND)
find_package(ZFP MODULE QUIET)
endif()
if(zfp_FOUND OR ZFP_FOUND)
set(ZFP_FOUND TRUE)
set(BLOSC_ZFP_PROVIDER "EXTERNAL")
foreach(BLOSC_ZFP_CANDIDATE zfp ZFP::zfp zfp::zfp ZFP::ZFP)
if(TARGET ${BLOSC_ZFP_CANDIDATE} AND NOT BLOSC_ZFP_TARGET)
set(BLOSC_ZFP_TARGET ${BLOSC_ZFP_CANDIDATE})
endif()
endforeach()
if(BLOSC_ZFP_TARGET AND NOT TARGET zfp)
add_library(zfp INTERFACE IMPORTED)
target_link_libraries(zfp INTERFACE ${BLOSC_ZFP_TARGET})
endif()
endif()
endif()
if(NOT ZFP_FOUND AND BLOSC_ALLOW_BUNDLED_ZFP)
set(BLOSC_ZFP_PROVIDER "BUNDLED")
endif()
if(BLOSC_ZFP_PROVIDER STREQUAL "NONE")
if(BLOSC_ENABLE_ZFP STREQUAL "ON")
message(FATAL_ERROR "BLOSC_ENABLE_ZFP=ON requires ZFP support, but no external ZFP package was found and bundled ZFP is disabled by BLOSC_DEPENDENCY_MODE=EXTERNAL.")
else()
message(STATUS "ZFP codec support disabled: no external ZFP package found in BLOSC_DEPENDENCY_MODE=EXTERNAL")
endif()
else()
set(HAVE_ZFP TRUE)
message(STATUS "ZFP codec support enabled (${BLOSC_ZFP_PROVIDER})")
endif()
endif()
if(BUILD_PLUGINS)
set(HAVE_PLUGINS TRUE)
endif()
# create the config.h file
configure_file("${PROJECT_SOURCE_DIR}/blosc/config.h.in"
"${PROJECT_BINARY_DIR}/blosc/config.h")
# now make sure that you set the build directory on your "Include" path when compiling
include_directories("${PROJECT_BINARY_DIR}/blosc/")
# If the build type is not set, default to Release.
set(BLOSC_DEFAULT_BUILD_TYPE Release)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type specified. Defaulting to '${BLOSC_DEFAULT_BUILD_TYPE}'.")
set(CMAKE_BUILD_TYPE ${BLOSC_DEFAULT_BUILD_TYPE} CACHE STRING
"Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Propagate CMAKE_OSX_ARCHITECTURES env variable into CMAKE_SYSTEM_PROCESSOR
if(DEFINED ENV{CMAKE_OSX_ARCHITECTURES})
if("$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR arm64)
endif()
endif()
# Based on the target system's processor and the compiler being used,
# set build variables indicating which hardware features can be targeted
# by the compiler. Note we DO NOT check which hardware features are supported
# by this (the host) system, because we want to be able to support compiling
# for newer hardware on older machines as well as cross-compilation.
message(STATUS "Building for system processor ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "Building for compiler ID ${CMAKE_C_COMPILER_ID}")
if(CMAKE_SYSTEM_PROCESSOR MATCHES i386|i686|x86_64|amd64|AMD64)
if(CMAKE_C_COMPILER_ID MATCHES GNU)
# We need C99 (GNU99 more exactly)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
set(COMPILER_SUPPORT_SSE2 TRUE)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.7)
set(COMPILER_SUPPORT_AVX2 TRUE)
else()
set(COMPILER_SUPPORT_AVX2 FALSE)
endif()
# GCC 10.3.2 (the version in manylinux_2014) seems to have issues supporting dynamic dispatching
# of AVX512. GCC 11.4 is the first minimal version that works well here.
# That means that Linux wheels will have AVX512 disabled, but that's life.
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.4)
set(COMPILER_SUPPORT_AVX512 TRUE)
else()
set(COMPILER_SUPPORT_AVX512 FALSE)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES Clang|AppleClang)
set(COMPILER_SUPPORT_SSE2 TRUE)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.2)
set(COMPILER_SUPPORT_AVX2 TRUE)
else()
set(COMPILER_SUPPORT_AVX2 FALSE)
endif()
# Clang 13 is the minimum version that we know that works with AVX512 dynamic dispatch.
# Perhaps lesser versions work too, better to err on the safe side.
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
set(COMPILER_SUPPORT_AVX512 TRUE)
else()
set(COMPILER_SUPPORT_AVX512 FALSE)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES Intel|IntelLLVM)
# All Intel compilers since the introduction of AVX512 in 2016 should support it, so activate all SIMD flavors
set(COMPILER_SUPPORT_SSE2 TRUE)
set(COMPILER_SUPPORT_AVX2 TRUE)
set(COMPILER_SUPPORT_AVX512 TRUE)
elseif(MSVC)
set(COMPILER_SUPPORT_SSE2 TRUE)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 18.00.30501)
set(COMPILER_SUPPORT_AVX2 TRUE)
else()
set(COMPILER_SUPPORT_AVX2 FALSE)
endif()
# AVX512 starts to be supported since Visual Studio 17 15.0
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.10.25017)
set(COMPILER_SUPPORT_AVX512 TRUE)
else()
set(COMPILER_SUPPORT_AVX512 FALSE)
endif()
else()
set(COMPILER_SUPPORT_SSE2 FALSE)
set(COMPILER_SUPPORT_AVX2 FALSE)
set(COMPILER_SUPPORT_AVX512 FALSE)
# Unrecognized compiler. Emit a warning message to let the user know hardware-acceleration won't be available.
message(WARNING "Unable to determine which ${CMAKE_SYSTEM_PROCESSOR} hardware features are supported by the C compiler (${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}).")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES armv7l|aarch64|arm64)
if(CMAKE_C_COMPILER_ID MATCHES GNU)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.2)
set(COMPILER_SUPPORT_NEON TRUE)
else()
set(COMPILER_SUPPORT_NEON FALSE)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES Clang|AppleClang)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.3)
set(COMPILER_SUPPORT_NEON TRUE)
else()
set(COMPILER_SUPPORT_NEON FALSE)
endif()
else()
set(COMPILER_SUPPORT_NEON FALSE)
# Unrecognized compiler. Emit a warning message to let the user know hardware-acceleration won't be available.
message(WARNING "Unable to determine which ${CMAKE_SYSTEM_PROCESSOR} hardware features are supported by the C compiler (${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}).")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv32|riscv64|riscv)")
set(COMPILER_SUPPORT_SSE2 FALSE)
set(COMPILER_SUPPORT_AVX2 FALSE)
set(COMPILER_SUPPORT_AVX512 FALSE)
set(COMPILER_SUPPORT_NEON FALSE)
set(COMPILER_SUPPORT_ALTIVEC FALSE)
message(STATUS "Detected RISC-V target; hardware-accelerated shuffle implementations are not available, so the generic path will be used.")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
if(CMAKE_C_COMPILER_ID MATCHES GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 8)
set(COMPILER_SUPPORT_ALTIVEC TRUE)
elseif(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 13)
set(COMPILER_SUPPORT_ALTIVEC TRUE)
else()
set(COMPILER_SUPPORT_ALTIVEC FALSE)
endif()
else()
# If the target system processor isn't recognized, emit a warning message to alert the user
# that hardware-acceleration support won't be available but allow configuration to proceed.
message(WARNING "Unrecognized system processor ${CMAKE_SYSTEM_PROCESSOR}. Cannot determine which hardware features (${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}) supports, so hardware-accelerated implementations will not be available.")
endif()
# disable AVX2 if specified
if(DEACTIVATE_AVX2)
set(COMPILER_SUPPORT_AVX2 FALSE)
# AVX512 functions in bitshuffle depend on AVX2 too
set(COMPILER_SUPPORT_AVX512 FALSE)
endif()
# disable AVX512 if specified
if(DEACTIVATE_AVX512)
set(COMPILER_SUPPORT_AVX512 FALSE)
endif()
# flags
# @TODO: set -Wall
# @NOTE: -O3 is enabled in Release mode (CMAKE_BUILD_TYPE="Release")
# Set the "-msse2" build flag only if the CMAKE_C_FLAGS is not already set.
# Probably "-msse2" should be appended to CMAKE_C_FLAGS_RELEASE.
if(CMAKE_C_COMPILER_ID MATCHES GNU|Clang|Intel|IntelLLVM)
if(NOT CMAKE_C_FLAGS AND COMPILER_SUPPORT_SSE2)
set(CMAKE_C_FLAGS -msse2 CACHE STRING "C flags." FORCE)
endif()
endif()
if(CMAKE_C_COMPILER_ID MATCHES Intel|IntelLLVM|Clang OR HAIKU)
# We need to tell Intel and Clang compilers about what level of POSIX they support
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600")
endif()
if(MSVC)
if(NOT CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "/Ox" CACHE STRING "C flags." FORCE)
endif()
# Turn off misguided "secure CRT" warnings in MSVC.
# Microsoft wants people to use the MS-specific _s
# versions of certain C functions but this is difficult to do
# in platform-independent code.
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else()
add_compile_options(-Wall -Wextra)
endif()
if(WIN32)
# For some supporting headers
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/blosc")
endif()
if(NOT DEFINED BLOSC_IS_SUBPROJECT)
if("^${CMAKE_SOURCE_DIR}$" STREQUAL "^${PROJECT_SOURCE_DIR}$")
set(BLOSC_IS_SUBPROJECT FALSE)
else()
set(BLOSC_IS_SUBPROJECT TRUE)
message(STATUS "Detected that BLOSC is used a subproject.")
endif()
endif()
if(NOT DEFINED BLOSC_INSTALL)
if(BLOSC_IS_SUBPROJECT)
set(BLOSC_INSTALL FALSE)
else()
set(BLOSC_INSTALL TRUE)
endif()
endif()
# include directories
include_directories(include)
# subdirectories
set(SOURCES)
if(BUILD_PLUGINS)
enable_testing()
add_subdirectory(plugins)
if(DEFINED ZFP_SOURCE_DIR)
include_directories(${ZFP_SOURCE_DIR}/include)
endif()
endif()
# Determine which linkage the unified target will use
if(BUILD_SHARED AND NOT BUILD_STATIC)
if(NOT BUILD_SHARED_LIBS)
message(WARNING "BUILD_SHARED_LIBS is OFF, but BUILD_SHARED is ON and BUILD_STATIC is OFF, which takes precedence, so Blosc2::blosc2 is a shared library")
endif()
set(UNIFIED_TARGET_ALIAS blosc2_shared)
elseif(NOT BUILD_SHARED AND BUILD_STATIC)
if(BUILD_SHARED_LIBS)
message(WARNING "BUILD_SHARED_LIBS is ON, but BUILD_SHARED is OFF and BUILD_STATIC is ON, which takes precedence, so Blosc2::blosc2 is a static library")
endif()
set(UNIFIED_TARGET_ALIAS blosc2_static)
else()
# If both BUILD_SHARED and BUILD_STATIC are set, which is the default,
# fallback to using BUILD_SHARED_LIBS to determine whether to set
# Blosc2::blosc2 to static or shared.
if(BUILD_SHARED_LIBS)
set(UNIFIED_TARGET_ALIAS blosc2_shared)
else()
set(UNIFIED_TARGET_ALIAS blosc2_static)
endif()
endif()
add_subdirectory(blosc)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
add_subdirectory(compat)
endif()
if(BUILD_FUZZERS)
if(NOT BUILD_STATIC)
message(FATAL_ERROR "BUILD_FUZZERS requires BUILD_STATIC to be enabled.")
endif()
enable_testing()
add_subdirectory(tests/fuzz)
endif()
if(BUILD_BENCHMARKS)
add_subdirectory(bench)
endif()
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
# collecting SOURCES is now complete
if(BUILD_SHARED)
target_sources(blosc2_shared PRIVATE ${SOURCES})
endif()
if(BUILD_STATIC)
target_sources(blosc2_static PRIVATE ${SOURCES})
endif()
if(BUILD_TESTS)
target_sources(blosc_testing PRIVATE ${SOURCES})
endif()
# install targets
if(BLOSC_INSTALL)
include(GNUInstallDirs)
# C++ files
install(FILES ${PROJECT_SOURCE_DIR}/include/blosc2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT DEV)
install(FILES ${PROJECT_SOURCE_DIR}/include/b2nd.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT DEV)
install(FILES
${PROJECT_SOURCE_DIR}/include/blosc2/blosc2-export.h
${PROJECT_SOURCE_DIR}/include/blosc2/blosc2-common.h
${PROJECT_SOURCE_DIR}/include/blosc2/blosc2-stdio.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/blosc2 COMPONENT DEV)
if(BUILD_PLUGINS)
install(FILES
${PROJECT_SOURCE_DIR}/include/blosc2/filters-registry.h
${PROJECT_SOURCE_DIR}/include/blosc2/codecs-registry.h
${PROJECT_SOURCE_DIR}/include/blosc2/tuners-registry.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/blosc2 COMPONENT DEV)
endif()
if(BUILD_SHARED)
install(TARGETS blosc2_shared
LIBRARY COMPONENT LIB
ARCHIVE COMPONENT DEV
RUNTIME COMPONENT LIB)
endif()
if(BUILD_STATIC)
install(TARGETS blosc2_static COMPONENT DEV)
endif()
# Bundled dependency headers are private implementation details and are not
# installed. Bundled dependency objects are folded into libblosc2.a for
# static builds and into libblosc2 shared libraries by the regular linker.
# config files
include(CMakePackageConfigHelpers)
# we need a general location for Unix and Windows to install our
# Blosc2Config.cmake files to. This is defined in CMake:
# https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure
if(NOT Blosc2_INSTALL_CMAKEDIR)
if(WIN32 AND NOT MINGW)
set(Blosc2_INSTALL_CMAKEDIR "cmake")
else()
set(Blosc2_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Blosc2")
endif()
endif()
# CMake config file
# This stores our targets and find and populates the targets we depend on,
# including third party interface libraries that we added.
set(Blosc2_INSTALL_TARGET_NAMES)
set(Blosc2_INSTALL_THIRDPARTY_TARGET_NAMES)
if(BUILD_SHARED)
list(APPEND Blosc2_INSTALL_TARGET_NAMES blosc2_shared)
endif()
if(BUILD_STATIC)
list(APPEND Blosc2_INSTALL_TARGET_NAMES blosc2_static)
endif()
# Add unified target
add_library(blosc2 INTERFACE)
list(APPEND Blosc2_INSTALL_TARGET_NAMES blosc2)
target_link_libraries(blosc2 INTERFACE ${UNIFIED_TARGET_ALIAS})
configure_file(
${PROJECT_SOURCE_DIR}/Blosc2Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/Blosc2Config.cmake
@ONLY
)
install(TARGETS ${Blosc2_INSTALL_TARGET_NAMES}
EXPORT Blosc2Targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if(Blosc2_INSTALL_THIRDPARTY_TARGET_NAMES)
install(TARGETS ${Blosc2_INSTALL_THIRDPARTY_TARGET_NAMES}
EXPORT Blosc2Targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/blosc2
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/blosc2
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()
install(EXPORT Blosc2Targets
FILE Blosc2Targets.cmake
NAMESPACE Blosc2::
DESTINATION ${Blosc2_INSTALL_CMAKEDIR}
)
write_basic_package_version_file("Blosc2ConfigVersion.cmake"
VERSION ${BLOSC2_VERSION_STRING}
COMPATIBILITY SameMajorVersion
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/Blosc2Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/Blosc2ConfigVersion.cmake
DESTINATION ${Blosc2_INSTALL_CMAKEDIR}
)
# CMake Find*.cmake files used in Blosc2Config.cmake
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake/
DESTINATION ${Blosc2_INSTALL_CMAKEDIR}/Modules
)
# pkg-config .pc file
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/blosc2.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/blosc2.pc"
@ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/blosc2.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" COMPONENT DEV)
# uninstaller
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
endif()
# packaging
if(NOT BLOSC_IS_SUBPROJECT)
include(InstallRequiredSystemLibraries)
set(CPACK_GENERATOR TGZ ZIP)
set(CPACK_SOURCE_GENERATOR TGZ ZIP)
set(CPACK_PACKAGE_VERSION_MAJOR ${BLOSC2_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${BLOSC2_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${BLOSC2_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${BLOSC_STRING_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.rst")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"A blocking, shuffling and lossless compression library")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_SOURCE_IGNORE_FILES "/build.*;.*~;\\\\.git.*;\\\\.DS_Store")
set(CPACK_STRIP_FILES TRUE)
set(CPACK_SOURCE_STRIP_FILES TRUE)
include(CPack)
endif()
c-blosc2-3.1.5/COMPILING_WITH_WHEELS.rst 0000664 0000000 0000000 00000012271 15217434361 0017112 0 ustar 00root root 0000000 0000000 =============================================================================
C-Blosc2 libraries come with Python-Blosc2 wheels
=============================================================================
C-Blosc2 binary libraries (including plugins functionality) can easily be installed from Python-Blosc2 (>= 0.1.8) wheels:
.. code-block:: console
$ pip install blosc2
Collecting blosc2
Downloading blosc2-0.1.8-cp37-cp37m-manylinux2010_x86_64.whl (3.3 MB)
|████████████████████████████████| 3.3 MB 4.7 MB/s
Installing collected packages: blosc2
Successfully installed blosc2-0.1.8
As a result, one can easily update to the latest version of C-Blosc2 binaries without the need to manually compile it. Following are instructions on how to use the libraries in wheels for different platforms.
Compiling C files with Blosc2 wheels on Windows
----------------------------------------------
- The wheels for Windows have been produced with the Microsoft MSVC compiler, so we recommend that you use it too. You can get it for free at: https://visualstudio.microsoft.com/es/downloads/.
- In order to check that the MSVC command line is set up correctly, enter ``cl`` in the command prompt window and verify that the output looks something like this:
.. code-block:: console
> cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24245 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
- Make the compiler available. Its typical installation location is `C:\\Program files (x86)\\Microsoft Visual Studio`, so change your current directory there. Then, to set up the build architecture environment you can open a command prompt window in the `VC\\Auxiliary\\Build` subdirectory and execute `vcvarsall.bat x64` if your architecture is 64 bits or `vcvarsall.bat x86` if it is 32 bits.
- You will need to know the path where the Blosc2 wheel has installed its files. For this we will use the `dir /s` command (but you can use your preferred location method):
.. code-block:: console
> dir /s c:\blosc2.lib
Volume in drive C is OS
Volume Serial Number is 7A21-A5D5
Directory of c:\Users\user\miniconda3\Lib
14/12/2020 09:56 20.848 blosc2.lib
1 File(s) 20.848 bytes
Total list files:
1 File(s) 20.848 bytes
0 dirs 38.981.902.336 free bytes
- The output shows the path of blosc2.lib in your system, but we are rather interested in the parent one:
.. code-block:: console
> set WHEEL_DIR=c:\Users\user\miniconda3
- Now, it is important to copy the library `libblosc2.dll` to C:\\Windows\\System32 directory, so it can be found by the executable when it is necessary.
- Finally, to compile C files using Blosc2 libraries, enter this command:
.. code-block:: console
> cl .c /Ox /Fe.exe /I /MT /link/NODEFAULTLIB:MSVCRT
- For instance, in the case of blosc "examples/urcodecs.c":
.. code-block:: console
> cl urcodecs.c %WHEEL_DIR%\lib\blosc2.lib /Ox /Feurcodecs.exe /I%WHEEL_DIR%\include /MT /link/NODEFAULTLIB:MSVCRT
Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25017 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
urcodecs.c
Microsoft (R) Incremental Linker Version 14.10.25017.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:urcodecs.exe
/NODEFAULTLIB:MSVCRT
urcodecs.obj
/NODEFAULTLIB:MSVCRT
.\miniconda3\lib\blosc2.lib
- And you can run your program:
.. code-block:: console
> urcodecs
Blosc version info: 2.0.0 ($Date:: 2021-05-26 #$)
Compression ratio: 381.5 MB -> 0.0 MB (14013.5x)
Compression time: 0.261 s, 1462.1 MB/s
Decompression time: 0.0669 s, 5698.2 MB/s
Successful roundtrip data <-> schunk !
Compiling C files with Blosc2 wheels on Linux
---------------------------------------------
- Find the path where Blosc2 wheel has installed its files:
.. code-block:: console
$ find / -name libblosc2.so 2>/dev/null
/home/user/miniconda3/lib/libblosc2.so
- The output shows the path of libblosc2.so, but we are rather interested in the parent one:
.. code-block:: console
$ WHEEL_DIR=/home/user/miniconda3
- To compile C files using Blosc2 you only need to enter the commands:
.. code-block:: console
$ export LD_LIBRARY_PATH=
$ gcc .c -I -o -L -lblosc2
- For instance, let's compile blosc's "examples/urcodecs.c":
.. code-block:: console
$ export LD_LIBRARY_PATH=$WHEEL_DIR/lib # note that you need the LD_LIBRARY_PATH env variable
$ gcc urcodecs.c -I$WHEEL_DIR/include -o urcodecs -L$WHEEL_DIR/lib -lblosc2
- Run your program:
.. code-block:: console
$ ./urcodecs
Blosc version info: 2.0.0-dev0 ($Date:: 2021-05-26 #$)
Compression ratio: 381.5 MB -> 0.0 MB (14013.5x)
Compression time: 1.46 s, 260.7 MB/s
Decompression time: 0.509 s, 749.1 MB/s
Successful roundtrip data <-> schunk !
- Rejoice!
c-blosc2-3.1.5/CONTRIBUTING.rst 0000664 0000000 0000000 00000005023 15217434361 0015573 0 ustar 00root root 0000000 0000000 Contributing guidelines
=======================
We want to make contributing to this project as easy and transparent as
possible.
Our Development Process
-----------------------
New versions are being developed in the "main" branch,
or in their own feature branch.
When they are deemed ready for a release, they are merged back into "main"
again.
So all contributions must stage first through "main"
or their own feature branch.
Pull Requests
-------------
We actively welcome your pull requests.
1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code does not issue new compiler warnings.
Automated Contributions Policy
------------------------------
Contributing to Blosc requires human judgment, contextual understanding, and familiarity with scikit-learn’s structure and goals. It is not suitable for automatic processing by AI tools.
Please refrain from submitting issues or pull requests generated by fully-automated tools. Maintainers reserve the right, at their sole discretion, to close such submissions and to block any account responsible for them.
Review all code or documentation changes made by AI tools and make sure you understand all changes and can explain them on request, before submitting them under your name. Do not submit any AI-generated code that you haven’t personally reviewed, understood and tested, as this wastes maintainers’ time.
Please do not paste AI generated text in the description of issues, PRs or in comments as this makes it harder for reviewers to assess your contribution. We are happy for it to be used to improve grammar or if you are not a native English speaker.
If you used AI tools, please state so in your PR description.
PRs that appear to violate this policy will be closed without review.
For more information on why this is becoming a big issue for open source projects, please see the `Software Review in the Era of AI `_ by the rOpenSci folks.
Issues
------
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.
Coding Style
------------
* 2 spaces for indentation rather than tabs.
License
-------
By contributing to C-Blosc2, you agree that your contributions will be licensed
under the `LICENSE `_
file of the project.
c-blosc2-3.1.5/DEVELOPING-GUIDE.rst 0000664 0000000 0000000 00000001340 15217434361 0016151 0 ustar 00root root 0000000 0000000 Some conventions used in C-Blosc2
=================================
* Use C99 designated initialization only in examples. Libraries should use C89 initialization, which is more portable, specially with C++ (designated initialization in C++ is supported only since C++20).
* Use _new and _free for memory allocating constructors and destructors and _init and _destroy for non-memory allocating constructors and destructors.
* Lines must not exceed 120 characters. If a line is too long, it must be broken into several lines.
* Conditional bodies must always use braces, even if they are one-liners. The only exception that can be is when the conditional is a single line and the body is a single line:
if (condition) whatever();
c-blosc2-3.1.5/FAQ.md 0000664 0000000 0000000 00000001634 15217434361 0014067 0 ustar 00root root 0000000 0000000 ## Which is the compatibility policy for the Blosc library and format?
### Compatibility among libraries with different minor versions
The compatibility between minor versions (e.g. 2.0 <-> 2.1) will always be *both* backward and forward. This means that any version of the library will be able to read any data produced with another version differing only in the patch level or minor version. Not being able to achieve that will be considered a bug, and action will be taken to fix that as soon as possible (see e.g. https://github.com/Blosc/c-blosc/issues/215).
### Compatibility among libraries with different major versions
There will be an *attempt* (but not an absolute guarantee) of backward compatibility, but it won’t be an effort for guaranteeing forward compatibility. For example, Blosc2 2.1 is able to read any data produced by Blosc 1.x, but Blosc 1.x are not able to read data produced by Blosc2 2.x.
c-blosc2-3.1.5/FUNDING.yml 0000664 0000000 0000000 00000000105 15217434361 0014743 0 ustar 00root root 0000000 0000000 github: [numfocus]
custom: ['https://numfocus.org/donate-to-blosc']
c-blosc2-3.1.5/LICENSE.txt 0000664 0000000 0000000 00000003154 15217434361 0014760 0 ustar 00root root 0000000 0000000 BSD License
For Blosc - A blocking, shuffling and lossless compression library
Copyright (c) 2009-2018 Francesc Alted
Copyright (c) 2019-present Blosc Development Team
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name Francesc Alted nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
c-blosc2-3.1.5/LICENSES/ 0000775 0000000 0000000 00000000000 15217434361 0014337 5 ustar 00root root 0000000 0000000 c-blosc2-3.1.5/LICENSES/BITSHUFFLE.txt 0000664 0000000 0000000 00000002174 15217434361 0016537 0 ustar 00root root 0000000 0000000 Bitshuffle - Filter for improving compression of typed binary data.
Copyright (c) 2014 Kiyoshi Masui (kiyo@physics.ubc.ca)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
c-blosc2-3.1.5/LICENSES/FASTLZ.txt 0000664 0000000 0000000 00000002157 15217434361 0016110 0 ustar 00root root 0000000 0000000 FastLZ - Byte-aligned LZ77 compression library
Copyright (C) 2005-2020 Ariya Hidayat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
c-blosc2-3.1.5/LICENSES/LZ4.txt 0000664 0000000 0000000 00000002437 15217434361 0015517 0 ustar 00root root 0000000 0000000 LZ4 Library
Copyright (c) 2011-2020, Yann Collet
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
c-blosc2-3.1.5/LICENSES/ZLIB.txt 0000664 0000000 0000000 00000001543 15217434361 0015643 0 ustar 00root root 0000000 0000000 (C) 1995-2013 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
c-blosc2-3.1.5/LICENSES/ZSTD.txt 0000664 0000000 0000000 00000002772 15217434361 0015674 0 ustar 00root root 0000000 0000000 BSD License
For Zstandard software
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
c-blosc2-3.1.5/README.rst 0000664 0000000 0000000 00000024763 15217434361 0014635 0 ustar 00root root 0000000 0000000 ========
C-Blosc2
========
A fast, compressed and persistent data store library for C
==========================================================
:Author: Blosc Development Team
:Contact: blosc@blosc.org
:URL: https://www.blosc.org
:Gitter: |gitter|
:Actions: |actions|
:NumFOCUS: |numfocus|
:Code of Conduct: |Contributor Covenant|
.. |gitter| image:: https://badges.gitter.im/Blosc/c-blosc.svg
:alt: Join the chat at https://gitter.im/Blosc/c-blosc
:target: https://gitter.im/Blosc/c-blosc?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
.. |actions| image:: https://github.com/Blosc/c-blosc2/workflows/CI%20CMake/badge.svg
:target: https://github.com/Blosc/c-blosc2/actions?query=workflow%3A%22CI+CMake%22
.. |numfocus| image:: https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A
:target: https://numfocus.org
.. |Contributor Covenant| image:: https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg
:target: https://github.com/Blosc/community/blob/master/code_of_conduct.md
What is it?
===========
`Blosc2 `_ is a high-performance compressor and data format optimized for binary data, including numerical arrays, tensors, and other structured formats. It provides a flexible framework of codecs and filters, enabling developers to balance compression speed and ratio for specific use cases, from high-throughput data pipelines to persistent storage. As the successor to the original Blosc library (released in 2010), Blosc2 is built on a mature foundation and is integrated into many popular scientific computing libraries, such as PyTables, h5py, and Zarr.
C-Blosc2 is the new major version of `C-Blosc `_, and is backward compatible with both the C-Blosc1 API and its in-memory format. However, the reverse thing is generally not true for the format; buffers generated with C-Blosc2 are not format-compatible with C-Blosc1 (i.e. forward compatibility is not supported). In case you want to ensure full API compatibility with C-Blosc1 API, define the `BLOSC1_COMPAT` symbol.
See a 3-minute `introductory video to Blosc2 `_.
Blosc2 NDim: an N-Dimensional store
===================================
One of more exciting additions in C-Blosc2 is the `Blosc2 NDim layer `_ (or B2ND for short), which allows creating *and* reading n-dimensional datasets in an extremely efficient way thanks to a n-dim 2-level partitioning, that allows slicing and dicing arbitrary large and compressed data in a more fine-grained way:
.. image:: https://github.com/Blosc/c-blosc2/blob/main/images/b2nd-2level-parts.png?raw=true
:width: 75%
To whet your appetite, here is how the `NDArray` object in the `Python wrapper`_ performs on getting slices orthogonal to the different axis of a 4-dim dataset:
.. image:: https://github.com/Blosc/c-blosc2/blob/main/images/Read-Partial-Slices-B2ND.png?raw=true
:width: 75%
We have blogged about this: https://www.blosc.org/posts/blosc2-ndim-intro
We also have a ~2 min explanatory video on `why slicing in a pineapple-style (aka double partition)
is useful `_:
.. image:: https://github.com/Blosc/blogsite/blob/master/files/images/slicing-pineapple-style.png?raw=true
:width: 50%
:alt: Slicing a dataset in pineapple-style
:target: https://www.youtube.com/watch?v=LvP9zxMGBng
.. include:: ../WHATS-NEW.rst
More info about the `improved capabilities of C-Blosc2 can be found in this paper `_. Please, cite it if you use C-Blosc2 in your research!
Open format
===========
The Blosc2 format is open and `fully documented `_.
The format specs are defined in less than 4000 words, so they should be easy to read and understand. In our opinion, this is critical for the long-term success of the library, as it allows for third-party implementations of the format, and also for the users to understand what is going on under the hood.
Python wrapper
==============
We are officially supporting (thanks to the Python Software Foundation) a `Python wrapper for Blosc2 `_. It supports all the features of the predecessor `python-blosc `_ package plus most of the bells and whistles of C-Blosc2, like 64-bit and multidimensional containers. As a bonus, the `python-blosc2` package comes with wheels and binary versions of the C-Blosc2 libraries, so anyone, even non-Python users can install C-Blosc2 binaries easily with:
.. code-block:: console
pip install blosc2
Compiling the C-Blosc2 library with CMake
=========================================
Blosc can be built, tested and installed using `CMake `_. The following procedure describes a typical CMake build.
Create the build directory inside the sources and move into it:
.. code-block:: console
git clone https://github.com/Blosc/c-blosc2
cd c-blosc2
mkdir build
cd build
Now run CMake configuration and optionally specify the installation
directory (e.g. '/usr' or '/usr/local'):
.. code-block:: console
cmake -DCMAKE_INSTALL_PREFIX=your_install_prefix_directory ..
CMake allows configuring Blosc in many different ways, including selecting external codec libraries, fetching pinned upstream codec sources during configuration, or disabling selected codecs altogether. Please note that configuration can also be performed using UI tools provided by CMake (`ccmake` or `cmake-gui`):
.. code-block:: console
ccmake .. # run a curses-based interface
cmake-gui .. # run a graphical interface
Build, test and install Blosc:
.. code-block:: console
cmake --build .
ctest
cmake --build . --target install
The static and dynamic version of the Blosc library, together with header files, will be installed into the specified CMAKE_INSTALL_PREFIX.
Once you have compiled your Blosc library, you can easily link your apps with it as shown in the `examples/ directory `_.
Handling support for codecs (LZ4, LZ4HC, Zstd, Zlib, ZFP)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C-Blosc2 can either fetch pinned upstream codec releases via CMake ``FetchContent`` or use codec libraries already installed on the system. The top-level switch is ``BLOSC_DEPENDENCY_MODE``:
``BUNDLED``
Default. Fetch and build the bundled dependency versions. This preserves the traditional self-contained C-Blosc2 build behavior. Bundled dependencies are private: their headers and libraries are not installed separately, and static builds fold them into ``libblosc2.a``.
``EXTERNAL``
Require system packages for mandatory dependencies and fail with a clear error if they are missing. This is the recommended mode for distro packagers that must avoid bundled third-party code::
cmake -DBLOSC_DEPENDENCY_MODE=EXTERNAL ..
``AUTO``
Try system packages first and fall back to bundled dependencies. This is convenient for local development, but less reproducible for distro packaging.
The older ``PREFER_EXTERNAL_LZ4``, ``PREFER_EXTERNAL_ZLIB`` and ``PREFER_EXTERNAL_ZSTD`` options are still accepted as per-dependency compatibility options; when enabled they try the system package first for that dependency.
ZFP support is controlled separately because ZFP packages are not available in all distributions:
``BLOSC_ENABLE_ZFP=AUTO``
Default. In ``BUNDLED`` mode, build bundled ZFP. In ``EXTERNAL`` mode, enable ZFP only when a system ZFP package is found; otherwise build C-Blosc2 without ZFP support. In ``AUTO`` dependency mode, try system ZFP first and fall back to bundled ZFP.
``BLOSC_ENABLE_ZFP=ON``
Require ZFP support. In ``EXTERNAL`` mode this fails if no system ZFP package is found.
``BLOSC_ENABLE_ZFP=OFF``
Disable the ZFP codec.
For fully local bundled builds without network access, point CMake at local codec checkouts instead of downloading them:
.. code-block:: console
cmake \
-DBLOSC_LZ4_SOURCE_DIR=/path/to/lz4 \
-DBLOSC_ZLIBNG_SOURCE_DIR=/path/to/zlib-ng \
-DBLOSC_ZSTD_SOURCE_DIR=/path/to/zstd \
-DBLOSC_ZFP_SOURCE_DIR=/path/to/zfp \
..
You can also exclude support for selected codecs. For example, to disable Zstd support:
.. code-block:: console
cmake -DDEACTIVATE_ZSTD=ON ..
Supported platforms
~~~~~~~~~~~~~~~~~~~
C-Blosc2 is meant to support all platforms where a C99 compliant C compiler can be found. The ones that are mostly tested are Intel (Linux, Mac OSX and Windows), ARM (Linux, Mac), and PowerPC (Linux). More on ARM support in `README_ARM.rst`.
For Windows, you will need at least VS2015 or higher on x86 and x64 targets (i.e. ARM is not supported on Windows).
For Mac OSX, make sure that you have the command line developer tools available. You can always install them with:
.. code-block:: console
xcode-select --install
For Mac OSX on arm64 architecture, you may want to compile it like this:
.. code-block:: console
CC="clang -arch arm64" cmake ..
Display error messages
~~~~~~~~~~~~~~~~~~~~~~
By default error messages are disabled. To display them, you just need to activate the Blosc tracing machinery by setting
the ``BLOSC_TRACE`` environment variable.
Contributing
============
If you want to collaborate in this development you are welcome. We need help in the different areas listed at the `ROADMAP `_; also, be sure to read our `DEVELOPING-GUIDE `_ and our `Code of Conduct `_. Blosc is distributed using the `BSD license `_.
Twitter feed
============
Follow `@Blosc2 `_ so as to get informed about the latest developments.
Citing Blosc
============
You can cite our work on the different libraries under the Blosc umbrella as:
.. code-block:: console
@ONLINE{blosc,
author = {{Blosc Development Team}},
title = "{A fast, compressed and persistent data store library}",
year = {2009-2025},
note = {https://blosc.org}
}
Acknowledgments
===============
See `THANKS document `_.
----
*Compress Better, Compute Bigger*
-- Blosc Development Team
c-blosc2-3.1.5/README_ARM.rst 0000664 0000000 0000000 00000037115 15217434361 0015327 0 ustar 00root root 0000000 0000000 Support for Apple arm64
=======================
Since November 2020 Apple is releasing Mac boxes using CPUs with its own
arm64 implementation. Currently, you can compile C-Blosc2 with:
.. code-block:: console
mkdir build
cd build
CC="clang -arch arm64" cmake ..
The NEON extensions are used automatically in this case.
Here are a couple of benchmarks on BloscLZ and LZ4 codecs running on a MacBook Air
with a new M1 arm64 processor:
.. code-block:: console
(base) francesc@Francescs-MacBook-Air build % bench/b2bench blosclz
Blosc version: 2.0.0.beta.6.dev ($Date:: 2020-04-21 #$)
List of supported compressors in this build: blosclz,lz4,lz4hc,zlib,zstd
Supported compression libraries:
BloscLZ: 2.3.0
LZ4: 1.9.1
Zlib: 10.0.3
Zstd: 1.4.5
Using compressor: blosclz
Using shuffle type: shuffle
Running suite: single
--> 4, 4194304, 4, 19, blosclz, shuffle
********************** Run info ******************************
Blosc version: 2.0.0.beta.6.dev ($Date:: 2020-04-21 #$)
Using synthetic data with 19 significant bits (out of 32)
Dataset size: 4194304 bytes Type size: 4 bytes
Working set: 256.0 MB Number of threads: 4
********************** Running benchmarks *********************
memcpy(write): 327.0 us, 12234.1 MB/s
memcpy(read): 127.1 us, 31460.5 MB/s
Compression level: 0
comp(write): 136.6 us, 29274.7 MB/s Final bytes: 4194336 Ratio: 1.00
decomp(read): 101.8 us, 39281.3 MB/s OK
Compression level: 1
comp(write): 443.7 us, 9014.3 MB/s Final bytes: 1102576 Ratio: 3.80
decomp(read): 99.4 us, 40242.1 MB/s OK
Compression level: 2
comp(write): 414.2 us, 9656.0 MB/s Final bytes: 1083528 Ratio: 3.87
decomp(read): 99.6 us, 40178.6 MB/s OK
Compression level: 3
comp(write): 451.0 us, 8869.1 MB/s Final bytes: 1083528 Ratio: 3.87
decomp(read): 102.3 us, 39107.8 MB/s OK
Compression level: 4
comp(write): 568.7 us, 7033.2 MB/s Final bytes: 165194 Ratio: 25.39
decomp(read): 135.8 us, 29447.2 MB/s OK
Compression level: 5
comp(write): 565.2 us, 7076.6 MB/s Final bytes: 165194 Ratio: 25.39
decomp(read): 135.5 us, 29512.3 MB/s OK
Compression level: 6
comp(write): 523.5 us, 7640.9 MB/s Final bytes: 141642 Ratio: 29.61
decomp(read): 138.2 us, 28943.9 MB/s OK
Compression level: 7
comp(write): 520.4 us, 7687.0 MB/s Final bytes: 138042 Ratio: 30.38
decomp(read): 137.3 us, 29136.4 MB/s OK
Compression level: 8
comp(write): 524.1 us, 7632.7 MB/s Final bytes: 137610 Ratio: 30.48
decomp(read): 138.4 us, 28893.1 MB/s OK
Compression level: 9
comp(write): 534.4 us, 7485.3 MB/s Final bytes: 73254 Ratio: 57.26
decomp(read): 127.5 us, 31371.5 MB/s OK
Round-trip compr/decompr on 7.5 GB
Elapsed time: 1.2 s, 13694.7 MB/s
(base) francesc@Francescs-MacBook-Air build % bench/b2bench lz4
Blosc version: 2.0.0.beta.6.dev ($Date:: 2020-04-21 #$)
List of supported compressors in this build: blosclz,lz4,lz4hc,zlib,zstd
Supported compression libraries:
BloscLZ: 2.3.0
LZ4: 1.9.1
Zlib: 10.0.3
Zstd: 1.4.5
Using compressor: lz4
Using shuffle type: shuffle
Running suite: single
--> 4, 4194304, 4, 19, lz4, shuffle
********************** Run info ******************************
Blosc version: 2.0.0.beta.6.dev ($Date:: 2020-04-21 #$)
Using synthetic data with 19 significant bits (out of 32)
Dataset size: 4194304 bytes Type size: 4 bytes
Working set: 256.0 MB Number of threads: 4
********************** Running benchmarks *********************
memcpy(write): 331.2 us, 12076.7 MB/s
memcpy(read): 134.7 us, 29689.2 MB/s
Compression level: 0
comp(write): 132.2 us, 30259.8 MB/s Final bytes: 4194336 Ratio: 1.00
decomp(read): 109.0 us, 36709.8 MB/s OK
Compression level: 1
comp(write): 589.3 us, 6787.9 MB/s Final bytes: 991408 Ratio: 4.23
decomp(read): 244.4 us, 16367.1 MB/s OK
Compression level: 2
comp(write): 658.0 us, 6078.7 MB/s Final bytes: 877344 Ratio: 4.78
decomp(read): 313.3 us, 12765.8 MB/s OK
Compression level: 3
comp(write): 670.3 us, 5967.1 MB/s Final bytes: 786514 Ratio: 5.33
decomp(read): 312.4 us, 12804.1 MB/s OK
Compression level: 4
comp(write): 420.5 us, 9512.9 MB/s Final bytes: 428754 Ratio: 9.78
decomp(read): 244.8 us, 16340.0 MB/s OK
Compression level: 5
comp(write): 419.5 us, 9536.0 MB/s Final bytes: 428754 Ratio: 9.78
decomp(read): 245.2 us, 16311.3 MB/s OK
Compression level: 6
comp(write): 413.5 us, 9673.5 MB/s Final bytes: 379116 Ratio: 11.06
decomp(read): 239.3 us, 16713.1 MB/s OK
Compression level: 7
comp(write): 414.2 us, 9656.7 MB/s Final bytes: 379116 Ratio: 11.06
decomp(read): 240.0 us, 16666.0 MB/s OK
Compression level: 8
comp(write): 413.2 us, 9680.5 MB/s Final bytes: 379116 Ratio: 11.06
decomp(read): 237.7 us, 16830.1 MB/s OK
Compression level: 9
comp(write): 414.3 us, 9654.1 MB/s Final bytes: 379116 Ratio: 11.06
decomp(read): 239.8 us, 16684.0 MB/s OK
Round-trip compr/decompr on 7.5 GB
Elapsed time: 1.4 s, 11720.1 MB/s
Yes, the speed is really good on the new Apple architecture!
ARM environment for Ubuntu Intel
================================
In order to create executable code for a platform other than the one on
which the compiler is running we can use cross compilers. In this case we
want to create executables for ARM platforms but execute them on
Intel platform with Ubuntu. The only package that is necessary
(at least in Ubuntu 15.04) is gcc-arm-linux-gnueabihf.
Once this is installed the way to compile an example is:
.. code-block:: console
$ arm-linux-gnueabihf-gcc -static -mfpu=neon -flax-vector-conversions -DSHUFFLE_NEON_ENABLED -O3 simple.c ../blosc/blosc.c ../blosc/blosclz.c ../blosc/shuffle.c ../blosc/shuffle-generic.c ../blosc/bitshuffle-generic.c ../blosc/shuffle-neon.c ../blosc/bitshuffle-neon.c -I../blosc -o simple -lpthread
Another example for running a bench with the cross compiler:
.. code-block:: console
$ arm-linux-gnueabihf-gcc -static -mfpu=neon -flax-vector-conversions -DSHUFFLE_NEON_ENABLED -O3 bench.c ../blosc/blosc.c ../blosc/blosclz.c ../blosc/shuffle.c ../blosc/shuffle-generic.c ../blosc/bitshuffle-generic.c ../blosc/shuffle-neon.c ../blosc/bitshuffle-neon.c -I../blosc -o bench -lpthread
In these cases the NEON flags are: `-mfpu=neon -flax-vector-conversions`
This is explained in detail in: https://linux-sunxi.org/Toolchain
This way you can develop and debug applications for ARM on intel machines as if
you were in ARM platforms.
Benchmark for ODROID-XU3
========================
This is a benchmark to compare the speeds between the NEON and the generic
implementation.
::
CPU: ARMv7 Processor rev 3 (v7l)
Compiler: gcc, version gcc-4.8.real
Optimizations: -O3
OS: Ubuntu 14.04 trusty
• NEON implementation results:
::
Blosc version: 2.0.0a1 ($Date:: 2015-07-30 #$)
List of supported compressors in this build: blosclz
Supported compression libraries:
BloscLZ: 1.0.5
LZ4: unknown
Zlib: unknown
Using compressor: blosclz
Using shuffle type: shuffle
Running suite: suite
--> 1, 2097152, 8, 19, blosclz, shuffle
********************** Run info ******************************
Blosc version: 2.0.0a1 ($Date:: 2015-07-30 #$)
Using synthetic data with 19 significant bits (out of 32)
Dataset size: 2097152 bytes Type size: 8 bytes
Working set: 64.0 MB Number of threads: 1
********************** Running benchmarks *********************
memcpy(write): 2265.1 us, 883.0 MB/s
memcpy(read): 1196.9 us, 1671.0 MB/s
Compression level: 0
comp(write): 984.8 us, 2030.9 MB/s Final bytes: 2097168 Ratio: 1.00
decomp(read): 1202.8 us, 1662.8 MB/s OK
Compression level: 1
comp(write): 5863.7 us, 341.1 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 1014.1 us, 1972.3 MB/s OK
Compression level: 2
comp(write): 6229.8 us, 321.0 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 1013.4 us, 1973.5 MB/s OK
Compression level: 3
comp(write): 6603.8 us, 302.9 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 1012.9 us, 1974.4 MB/s OK
Compression level: 4
comp(write): 6792.6 us, 294.4 MB/s Final bytes: 557840 Ratio: 3.76
decomp(read): 983.5 us, 2033.6 MB/s OK
Compression level: 5
comp(write): 8598.3 us, 232.6 MB/s Final bytes: 557840 Ratio: 3.76
decomp(read): 983.4 us, 2033.9 MB/s OK
Compression level: 6
comp(write): 9866.2 us, 202.7 MB/s Final bytes: 546320 Ratio: 3.84
decomp(read): 1079.1 us, 1853.3 MB/s OK
Compression level: 7
comp(write): 9334.9 us, 214.2 MB/s Final bytes: 216528 Ratio: 9.69
decomp(read): 1959.4 us, 1020.7 MB/s OK
Compression level: 8
comp(write): 9221.1 us, 216.9 MB/s Final bytes: 216528 Ratio: 9.69
decomp(read): 1972.1 us, 1014.2 MB/s OK
Compression level: 9
comp(write): 8452.0 us, 236.6 MB/s Final bytes: 153160 Ratio: 13.69
decomp(read): 2780.0 us, 719.4 MB/s OK
--> 2, 2097152, 8, 19, blosclz, shuffle
********************** Run info ******************************
Blosc version: 2.0.0a1 ($Date:: 2015-07-30 #$)
Using synthetic data with 19 significant bits (out of 32)
Dataset size: 2097152 bytes Type size: 8 bytes
Working set: 64.0 MB Number of threads: 2
********************** Running benchmarks *********************
memcpy(write): 2258.0 us, 885.8 MB/s
memcpy(read): 1194.9 us, 1673.7 MB/s
Compression level: 0
comp(write): 831.2 us, 2406.0 MB/s Final bytes: 2097168 Ratio: 1.00
decomp(read): 1162.6 us, 1720.3 MB/s OK
Compression level: 1
comp(write): 2975.1 us, 672.2 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 738.4 us, 2708.4 MB/s OK
Compression level: 2
comp(write): 3156.8 us, 633.6 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 738.7 us, 2707.5 MB/s OK
Compression level: 3
comp(write): 3347.0 us, 597.6 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 749.6 us, 2668.1 MB/s OK
Compression level: 4
comp(write): 3486.2 us, 573.7 MB/s Final bytes: 557840 Ratio: 3.76
decomp(read): 745.1 us, 2684.4 MB/s OK
Compression level: 5
comp(write): 4488.5 us, 445.6 MB/s Final bytes: 557840 Ratio: 3.76
decomp(read): 725.7 us, 2755.9 MB/s OK
Compression level: 6
comp(write): 4998.5 us, 400.1 MB/s Final bytes: 546320 Ratio: 3.84
decomp(read): 796.8 us, 2510.2 MB/s OK
Compression level: 7
comp(write): 4780.3 us, 418.4 MB/s Final bytes: 216528 Ratio: 9.69
decomp(read): 1383.9 us, 1445.1 MB/s OK
Compression level: 8
comp(write): 4778.6 us, 418.5 MB/s Final bytes: 216528 Ratio: 9.69
decomp(read): 1398.0 us, 1430.6 MB/s OK
Compression level: 9
comp(write): 5884.6 us, 339.9 MB/s Final bytes: 153160 Ratio: 13.69
decomp(read): 2647.7 us, 755.4 MB/s OK
Round-trip compr/decompr on 3.8 GB
Elapsed time: 13.9 s, 609.1 MB/s
• Generic implementation results:
::
Blosc version: 2.0.0a1 ($Date:: 2015-07-30 #$)
List of supported compressors in this build: blosclz
Supported compression libraries:
BloscLZ: 1.0.5
LZ4: unknown
Zlib: unknown
Using compressor: blosclz
Using shuffle type: shuffle
Running suite: suite
--> 1, 2097152, 8, 19, blosclz, shuffle
********************** Run info ******************************
Blosc version: 2.0.0a1 ($Date:: 2015-07-30 #$)
Using synthetic data with 19 significant bits (out of 32)
Dataset size: 2097152 bytes Type size: 8 bytes
Working set: 64.0 MB Number of threads: 1
********************** Running benchmarks *********************
memcpy(write): 2194.1 us, 911.5 MB/s
memcpy(read): 1170.8 us, 1708.2 MB/s
Compression level: 0
comp(write): 896.2 us, 2231.7 MB/s Final bytes: 2097168 Ratio: 1.00
decomp(read): 1179.3 us, 1695.9 MB/s OK
Compression level: 1
comp(write): 7534.4 us, 265.4 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 4117.1 us, 485.8 MB/s OK
Compression level: 2
comp(write): 7895.6 us, 253.3 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 4106.7 us, 487.0 MB/s OK
Compression level: 3
comp(write): 8262.2 us, 242.1 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 4113.9 us, 486.2 MB/s OK
Compression level: 4
comp(write): 8495.6 us, 235.4 MB/s Final bytes: 557840 Ratio: 3.76
decomp(read): 4042.6 us, 494.7 MB/s OK
Compression level: 5
comp(write): 10321.0 us, 193.8 MB/s Final bytes: 557840 Ratio: 3.76
decomp(read): 4033.9 us, 495.8 MB/s OK
Compression level: 6
comp(write): 11675.3 us, 171.3 MB/s Final bytes: 546320 Ratio: 3.84
decomp(read): 4096.4 us, 488.2 MB/s OK
Compression level: 7
comp(write): 10193.0 us, 196.2 MB/s Final bytes: 216528 Ratio: 9.69
decomp(read): 7150.9 us, 279.7 MB/s OK
Compression level: 8
comp(write): 10192.3 us, 196.2 MB/s Final bytes: 216528 Ratio: 9.69
decomp(read): 7167.7 us, 279.0 MB/s OK
Compression level: 9
comp(write): 10418.7 us, 192.0 MB/s Final bytes: 153160 Ratio: 13.69
decomp(read): 7870.8 us, 254.1 MB/s OK
--> 2, 2097152, 8, 19, blosclz, shuffle
********************** Run info ******************************
Blosc version: 2.0.0a1 ($Date:: 2015-07-30 #$)
Using synthetic data with 19 significant bits (out of 32)
Dataset size: 2097152 bytes Type size: 8 bytes
Working set: 64.0 MB Number of threads: 2
********************** Running benchmarks *********************
memcpy(write): 2243.1 us, 891.6 MB/s
memcpy(read): 1219.9 us, 1639.4 MB/s
Compression level: 0
comp(write): 846.8 us, 2361.9 MB/s Final bytes: 2097168 Ratio: 1.00
decomp(read): 1182.1 us, 1691.9 MB/s OK
Compression level: 1
comp(write): 3867.6 us, 517.1 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 2162.8 us, 924.7 MB/s OK
Compression level: 2
comp(write): 4054.2 us, 493.3 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 2156.6 us, 927.4 MB/s OK
Compression level: 3
comp(write): 4241.2 us, 471.6 MB/s Final bytes: 584976 Ratio: 3.59
decomp(read): 2169.6 us, 921.8 MB/s OK
Compression level: 4
comp(write): 4377.1 us, 456.9 MB/s Final bytes: 557840 Ratio: 3.76
decomp(read): 7556.9 us, 264.7 MB/s OK
Compression level: 5
comp(write): 5276.3 us, 379.1 MB/s Final bytes: 557840 Ratio: 3.76
decomp(read): 7556.7 us, 264.7 MB/s OK
Compression level: 6
comp(write): 6026.8 us, 331.9 MB/s Final bytes: 546320 Ratio: 3.84
decomp(read): 3108.2 us, 643.5 MB/s OK
Compression level: 7
comp(write): 5877.0 us, 340.3 MB/s Final bytes: 216528 Ratio: 9.69
decomp(read): 3668.5 us, 545.2 MB/s OK
Compression level: 8
comp(write): 5882.0 us, 340.0 MB/s Final bytes: 216528 Ratio: 9.69
decomp(read): 3531.2 us, 566.4 MB/s OK
Compression level: 9
comp(write): 7621.3 us, 262.4 MB/s Final bytes: 153160 Ratio: 13.69
decomp(read): 4978.3 us, 401.7 MB/s OK
Round-trip compr/decompr on 3.8 GB
Elapsed time: 21.9 s, 385.0 MB/s
We have achieved to implement shuffle NEON instructions for ARM that are twice
as fast as the generic implementation.
Enjoy developing for ARM!
Lucian Marc
c-blosc2-3.1.5/README_B2ND_FORMAT.rst 0000664 0000000 0000000 00000001012 15217434361 0016430 0 ustar 00root root 0000000 0000000 B2ND Format
===========
The B2ND format is meant for storing multidimensional datasets defined by a shape and a data type.
Both the shape and the data type follow the NumPy conventions.
It is just a `B2ND metalayer `_
on top of a Blosc2 `CFrame `_
(for contiguous storage) or `SFrame `_
(for sparse storage).
c-blosc2-3.1.5/README_B2ND_METALAYER.rst 0000664 0000000 0000000 00000006425 15217434361 0017000 0 ustar 00root root 0000000 0000000 B2ND Metalayer Format
=====================
This is a `metalayer `_ on top of a Blosc2
`CFrame `_ or
`SFrame `_
that is meant for storing multidimensional information.
Specifically, this metalayer is named 'b2nd' and follows this format::
|-0-|-1-|-2-|-3-|~~~~~~~~~~~~~~~~|---|~~~~~~~~~~~~~~~~|---|~~~~~~~~~~~~~~~~|
| 9X| v | nd| 9X| shape | 9X| chunkshape | 9X| blockshape |
|---|---|---|---|~~~~~~~~~~~~~~~~|---|~~~~~~~~~~~~~~~~|---|~~~~~~~~~~~~~~~~|
^ ^ ^ ^ ^ ^
| | | | | |
| | | | | +--[msgpack] fixarray with X=nd elements
| | | | +--[msgpack] fixarray with X=nd elements
| | | +--[msgpack] fixarray with X=nd elements
| | +--[msgpack] positive fixnum for the number of dimensions (up to 127)
| +--[msgpack] positive fixnum for the metalayer format version (up to 127)
+---[msgpack] fixarray with X=7 elements
The `shape` section is meant to store the actual shape info::
|---|--8 bytes---|---|--8 bytes---|~~~~~|---|--8 bytes---|
| d3| first_dim | d3| second_dim | ... | d3| nth_dim |
|---|------------|---|------------|~~~~~|---|------------|
^ ^ ^
| | |
| | +--[msgpack] int64
| +--[msgpack] int64
+--[msgpack] int64
Next, the `chunkshape` section is meant to store the actual chunk shape info::
|---|--4 bytes---|---|--4 bytes---|~~~~~|---|--4 bytes---|
| d2| first_dim | d2| second_dim | ... | d2| nth_dim |
|---|------------|---|------------|~~~~~|---|------------|
^ ^ ^
| | |
| | +--[msgpack] int32
| +--[msgpack] int32
+--[msgpack] int32
Next, the `blockshape` section is meant to store the actual block shape info::
|---|--4 bytes---|---|--4 bytes---|~~~~~|---|--4 bytes---|
| d2| first_dim | d2| second_dim | ... | d2| nth_dim |
|---|------------|---|------------|~~~~~|---|------------|
^ ^ ^
| | |
| | +--[msgpack] int32
| +--[msgpack] int32
+--[msgpack] int32
Finally, the `dtype` section is meant to store the data type information::
|---|---|--4 bytes---|--------------|
| XX| db| dtype_len | dtype_string |
|---|---|------------|--------------|
^ ^
| |
| +--[msgpack] str32
+--[msgpack] positive fixint (7-bit integer). dtype_format; 0 means NumPy format.
The 0 value for dtype_format means that the dtype_string field follows the NumPy convention
(e.g. an `int32_t` dtype is represented as "