Skip to main content

Crates.io PyPI Documentation Build (rust) Build (python) codecov Rust nightly

HIDEFIX

This Rust and Python library provides an alternative reader for the HDF5 file or NetCDF4 file (which uses HDF5) which supports concurrent access to data. This is achieved by building an index of the chunks, allowing a thread to use many file handles to read the file. The original (native) HDF5 library is used to build the index, but once it has been created it is no longer needed. The index can be serialized to disk so that performing the indexing is not necessary.

In Rust:

use hidefix::prelude::*;

let idx = Index::index("tests/data/coads_climatology.nc4").unwrap();
let mut r = idx.reader("SST").unwrap();

let values = r.values::<f32>(None, None).unwrap();

println!("SST: {:?}", values);

or with Python using Xarray:

import xarray as xr
import hidefix

ds = xr.open_dataset('file.nc', engine='hidefix')
print(ds)

See the example for how to use hidefix for regular, parallel or concurrent reads.

Motivation

The HDF5 library requires internal locks to be thread-safe since it relies on internal buffers which cannot be safely accessed/written to from multiple threads. This effectively causes multi-threaded applications to use sequential reads, while competing for the locks. And also apparently cause each other trouble, perhaps through dropping cached chunks which other threads still need. It can be safely used from different processes, but that requires potentially much more overhead than multi-threaded or asynchronous code.

Some basic benchmarks

hidefix is intended to perform better when concurrent reads are made either to the same dataset, same file or to different files from a single process. For basic benchmarks the performance is on-par or slightly better compared to doing standard sequential reads than the native HDF5 library (through its rust-bindings). Where hidefix shines is once the multiple threads in the same process tries to read in any way from a HDF5 file simultaneously.

This simple benchmark tries to read a small dataset sequentially or concurrently using the cached reader from hidefix and the native reader from HDF5. The dataset is chunked, shuffled and compressed (using gzip):

$ cargo bench --bench concurrency -- --ignored

test shuffled_compressed::cache_concurrent_reads  ... bench:  15,903,406 ns/iter (+/- 220,824)
test shuffled_compressed::cache_sequential        ... bench:  59,778,761 ns/iter (+/- 602,316)
test shuffled_compressed::native_concurrent_reads ... bench: 411,605,868 ns/iter (+/- 35,346,233)
test shuffled_compressed::native_sequential       ... bench: 103,457,237 ns/iter (+/- 7,703,936)

Inspiration and other projects

This work is based in part on the DMR++ module of the OPeNDAP Hyrax server. The zarr format does something similar, and the same approach has been tested out on HDF5 as swell.

Metadata

Release files for hidefix 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hidefix 0.12.0
File Size Uploaded Provenance
hidefix-0.12.0.tar.gz 9.2 MB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for hidefix 0.12.0
File Interpreter ABI Platform
hidefix-0.12.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
hidefix-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
hidefix-0.12.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 23.1 MB

Release files / hidefix-0.12.0.tar.gz

Download URL hidefix-0.12.0.tar.gz
Size 9.2 MB
Tags Source
SHA-256 checksum
How to use checksums
a049519ee6650f8a656aee9a9af1f140dd15bdf85bd314e3fa1855c099c211c2
BLAKE2b-256 checksum
How to use checksums
61c89c7a462f9e241604d551fc44cc1e4979896141a9cbe98e665300e4f4d93e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15

Release files / hidefix-0.12.0-cp39-abi3-win_amd64.whl

Download URL hidefix-0.12.0-cp39-abi3-win_amd64.whl
Size 3.1 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
71da4677141ed6120e2033c4a2790131ed4e07ef1e4e8c1ab981c14cd8ddce90
BLAKE2b-256 checksum
How to use checksums
3732b775b4e394dd5b62f35bd10483460e305e952fd085f2d62b419875c3dc00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15

Release files / hidefix-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hidefix-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 9.3 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
722fdaa57e9beabe6c8f601b5a52395c8896754086f63a9ef2ef7479b2f58092
BLAKE2b-256 checksum
How to use checksums
254e94105ea32c6767f3f3b76d2f9580bfe661796fa54cf8ccf2af50426588ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15

Release files / hidefix-0.12.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL hidefix-0.12.0-cp39-abi3-macosx_11_0_arm64.whl
Size 1.5 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6f1b17285e39b0c0de7fa982c13db1d4bcdbad656054f26e82201c9cf1bb530a
BLAKE2b-256 checksum
How to use checksums
3870b10487781293d68a2f327d75d2a55542735e54de6841b84e183b573ccc14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15

Security for hidefix 0.12.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page