Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

76 sharding in zarr #125

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
13382e9
Implement and test basic Zarr v3.
aliddell Aug 17, 2023
b33e4ad
Update and document Zarr v3 test.
aliddell Aug 17, 2023
3d51811
Remove unused headers.
aliddell Aug 18, 2023
e52db6f
Add compression to ZarrV3.
aliddell Aug 18, 2023
94f46da
Rename data_dir_ to data_root_ to avoid confusion when calling `get_d…
aliddell Aug 18, 2023
9e9d591
Move zarr_v3_init to zarr.cpp.
aliddell Aug 21, 2023
7da3130
Change zarr_version_ to chunk_dir_prefix_.
aliddell Aug 21, 2023
2c21e7d
Update CHANGELOG and README.
aliddell Aug 21, 2023
33a2685
Merge remote-tracking branch 'upstream/main' into basic-zarr-v3
aliddell Aug 21, 2023
0f63fa9
Merge remote-tracking branch 'upstream/main' into basic-zarr-v3
aliddell Sep 5, 2023
f28f4d5
Make a ZarrV2 class. Move ZarrV2 and ZarrV3 into their own directories.
aliddell Sep 7, 2023
869fff2
Pull out `bytes_of_type`.
aliddell Sep 14, 2023
2bbfb88
wip
aliddell Sep 14, 2023
8253bca
wip
aliddell Sep 15, 2023
5037d4a
wip
aliddell Sep 18, 2023
8343fad
wip
aliddell Sep 18, 2023
82438d0
Merge remote-tracking branch 'upstream/main' into 76-sharding-in-zarr
aliddell Sep 18, 2023
ecd0ae5
wip
aliddell Sep 18, 2023
95860c4
wip
aliddell Sep 19, 2023
940b04f
wip
aliddell Sep 19, 2023
ec0b57d
wip
aliddell Sep 20, 2023
b167b11
Add crc32 libs on Windows.
aliddell Sep 20, 2023
a58f9f2
Add crc32 lib on OSX.
aliddell Sep 20, 2023
38d5bb1
Some updates.
aliddell Sep 20, 2023
a6bef7d
wip (broken)
aliddell Sep 20, 2023
487e065
wip (maybe not broken)
aliddell Sep 20, 2023
6f58496
wip (testing)
aliddell Sep 20, 2023
1d5528d
remove crc32c
aliddell Sep 21, 2023
fcc8a53
wip
aliddell Sep 21, 2023
593d51c
bugfixes
aliddell Sep 21, 2023
6b1b550
use simulated empty for zarr v3 tests
aliddell Sep 21, 2023
73e42cf
wip
aliddell Sep 21, 2023
e5535c7
Multiscale (v2 only) working (but seems a bit slow).
aliddell Sep 21, 2023
c7224bd
Build on Mac
aliddell Sep 21, 2023
f6f46b5
Some cleanup
aliddell Sep 21, 2023
5cf012a
Merge branch '76-sharding-in-zarr' of github.com:aliddell/acquire-dri…
aliddell Sep 21, 2023
e3ac59a
Do error heandling a la #117.
aliddell Sep 21, 2023
bd64020
Update c-blosc to v1.21.5 for Windows and Mac. Add debug lib for c-bl…
aliddell Sep 21, 2023
2400daf
Rename Zarr::compression_params_ to Zarr::blosc_compression_params_.
aliddell Sep 21, 2023
45429fb
Account for early-morning delirium.
aliddell Sep 21, 2023
e950f06
Merge remote-tracking branch 'upstream/main' into 76-sharding-in-zarr
aliddell Sep 22, 2023
4af66a6
Merge branch 'main' into 76-sharding-in-zarr
aliddell Sep 25, 2023
9b6b07c
Do some error setting in Zarr writer.
aliddell Sep 26, 2023
14fc9fa
Move thread pool back to Zarr object.
aliddell Sep 27, 2023
85c0eae
Pull directory creation out of innermost loops.
aliddell Sep 27, 2023
36791f7
Create files in threads.
aliddell Sep 29, 2023
b3ce792
Merge remote-tracking branch 'upstream/main' into 76-sharding-in-zarr
aliddell Oct 2, 2023
edf6a64
remove do-nothing files
aliddell Oct 2, 2023
9f0e49f
Reinstate time limit in write-zarr-with-defaults.cpp
aliddell Oct 2, 2023
391d0f6
Merge remote-tracking branch 'upstream/main' into 76-sharding-in-zarr
aliddell Oct 19, 2023
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added

- Support for [Zarr v3](https://zarr-specs.readthedocs.io/en/latest/v3/core/v3.0.html).
- Support for
the [sharding storage transformer](https://web.archive.org/web/20230213221154/https://zarr-specs.readthedocs.io/en/latest/extensions/storage-transformers/sharding/v1.0.html)
in Zarr v3.
- Ship debug libs for C-Blosc on Linux and Mac.

### Changed

- Upgrades C-Blosc from v1.21.4 to v1.21.5.

### Fixed

- A bug where enabling multiscale without specifying the tile size would cause an error.
- Exceptions thrown off the main thread are now caught and logged, and Zarr throws an error in `append`.
- Job queue is now cleared after every operation.

## [0.1.4](https://github.com/acquire-project/acquire-driver-zarr/compare/v0.1.3...v0.1.4) - 2023-08-11

Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ This is an Acquire Driver that supports chunked streaming to [zarr][].
- **Zarr**
- **ZarrBlosc1ZstdByteShuffle**
- **ZarrBlosc1Lz4ByteShuffle**
- **ZarrV3**
- **ZarrV3Blosc1ZstdByteShuffle**
- **ZarrV3Blosc1Lz4ByteShuffle**

## Using the Zarr storage device

Expand All @@ -24,6 +27,10 @@ Chunking is configured using `storage_properties_set_chunking_props()` when conf
Multiscale storage can be enabled or disabled by calling `storage_properties_set_enable_multiscale()` when configuring
the video stream.

For the [Zarr v3] version of each device, you can use the `ZarrV3*` devices.
**Note:** Zarr v3 is not [yet](https://github.com/ome/ngff/pull/206) supported by the Python OME-Zarr library, so you
will not be able to read multiscale metadata from the resulting dataset.

### Configuring chunking

You can configure chunking by calling `storage_properties_set_chunking_props()` on your `StorageProperties` object
Expand All @@ -41,21 +48,21 @@ storage_properties_set_chunking_props(struct StorageProperties* out,
```

