Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ uses `elements/` (the spec, `strings`, and the readers and writers that
- `raise _fail(e)` prints an exception as the one `Error:` line on stderr
and exits 1. `main(argv)` runs the arguments it is given and raises
`SystemExit` for its caller; run as the command (`argv` None), a failed
run ends the process at once (`_leave`), past h5py's teardown.
run ends the process at once (`_leave`), past h5py's teardown. For the
run it turns off numpy's requests for huge pages (`_small_pages`), which
stall every page fault on a node with fragmented memory, unless
`NUMPY_MADVISE_HUGEPAGE` is set.
- **`commands/`**: one module per command. Each orchestrates its command:
- planning and refusals;
- progress output;
Expand Down
17 changes: 17 additions & 0 deletions STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ moves; the plan of record for the current item is in the section below.

| Version | What | Issues |
|---|---|---|
| 0.17.8 | Sparse matrices read at least 32 MiB at a time (`subset` of a narrow matrix on Lustre in a quarter of the time); no numpy huge pages, which stalled writes on nodes with fragmented memory; Performance on cluster storage page and the `benchmarks/lustre/` probe | #129, #130 |
| 0.17.7 | `import dataframe --categorical` keeps numeric-looking labels (leiden's 0, 1, 10) as categoricals of their text; `convert --feature-type` / `--split-feature-types` take a 10x input with no feature types (Cell Ranger 2) as gene expression; every tag gets its GitHub release from the changelog | #124, #127, #114 |
| 0.17.6 | Audit fixes, waves 3 and 4 (streaming): reads and writes follow the source's chunks and Zarr v3 shards, each shard written once; `recast` checks and converts in `--chunk` blocks; `split`'s memory no longer grows with its groups; pickle arrays checked before use; 16-bit images export as they are; plain-line logs and names printed as stored; h5py >= 3.16 | #96, #97, #101, #103 |
| 0.17.5 | Audit fixes, wave 2 (fidelity): scanpy's marker genes and anndata 0.7 files survive every copy, data held outside an h5ad refused; subset/split keep every named row and subset every element as anndata; concat takes any number of inputs in anndata's order; 10x, MTX, Parse, CellBender, loom, SCope and MuData fixes; release pipeline hardened, image non-root; zarr >= 3.2 | #93, #94, #95, #99, #100, #102 |
Expand Down Expand Up @@ -34,6 +35,22 @@ theirs.

## Follow-ups noticed

- From the Lustre probe (0.17.8; docs/reference/cluster-storage.md), what
could make `adata` faster, in order:
- compress gzip HDF5 outputs on several cores (gzip h5ad, 10x `.h5` and
back spend 62 to 74% compressing on one), with `write_direct_chunk`;
- threaded gzip and faster number formatting for Matrix Market and the 10x
MTX folder;
- a faster Matrix Market parser: DuckDB parsed and sorted the same file 5.8
times as fast;
- a direct-I/O reader of HDF5 chunks, many in flight (Lustre reads 4 to 5
GB/s that way, against h5py's 450); on NFS, zarr's parallel reads were
already 3.8 times h5py's;
- concat's sparse blocks (`_entries_per_block`, which also sizes its CSC
buckets) and recast's have no 32 MiB floor yet.

zarrs' direct I/O was measured and dropped: it wrote uncompressed data
more slowly than without it.
- From #127: `convert` from h5ad refuses `--feature-type` and
`--split-feature-types`; they could filter on var's `feature_types`
column, so one h5ad converted from a multiome `.h5` splits as the `.h5`
Expand Down
89 changes: 89 additions & 0 deletions benchmarks/lustre/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Storage and engine probe

Measures, on an LSF cluster, where adata's time goes on big h5ad files and
which I/O engine would make it scale. Three storage tiers are compared:
Lustre, a compute node's local `/tmp`, and NFS.

- **Job A**: today's `adata`, one step per job, on each input and its 1/4
and 1/16 slices. The steps are subset (obs to h5ad and to Zarr, var),
split, convert (Zarr, gzip h5ad, 10x-h5 and back, 10x-mtx, loom), export
and import MTX, and export obs, var and obsm. For each it records wall,
CPU, peak RSS and bytes. The inputs in `PROFILE_LABELS` run every step
again under pyinstrument, which samples from inside the process (py-spy
needs ptrace, which LSF nodes refuse); `PARTS=profile` submits only
those reruns.
- **Job B**: read engines on one input's X:
- h5py;
- `h5chunks.py`, a read-only zarr store that maps an HDF5 dataset's
chunks to byte ranges, so zarr-python's concurrent engine reads them
without libhdf5;
- the same store fetching through obstore;
- DuckDB's `h5db` extension;
- DuckDB's `anndata` extension.
- **Job C**: write engines: h5py (uncompressed and gzip) against Zarr v2
and v3 under zarr-python's pipeline and under zarrs.
- **Job D**: the text formats: adata against DuckDB for MTX export and
import and obs to CSV.
- **Job E**: one command on Lustre at several `--chunk` sizes (rows a
block), twice each, to see what many small reads cost: `export
dataframe obs`, or `subset --obs` (`WHAT=subset_obs`), whose sparse
blocks are `--chunk` rows' worth of entries (`PARTS=chunks`, inputs in
`CHUNK_LABELS`).
- **Job F**: one node's ceiling, with plain byte ranges: buffered reads
against O_DIRECT at several depths, `lfs ladvise willneed`, several
processes, two files at once, and buffered against O_DIRECT writes
(`ceiling.py`, `PARTS=ceiling`).

None of the engines under test is a dependency of adata. They live only in
the probe's own venv.

## Run

1. **Copy the repository and this folder to the probe directory on Lustre:**
```
rsync -a --exclude .venv --exclude .git ./ HOST:$PROBE/repo/
rsync -a benchmarks/lustre/ HOST:$PROBE/scripts/
```
2. **Configure the probe:** copy `probe.conf.example` to
`$PROBE/probe.conf` and fill it in (paths, LSF group, inputs, slices).
3. **Build the venvs and fetch the DuckDB extensions,** on a host with
internet access:
```
PROBE=... bash $PROBE/scripts/setup.sh
```
4. **Submit everything,** from a submit host:
```
PROBE=... bash $PROBE/scripts/submit.sh
```
The jobs are chained so that the engine measurements don't run against
each other (see the header of `submit.sh`).
5. **When the jobs are done, write the report:**
```
$PROBE/venv/bin/python $PROBE/scripts/report.py $PROBE/results > report.md
```
6. **For the docs,** copy `$PROBE/results` and `$PROBE/profiles` off the
cluster and make the cleaned summary and the charts of
`docs/reference/cluster-storage.md` from them:
```
uv run python benchmarks/lustre/evidence.py summarise RESULTS PROFILES -o benchmarks/lustre/results/2026-12.json
uv run python benchmarks/lustre/evidence.py charts benchmarks/lustre/results/2026-12.json -o docs/_includes/charts
```
The raw results name the inputs' paths and the probe's folders; the
summary keeps neither, only the numbers the page uses.

To run Job E with another build of adata, say a branch's, install it into a
venv of its own and pass `ADATA` (that venv's `adata`) and `TAG` (a name for
the build, added to the step names) to `PARTS=chunks`.

## Reading the results

- **CPU share** is (user + system time) / wall:
- near 1, the step is computing;
- well under 1, it is waiting on storage;
- above 1, threads are working in parallel.
- **The slopes** are log(wall time) against log(input size), across an
input and its slices. 1 means linear.
- **Caching:** before each run the input is dropped from the page cache
(`posix_fadvise`, and `lfs ladvise` on Lustre), so a rerun on the same
node isn't flattered. The `cache_drop` column says whether that worked.
- **Disk space:** each output is deleted after it is measured.
Loading
Loading