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

ZI drivers + Rarr implementation #57

Open
wants to merge 89 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
479c282
Rename generate_data to implementations
joshmoore Oct 12, 2022
aba8bbd
Parallelize and unify GHAs
joshmoore Oct 12, 2022
eab673d
Move all implementations to subdirs
joshmoore Oct 12, 2022
c5d521f
Add environment files for each implementation
joshmoore Oct 12, 2022
ffb6e40
start re-working Makefile for parallelism
joshmoore Oct 12, 2022
f635ab8
Use Makefile patterns
joshmoore Oct 12, 2022
d3daa81
create driver.sh for each implementation
joshmoore Oct 12, 2022
4a93ff4
Fix GHA variable reference
joshmoore Oct 12, 2022
07b0382
fix if: clause in GHA
joshmoore Oct 12, 2022
1e63230
Use single quotes in GHA
joshmoore Oct 12, 2022
d988995
close quotes in GHA
joshmoore Oct 12, 2022
ee33ce2
Convert file-listing to JSON with jq
joshmoore Oct 12, 2022
ac90fd4
Add directory prefix
joshmoore Oct 12, 2022
f5e89c7
Add impl to matrix name
joshmoore Oct 12, 2022
f777577
Add blosc for java components
joshmoore Oct 12, 2022
54ac97f
js: handle missing data dir
joshmoore Nov 1, 2022
1afc30a
gha: only build pre if released works
joshmoore Nov 1, 2022
85ee2d9
gha: split reusable component to impl.yml
joshmoore Nov 1, 2022
5bda645
gha: drop use of 'set-output'
joshmoore Nov 1, 2022
c710fbe
gha: Attempt (cached) mamba
joshmoore Nov 1, 2022
fd686c3
xtensor: attempt unpinning
joshmoore Nov 1, 2022
30e6633
zarrita: install numcodecs from conda-forge
joshmoore Nov 1, 2022
98a28f9
pyn5: try installing from git
joshmoore Nov 1, 2022
e708ae2
xtensor: install gdal
joshmoore Nov 1, 2022
11a2686
Revert "xtensor: attempt unpinning"
joshmoore Nov 1, 2022
1bba956
pyn5: move up one more directory to find 'data'
joshmoore Nov 1, 2022
61491e2
xtensor: pin gdal to 3.0.4
joshmoore Nov 1, 2022
3d2014e
xtensor: pin to py38
joshmoore Nov 1, 2022
2a2a8a1
gha: add additional dep
joshmoore Nov 1, 2022
5740527
Start adding Rarr implementation
grimbough Feb 27, 2023
7834df0
Add driver.sh for Rarr
grimbough Feb 28, 2023
2137357
Add R version to environment
grimbough Feb 28, 2023
c5854ed
Install packages using conda
grimbough Feb 28, 2023
8a75823
No need for PAT
grimbough Feb 28, 2023
e4e5565
Install r package binaries
grimbough Feb 28, 2023
ec5708a
Functions to verify data
grimbough Feb 28, 2023
4a56505
Upgrade actions versions to use nodejs16
grimbough Mar 1, 2023
ae6d21f
Update Rarr validation script
grimbough Mar 1, 2023
f262aa1
Update environment files for Rarr
grimbough Mar 2, 2023
bcecb02
Add Rarr to README
grimbough Mar 2, 2023
ffec3bf
r-loder causes conda conflicts
grimbough Mar 2, 2023
f2d12ae
Update Rarr for nested writing
grimbough Mar 2, 2023
f995439
Update read_with_Rarr
grimbough Mar 2, 2023
20b3208
Didn't mean to remove xtensor_zarr test
grimbough Mar 2, 2023
24328d5
Messed up indentation
grimbough Mar 3, 2023
dc82cd8
Rarr can now read/write without compression
grimbough Mar 3, 2023
88f0236
Rarr will read/write gzip compressed chunks
grimbough Mar 7, 2023
a23424a
Try rolling back the top-level env changes
joshmoore Mar 9, 2023
02bfe6b
Allow multiple commands in the drivers
joshmoore Mar 9, 2023
a73cf47
Try adding tbb to get xtensor to pass
joshmoore Mar 9, 2023
2c4e954
Filter out xtensor for the moment
joshmoore Mar 9, 2023
27686a6
Update xtensor-zarr environment.yml - this works locally
grimbough Mar 9, 2023
986675e
Create initial enviroment with ZI_* name to save creating it twice
grimbough Mar 9, 2023
813b387
I think these are typos in the enivronment names. They match the dir…
grimbough Mar 9, 2023
ada020e
Use python 3.8
grimbough Mar 9, 2023
f66b5eb
Merge pull request #2 from grimbough/zi_drivers
joshmoore Mar 10, 2023
0beec6c
Add missing bash driver
joshmoore Mar 10, 2023
f52abd7
Minor cleanups
joshmoore Mar 10, 2023
bed9ade
Rename 'run' to 'write'
joshmoore Mar 10, 2023
d5647f1
Fix minor typos
joshmoore Mar 10, 2023
5447f13
fixes for zarrita
normanrz Mar 10, 2023
113cc39
Simplify top-level environment.yml
joshmoore Mar 10, 2023
ccd3636
Update GHA to write then read in parallel
joshmoore Mar 10, 2023
51c0f44
Fix new GHA setup
joshmoore Mar 10, 2023
bdaaa58
Merge pull request #3 from normanrz/zi_drivers
joshmoore Mar 10, 2023
1a11b06
Run read regardless
joshmoore Mar 10, 2023
53ac12f
Disable write_pre
joshmoore Mar 10, 2023
6ffc3e2
Update implementations/zarrita/environment.yml
joshmoore Mar 10, 2023
245e797
Update implementations/zarrita/environment.yml
joshmoore Mar 13, 2023
32dfa6c
Permit skipping an implementation by touching a .skip file
joshmoore Jul 23, 2024
a7ffd09
Fix zarr-python, zarrita, js
joshmoore Jul 23, 2024
f14f92f
Also support mamba
joshmoore Jul 23, 2024
e3826e4
Rarr: use bioconda package (untested; amd64)
joshmoore Jul 23, 2024
7cb742a
Add tensorstore implementation (.skipped)
joshmoore Jul 23, 2024
41f35df
Remove pre-release GH config; use an implementation
joshmoore Jul 23, 2024
36147f0
Put read skeleton in place
joshmoore Jul 23, 2024
e34dc30
Add `make list` targets
joshmoore Jul 23, 2024
f747875
Add read loop over files in 'formats' file
joshmoore Jul 23, 2024
b27cd72
Remove dangling 'formats' command in Makefile
joshmoore Jul 24, 2024
79ddfd6
Add env call to all python scripts
joshmoore Jul 24, 2024
225e71a
unify bash script headers
joshmoore Jul 24, 2024
1dc6f47
Locally working test_read_all.py
joshmoore Jul 24, 2024
99e3837
Attempt simplifying GH build
joshmoore Jul 24, 2024
1ce56f9
Debug 'import-im6.q16: unable to open X server'
joshmoore Jul 24, 2024
7693740
Try another method to determine mamba prefix
joshmoore Jul 24, 2024
7e06549
Quiet built and start adding .skip files
joshmoore Jul 24, 2024
46f4c77
Fix compile issues
joshmoore Jul 24, 2024
c2e0f77
Call test with pytest
joshmoore Jul 24, 2024
ab6667b
more skips
joshmoore Jul 24, 2024
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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data/**/
target*
.netcdf-java
.tensorstore
.git
38 changes: 22 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,44 @@ name: Build
on: [push, pull_request]

