Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c912256
docs: add HDF5 1.10.5+ support implementation plan
shinaoka Feb 5, 2026
2ef573e
feat: add HDF5 version storage and detection
shinaoka Feb 5, 2026
a54f10a
feat: add H5O_info1_t type for HDF5 < 1.12
shinaoka Feb 5, 2026
8ade6fc
feat: add pre-1.12 H5O functions (H5Oget_info1, H5Oopen_by_addr)
shinaoka Feb 5, 2026
657547c
feat: change LocationToken to enum for pre-1.12 support
shinaoka Feb 5, 2026
91910a3
feat: export version functions from sys module
shinaoka Feb 5, 2026
172e978
ci: test multiple HDF5 versions (1.10.x, 1.12, 1.14)
shinaoka Feb 5, 2026
5a73886
feat: complete HDF5 1.10.x compatibility and CI matrix testing
shinaoka Feb 5, 2026
c1d412f
refactor: rename crates to hdf5-rt and hdf5-rt-types
shinaoka Feb 5, 2026
1410a47
fix: support HDF5 2.x in version test
shinaoka Feb 5, 2026
b049974
feat: add HDF5 2.x compatibility
shinaoka Feb 5, 2026
057fb0f
fix: leak HDF5 library handle to prevent cleanup issues
shinaoka Feb 5, 2026
dc6cd6b
ci: use single-threaded tests on Linux to avoid SIGSEGV
shinaoka Feb 5, 2026
36021b9
ci: simplify CI and disable test_plist temporarily
shinaoka Feb 5, 2026
d19b012
ci: upgrade Julia to 1.11 to fix curl_multi_assign abort
shinaoka Feb 5, 2026
e0b4895
fix: re-enable test_plist and improve PropertyList error handling
shinaoka Feb 5, 2026
eb5d04b
fix: CI fixes for test_plist SIGSEGV and Julia interop
shinaoka Feb 5, 2026
669bfc2
ci: add gdb backtrace for test_plist SIGSEGV debugging
shinaoka Feb 5, 2026
d11e8dd
fix: correct hbool_t type from c_uint (4 bytes) to u8 (1 byte)
shinaoka Feb 5, 2026
82e93d8
fix: Julia interop CI - add JLL dependency paths and pin ubuntu
shinaoka Feb 5, 2026
3a55449
ci: simplify Julia interop to JLL-only, fix attribute read API
shinaoka Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 39 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,62 +35,58 @@ jobs:
run: cargo clippy --workspace -- -D warnings -A clippy::multiple-crate-versions

test:
name: test (${{ matrix.os }})
name: test (${{ matrix.os }}, HDF5 ${{ matrix.hdf5 }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
include:
# Ubuntu with system HDF5 1.10.x (minimum supported version)
- os: ubuntu-22.04
hdf5: "1.10"
hdf5_source: "apt"
# Ubuntu with conda HDF5 1.12.x
- os: ubuntu-22.04
hdf5: "1.12"
hdf5_source: "conda"
# Ubuntu with conda HDF5 1.14.x
- os: ubuntu-24.04
hdf5: "1.14"
hdf5_source: "conda"
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install HDF5 from apt (1.10.x)
if: matrix.hdf5_source == 'apt'
run: sudo apt-get update && sudo apt-get install -y libhdf5-dev
- name: Setup Conda
if: matrix.hdf5_source == 'conda'
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.11"
- name: Install HDF5 1.12+ from conda-forge
- name: Install HDF5 from conda-forge
if: matrix.hdf5_source == 'conda'
shell: bash -el {0}
run: conda install -c conda-forge hdf5>=1.12
- name: Build
run: conda install -c conda-forge "hdf5>=${{ matrix.hdf5 }},<${{ matrix.hdf5 }}.99"
- name: Set HDF5 library path (conda)
if: matrix.hdf5_source == 'conda'
shell: bash -el {0}
run: cargo build --workspace --verbose
- name: Run tests
run: echo "LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Show HDF5 version
shell: bash -el {0}
run: cargo test --workspace --verbose

test-features:
name: test features (${{ matrix.features }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- ""
- "complex"
- "f16"
- "complex,f16"
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.11"
- name: Install HDF5 1.12+ from conda-forge
shell: bash -el {0}
run: conda install -c conda-forge hdf5>=1.12
- name: Build with features
shell: bash -el {0}
run: cargo build --workspace --features "${{ matrix.features }}" --verbose
- name: Test with features
run: |
if command -v h5dump &> /dev/null; then
h5dump --version
else
echo "h5dump not in PATH, checking library..."
find /usr -name "libhdf5*.so*" 2>/dev/null | head -5 || true
fi
- name: Run tests
shell: bash -el {0}
run: cargo test --workspace --features "${{ matrix.features }}" --verbose
run: cargo test --workspace --all-features --verbose

macos:
name: macOS
Expand All @@ -111,7 +107,7 @@ jobs:

interop-julia:
name: Julia interop
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v6
Expand All @@ -120,22 +116,12 @@ jobs:
- name: Install Julia
uses: julia-actions/setup-julia@v2
with:
version: '1.10'
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.11"
- name: Install HDF5 1.12+ from conda-forge
shell: bash -el {0}
run: conda install -c conda-forge hdf5>=1.12
version: '1.11'
- name: Setup Julia project
shell: bash -el {0}
run: |
cd tests/julia
julia --project=. -e 'using Pkg; Pkg.instantiate()'
- name: Run Julia interop tests
shell: bash -el {0}
run: |
cd tests/julia
julia --project=. test_interop.jl
Expand All @@ -156,6 +142,9 @@ jobs:
- name: Install HDF5 1.12+ and h5py from conda-forge
shell: bash -el {0}
run: conda install -c conda-forge hdf5>=1.12 h5py
- name: Set HDF5 library path
shell: bash -el {0}
run: echo "LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Install Python dependencies
shell: bash -el {0}
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ sweep.timestamp
tests/julia/Manifest.toml

# Python virtual environment
tests/python/.venv/
tests/python/.venv/
status.md
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Agent Guidelines for tensor4all-hdf5-ffi
# Agent Guidelines for hdf5-rt

Read `README.md` before starting work.

Expand Down Expand Up @@ -77,7 +77,7 @@ gh pr create --base main --title "Title" --body "Desc"
gh pr merge --auto --squash --delete-branch

# Large: worktree workflow
git worktree add ../tensor4all-hdf5-ffi-feature -b feature
git worktree add ../hdf5-rt-feature -b feature

# Check PR before update
gh pr view <NUM> --json state # Never push to merged PR
Expand Down
15 changes: 6 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ authors = [
]
keywords = ["hdf5"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/tensor4all/tensor4all-hdf5-ffi"
homepage = "https://github.com/tensor4all/tensor4all-hdf5-ffi"
repository = "https://github.com/tensor4all/hdf5-rt"
homepage = "https://github.com/tensor4all/hdf5-rt"
edition = "2021"

[workspace.dependencies]
Expand All @@ -24,13 +24,10 @@ libloading = "0.9"
num-complex = { version = "0.4", default-features = false }

# internal
tensor4all-hdf5-ffi = { path = "hdf5" }
tensor4all-hdf5-types = { path = "hdf5-types" }
# alias for internal use (to avoid changing source code)
hdf5-types = { path = "hdf5-types", package = "tensor4all-hdf5-types" }

# Use hdf5-metno-sys from crates.io
hdf5-sys = { package = "hdf5-metno-sys", version = "0.11" }
hdf5-rt = { path = "hdf5" }
hdf5-rt-types = { path = "hdf5-types" }
# alias for internal use (to avoid changing all source code)
hdf5-types = { path = "hdf5-types", package = "hdf5-rt-types" }

[profile.dev]
# Fast compile, reasonable runtime
Expand Down
54 changes: 38 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,51 @@
# tensor4all-hdf5-ffi
# hdf5-rt

Thread-safe Rust bindings for the HDF5 library, forked from [hdf5-metno](https://github.com/metno/hdf5-rust) for the tensor4all project.
Thread-safe Rust bindings for the HDF5 library with **runtime loading** (dlopen).

Forked from [hdf5-metno](https://github.com/metno/hdf5-rust).

## Overview

This is a simplified fork of hdf5-metno with:
- Removed features: MPI, compression filters (blosc, lzf, zfp)
- Removed derive macros (hdf5-derive)
- Uses hdf5-metno-sys from crates.io for FFI bindings
- Infrastructure for runtime library loading (dlopen) for Julia/Python bindings
`hdf5-rt` loads the HDF5 library at runtime via dlopen, eliminating build-time dependencies on HDF5. This makes it ideal for:

- **Julia/Python bindings** - Reuse the HDF5 library already loaded by HDF5.jl or h5py
- **Portable binaries** - Ship without bundling HDF5
- **Version flexibility** - Work with any compatible HDF5 version installed on the system

## Features

- **Runtime loading** - No compile-time HDF5 dependency
- **HDF5 1.10.5+ support** - Compatible with Ubuntu 22.04, HDF5.jl, h5py
- **Thread-safe** - Safe concurrent access to HDF5

Optional features:
- `complex`: Complex number type support (Complex32, Complex64)
- `f16`: Float16 type support
- `runtime-loading`: Runtime library loading via dlopen (infrastructure only)

## Usage

```toml
[dependencies]
hdf5 = { git = "https://github.com/shinaoka/tensor4all-hdf5-ffi" }
hdf5-rt = { git = "https://github.com/tensor4all/hdf5-rt" }
```

## Requirements

- **HDF5 1.12.0 or later** - The library uses HDF5 1.12+ features
```rust
use hdf5_rt::File;

fn main() -> hdf5_rt::Result<()> {
let file = File::create("test.h5")?;
let group = file.create_group("data")?;
let dataset = group.new_dataset::<f64>()
.shape([100, 100])
.create("matrix")?;
Ok(())
}
```

## Building
## Requirements

Requires HDF5 library (version 1.12.0+) installed on your system:
- **HDF5 1.10.5 or later** installed on your system
- Rust 1.80.0+

```bash
# Ubuntu/Debian
Expand All @@ -39,6 +55,13 @@ sudo apt-get install libhdf5-dev
brew install hdf5
```

## Crates

| Crate | Description |
|-------|-------------|
| `hdf5-rt` | Main HDF5 bindings with runtime loading |
| `hdf5-rt-types` | Native Rust equivalents of HDF5 types |

## License

Licensed under either of:
Expand All @@ -49,5 +72,4 @@ at your option.

## Acknowledgments

Based on [hdf5-metno](https://github.com/metno/hdf5-rust) by Magnus Ulimoen and contributors.

Based on [hdf5-metno](https://github.com/metno/hdf5-rust) by Ivan Smirnov, Magnus Ulimoen, and contributors.
Loading
Loading