Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Reading and writing separately from compute in the chunk executor

オープン
#4,860 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
8/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python

調査の方向性

The work lives in TimeSeriesChunkExecutor, where each worker currently reads, computes and writes in one loop, and the proposal splits that into a reader, compute and writer stage. Read the executor and the recording extractors it calls, and the benchmark numbers in the issue, before anything else. Done would mean a design agreed in the thread (the three questions are still open) and read/write concurrency set independently of n_jobs.

索引モデルが issue の本文から書いたものです。

説明

In TimeSeriesChunkExecutor, each worker reads a chunk, computes on it and writes it. So n_jobs sets three things at once: how many reads are in flight, how many cores compute and how much RAM is used. Storage backends want very different numbers of reads in flight, and that number has nothing to do with the compute.

#4833 and #4347 change the unit of work and where it runs; this is about how reads and writes are issued, and would work with either.

Backends want different numbers of reads in flight

A spinning disk serves one sequential reader best, since concurrent reads make it seek. NVMe wants the opposite: cold-cache reads of 384 int16 channels from a WD SN850X, with N threads each copying the next 1 s chunk out of a memory map as the executor does, ran at 5.6–5.7 GB/s on one thread and 6.8–6.9 GB/s on 8 or 16.

Compressed formats differ too. Reading 1 s chunks with N threads sharing one open file (40 s on NVMe, chunks of 3,750 × 384):

1 thread 4 threads 8 threads
HDF5, gzip 1 (h5py 3.16) 236–242 MS/s 239–243 242–244
zarr, gzip 1 (zarr 2.18) 231–237 MS/s 768–802 1,292–1,310

h5py holds a global lock, so threads don't help even with decompression; zarr's codecs release the GIL and scale 5.5 times on 8 threads.

Writes have the same coupling

Each worker writes its chunk at its own offset, so on a spinning disk the writes interleave too. With zarr v3 shards, several workers write parts of one shard; #4831 and #4833 address this by giving each job a run of chunks that covers a shard.

Proposal

The executor would run three stages:

  1. A reader issues reads the way the source prefers, into a window bounded by a memory budget. A source could declare a read size, an alignment (such as zarr chunk boundaries), how many reads to keep in flight and whether to read in time order. Sources that declare nothing are read as today.
  2. Compute takes chunks from the window and runs the chain. Adjacent chunks share margins, which are already in the window, so nothing is read twice.
  3. A writer writes results in time order, and could gather a whole zarr shard before writing it, whatever the chunk size.

No preprocessing step would change. With threads inside each step (#4857), one compute worker can use every core, so read concurrency, compute threads and RAM become separate settings.

Questions

  1. Should the executor own reading and writing like this, or should that stay with the extractors?
  2. Should read preferences live on the recording segment, since the extractor knows its store, or in job kwargs, since the user knows the disk?
  3. Would an opt-in reader for binary recordings be a useful first step?
主要言語
Python
スター
866
フォーク
285
平均マージ
2日 7時間
マージ済み PR(30日)
43

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SpikeInterface/spikeinterface のほかの issue

SpikeInterface/spikeinterface の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。