jobs:
test:
name: ${{ matrix.platform }} ${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
python-version: [3.7]
build:

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir

- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v1
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
channels: conda-forge,ome
activate-environment: ZI
channels: conda-forge,defaults
channel-priority: true
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
mamba-version: "*"
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

- name: Cache local Maven repository
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Run tests
shell: bash -l {0}
run: make
- name: Run build
shell: bash -el {0}
run: |
make write;
pytest test/test_read_all.py
90 changes: 90 additions & 0 deletions .github/workflows/impl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
name: Implementation tests

on:
workflow_call:
inputs:
implementation:
required: true
type: string
platform:
required: true
type: string
python-version:
required: true
type: string
zarr-python:
required: true
type: string
action:
required: true
type: string

jobs:

impl:
name: ${{ inputs.implementation }}-${{ inputs.action }}-${{ inputs.platform }}-py${{ inputs.python-version }}-${{ inputs.zarr-python }}
runs-on: ${{ inputs.platform }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{hashFiles( format('{0}/{1}/{2}', 'implementations/', inputs.implementation, '/environment.yml') ) }}

- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
channels: conda-forge,defaults
channel-priority: true
environment-file: implementations/${{ inputs.implementation }}/environment.yml
mamba-version: "*"
python-version: ${{ inputs.python-version }}
activate-environment: ZI_${{ inputs.implementation }}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

- name: Install zarr dev (optional)
shell: bash -l {0}
if: ${{ inputs.zarr-python == 'pre' }}
run: |
python -m pip install git+https://github.com/zarr-developers/zarr-python.git

- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

#
# Choose read or write based on {{ action }}
#

- name: Download previous output for testing
uses: actions/download-artifact@v3
if: ${{ inputs.action == 'read' }}
with:
name: ${{ inputs.implementation }}-${{ inputs.zarr-python }}-data
path: data

- name: Run build
shell: bash -l {0}
run: make implementations/${{ inputs.implementation }}-${{ inputs.action }}

- name: Save output for testing
uses: actions/upload-artifact@v3
if: ${{ inputs.action == 'write' }}
with:
name: ${{ inputs.implementation }}-${{ inputs.zarr-python }}-data
path: data
51 changes: 0 additions & 51 deletions .github/workflows/zarr-dev.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
target*
__pycache__/
generate_data/xtensor_zarr/build
implmenetations/xtensor_zarr/build
node_modules/
report.*

# ignore data subdirectories
data/**/
*iml
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM continuumio/miniconda3

WORKDIR /src
COPY environment.yml /src/environment.yml
RUN apt-get update -y && apt install -y freeglut3-dev
RUN apt-get update -y && apt install -y freeglut3-dev # Unsure why freeglut is here
RUN conda env create -f environment.yml -n z
SHELL ["conda", "run", "-n", "z", "/bin/bash", "-c"]

Expand Down
123 changes: 92 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,107 @@
IMPLEMENTATIONS=$(wildcard implementations/*)
CURRENT_DIR = $(shell pwd)

define HELP_TEXT
make [target]

Target(s):
write generate data for all implementations
list print directory\tpath pairs for all written data
read read all data written by all implementations
read-fast like read, but do not re-run `write`

Notes:
- Each implementation has a conda environment named ZI_<IMPL>

endef

export HELP_TEXT

.PHONY: help
help:
@echo "$$HELP_TEXT"

.PHONY: report

report: data
python test/test_read_all.py

.PHONY: test data

ifeq ($(TEST),) #################################################
# If TEST is not set, by default build everything, generate
# data for all implementations, and then run all pytests.

test: data
pytest -v
pytest -v -k W

data: $(IMPLEMENTATIONS)

else
# Otherwise, focus on a single implementation, only generating
# its data and using the "-k W-" keyword to limit which pytests
# get run

test: implementations/$(TEST)
pytest -v -k W-$(TEST)

data: implementations/$(TEST)

endif ##########################################################


data/reference_image.png:
python generate_reference_image.py

.PHONY: jzarr
jzarr: data/reference_image.png
bash generate_data/jzarr/generate_data.sh
define mk-impl-target
# For each of the items in our "implementations" directory,
# create targets which depend on the reference data and
# call the "driver.sh" script as necessary.

.PHONY: n5java
n5java: data/reference_image.png
bash generate_data/n5-java/generate_data.sh
.PHONY: write list read-fast read $1 $1/ $1-list $1-read-fast $1-read $1-write $1-destroy clean

.PHONY: pyn5
pyn5: data/reference_image.png
python generate_data/generate_pyn5.py
write: $1-write
list: $1-list

.PHONY: z5py
z5py: data/reference_image.png
python generate_data/generate_z5py.py
read-fast: $1-read-fast
read: $1-read

.PHONY: zarr
zarr: data/reference_image.png
python generate_data/generate_zarr.py
$1-write: data/reference_image.png
@if test -e $1/.skip; \
then >&2 echo "Skipping $1 -- $$(shell test -e $1/.skip && cat $1/.skip)"; \
else \
bash $1/driver.sh write; \
fi

.PHONY: zarrita
zarrita: data/reference_image.png
python generate_data/generate_zarrita.py
$1-list:
@if test -e $1/.skip; \
then >&2 echo "Skipping $1 -- $$(shell test -e $1/.skip && cat $1/.skip)"; \
else \
bash $1/driver.sh list; \
fi

.PHONY: js
js: data/reference_image.png
bash generate_data/js/generate_data.sh
$1-read-fast:
@if test -e $1/.skip; \
then >&2 echo "Skipping $1 -- $$(shell test -e $1/.skip && cat $1/.skip)"; \
else \
bash $1/driver.sh read $(DIR) $(DATASET); \
fi

.PHONY: xtensor_zarr
xtensor_zarr: data/reference_image.png
bash generate_data/xtensor_zarr/generate_data.sh

.PHONY: data
data: jzarr n5java pyn5 z5py zarr js xtensor_zarr zarrita
$1-read: write $1-read-fast

.PHONY: test

.PHONY: report
report: data
python test/test_read_all.py
# Alias for read & write
$1: $1-write $1-read

# Alias in case the trailing slash is included
$1/: $1

# Additional target to cleanup the environment
$1-destroy:
bash $1/driver.sh destroy

clean: $1-destroy

endef
$(foreach impl,$(IMPLEMENTATIONS),$(eval $(call mk-impl-target,$(impl))))
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ Test for compatibility. See [doc/development_overview.md](doc/development_overvi

## Implementations currently tested


* https://github.com/bcdev/jzarr
* https://github.com/saalfeldlab/n5-zarr
* https://github.com/aschampion/rust-n5
* https://github.com/xtensor-stack/xtensor-zarr
* https://github.com/gzuidhof/zarr.js
* https://github.com/zarr-developers/zarr-python
* https://github.com/constantinpape/z5

* https://gihutb.com/grimbough/Rarr

## Other implementations

Expand All @@ -23,3 +22,13 @@ Test for compatibility. See [doc/development_overview.md](doc/development_overvi
* [Zarr.jl](https://github.com/meggart/Zarr.jl) #42
* https://github.com/freeman-lab/zarr-js
* [GDAL >= 3.4](https://gdal.org/drivers/raster/zarr.html)

## Running locally

* Create an environment: `conda env create -n ZI -f environment.yml`
* Run `make`

## Other features

* `touch implementations/{impl}/.skip` to disable an implementation
* Use `make NODEBUG=1 ...` to quiet output
Loading
Loading