| ![frames](https://github.com/aliddell/acquire-driver-zarr/assets/844464/3510d468-4751-4fa0-b2bf-0e29a5f3ea1c) |
|:--:|
| A collection of frames. |
|:-------------------------------------------------------------------------------------------------------------:|
| A collection of frames. |

A _tile_ is a contiguous section, or region of interest, of a _frame_.

| ![tiles](https://github.com/aliddell/acquire-driver-zarr/assets/844464/f8d16139-e0ac-44db-855f-2f5ef305c98b) |
|:--:|
| A collection of frames, divided into tiles. |
|:------------------------------------------------------------------------------------------------------------:|
| A collection of frames, divided into tiles. |

A _chunk_ is nothing more than some number of stacked tiles from subsequent frames, with each tile in a chunk having
the same ROI in its respective frame.

| ![chunks](https://github.com/aliddell/acquire-driver-zarr/assets/844464/653e4d82-363e-4e04-9a42-927b052fb6e7) |
|:--:|
| A collection of frames, divided into tiles. A single chunk has been highlighted in red. |
| ![chunks](https://github.com/aliddell/acquire-driver-zarr/assets/844464/653e4d82-363e-4e04-9a42-927b052fb6e7) |
|:-------------------------------------------------------------------------------------------------------------:|
| A collection of frames, divided into tiles. A single chunk has been highlighted in red. |

You can specify the width and height, in pixels, of each tile, and if your frame size has more than one plane, you can
specify the number of planes you want per tile as well.
Expand Down Expand Up @@ -120,3 +127,5 @@ Then the sequence of levels will have dimensions 1920 x 1080, 960 x 540, 480 x 2
[Blosc]: https://github.com/Blosc/c-blosc

[Blosc docs]: https://www.blosc.org/

[Zarr v3]: https://zarr-specs.readthedocs.io/en/latest/v3/core/v3.0.html
4 changes: 2 additions & 2 deletions src/3rdParty/cblosc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ if(WIN32)
set(libd "${pwd}/lib/win64/libblosc-debug.lib")
elseif(APPLE)
set(lib "${pwd}/lib/osx/libblosc.a")
set(libd ${lib})
set(libd "${pwd}/lib/osx/libblosc-debug.a")
elseif(LINUX)
set(lib "${pwd}/lib/linux-amd64/libblosc.a")
set(libd ${lib})
set(libd "${pwd}/lib/linux-amd64/libblosc-debug.a")
endif()

message(STATUS "C-Blosc: ${pwd}")
Expand Down
Binary file not shown.
Binary file modified src/3rdParty/cblosc/lib/linux-amd64/libblosc.a
Binary file not shown.
2 changes: 1 addition & 1 deletion src/3rdParty/cblosc/lib/osx/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The library here was built as follows.

Against v1.21.4 (2c2f9bd) of the c-blosc source hosted at:
Against v1.21.5 (d306135) of the c-blosc source hosted at:
https://github.com/Blosc/c-blosc

It's a universal binary compiled for `arm64` and `x86_64`.
Expand Down
Binary file added src/3rdParty/cblosc/lib/osx/libblosc-debug.a
Binary file not shown.
Binary file modified src/3rdParty/cblosc/lib/osx/libblosc.a
Binary file not shown.
Binary file modified src/3rdParty/cblosc/lib/win64/libblosc-debug.lib
Binary file not shown.
Binary file modified src/3rdParty/cblosc/lib/win64/libblosc.lib
Binary file not shown.
Binary file modified src/3rdParty/cblosc/lib/win64/libblosc.pdb
Binary file not shown.
32 changes: 17 additions & 15 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
add_subdirectory(3rdParty)

if(NOT TARGET acquire-core-logger)
add_subdirectory(acquire-core-libs)
endif()
if (NOT TARGET acquire-core-logger)
add_subdirectory(acquire-core-libs)
endif ()

set(tgt acquire-driver-zarr)
add_library(${tgt} MODULE
prelude.h
tiled.frame.hh
tiled.frame.cpp
chunk.writer.hh
chunk.writer.cpp
frame.scaler.hh
frame.scaler.cpp
common.hh
common.cpp
writers/writer.hh
writers/writer.cpp
writers/chunk.writer.hh
writers/chunk.writer.cpp
writers/shard.writer.hh
writers/shard.writer.cpp
writers/blosc.compressor.hh
writers/blosc.compressor.cpp
zarr.hh
zarr.cpp
zarr.encoder.hh
zarr.encoder.cpp
zarr.raw.hh
zarr.raw.cpp
zarr.blosc.hh
zarr.blosc.cpp
zarr.v2.hh
zarr.v2.cpp
zarr.v3.hh
zarr.v3.cpp
zarr.driver.c
)
target_enable_simd(${tgt})
Expand Down
Loading
Loading