Skip to content

feat: add native SWMR support for concurrent read/write#61

Draft
14NGiestas wants to merge 20 commits intogeospace-code:mainfrom
14NGiestas:feature/swmr
Draft

feat: add native SWMR support for concurrent read/write#61
14NGiestas wants to merge 20 commits intogeospace-code:mainfrom
14NGiestas:feature/swmr

Conversation

@14NGiestas
Copy link
Copy Markdown
Contributor

@14NGiestas 14NGiestas commented Apr 22, 2026

Summary

Implemented SWMR (Single Writer Multiple Reader) support for concurrent file access.

Key Features

  • File Open: Added swmr flag to %open().
    • Sets H5F_LIBVER_LATEST for SWMR compatibility.
  • Writer: %flush(dataset) - flushes dataset to disk.
  • Reader: %refresh(dataset) - refreshes reader's view.

Notes

  • Uses file-level operations (H5Fflush_f) for portability across HDF5 Fortran bindings.
  • True SWMR requires HDF5 built with full Fortran SWMR API.

Tests

  • test_swmr: Main test
  • test_swmr_writer: Writes 5 iterations
  • test_swmr_reader: Reads concurrently

- Add iterate and visit procedures for HDF5 file traversal
- Add iterate.f90 and visit.f90 source files
- Fix line truncation issue in write.f90
- Fix error message typo (filena -> filename)
- Add datatype.f90 and deflate.f90 to CMakeLists.txt
- Add tests for iterate and visit procedures
- Various bugfixes from review
…erate/visit

Replace HDF5 Fortran wrappers with direct HDF5 Fortran module calls to fix
SIGSEGV with Intel ifx and undefined references on older HDF5 versions.

Changes:
- Use H5Literate_f and H5Ovisit_f Fortran wrappers (version-independent)
- Remove C API templates (.f90.in files) and version-specific configure logic
- Use H5Oget_info_by_name_f for type detection (handles all HDF5 versions)
- Use h5o_info_t from HDF5 Fortran module with H5Ovisit_f callback
- Use h5l_info_t from HDF5 Fortran module with H5Literate_f callback
- Fix fpm.toml duplicate [dependencies] section
- Remove nix shell files (preserved in feature/nix-shells branch)

Tested:
- GCC 9-15: pass (with -Werror)
- Intel ifx: iterate/visit pass without segfault
- HDF5 1.10-1.14: pass
- fpm: 8 visit objects, 4 iterate objects correct
@14NGiestas 14NGiestas marked this pull request as draft April 22, 2026 12:05
@scivision scivision force-pushed the main branch 6 times, most recently from 7c161ef to 073e381 Compare April 24, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant