train: share one corpus copy across DDP ranks via shared-memory tensors (gate: spike)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 12/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
Start from the gate, not the code: the spike needs a 4-GPU node and must show RSS near 1x corpus with matching checkpoints before any implementation. Relevant code is LeechDataset.fill.finish() in src/leech/dataset.py, training._spawn_train, distributed.validate_request and distributed.use_fork_for_dataloader_workers, plus the mem_mb rule in train.smk. Done means the four listed tests pass and model_best.pt is bit-identical to the per-rank-copy run.
索引モデルが issue の本文から書いたものです。
説明
Problem
At --gpus N every rank builds its own LeechDataset from the same corpus. Measured in CLAUDE.md ("Multi-GPU training") on the 6.72M-chunk charging corpus: peak RSS 40.6 GiB at 1 GPU, 88.3 at 2, 157.6 at 4, i.e. memory scales 1:1 with ranks, and every rank repeats the ~3 min corpus load, which is the non-sharding floor on the 2.25x speedup. #241 named a shared-memory approach as the contingency but only the per-rank copy shipped.
Spec
Load the corpus once in the launching process, move its tensors to shared memory, and hand the dataset to the ranks.
- After
LeechDatasetfinishes filling (fill.finish()insrc/leech/dataset.py), addLeechDataset.share_memory_()which calls.share_memory_()on each large contiguous tensor/buffer (signal, sequence/kmer, features, labels, CSR map arrays). All remaining state must be picklable-small. training._spawn_train/ the spawn gate builds the dataset in the parent (rank-invariant parts only) and passes it viatorch.multiprocessingso ranks receive shm handles, not copies. DataLoader workers inside a rank must keep forking (seedistributed.use_fork_for_dataloader_workers).distributed.validate_requestcurrently refuses pre-loaded chunks; keep that refusal for the chunk-dict case and allow a shared-memoryLeechDataset.- Nothing may write to the shared tensors.
__getitems__gathers already copy; add a test that asserts the shared buffers are unchanged after an epoch (checksum before/after) so a later in-place augmentation cannot silently corrupt every rank. train.smk:mem_mbbecomescorpus_mem_mb + per_gpu_overhead * train_gpus(new config keys, defaults reproducing today's 1-GPU request). Shared pages are charged to the cgroup, so under-requesting kills the job at the end rather than at the start.
Acceptance criteria (measure first, see the spike below)
- Production corpus,
TCNDwellResidualLN,--gpus 4: peak cgroup memory <= ~60 GiB (was 157.6). - Per-rank corpus load time paid once (job wall at 4 GPUs reduced by roughly the repeated ~3 min).
- Final
model_best.ptis bit-identical to the current per-rank-copy run for the same seed (the--gpuspath must not change the recipe). --gpus 1unchanged (no process group, no shm).
Gate: spike first (~2 GPU-hours, one 4xA30 node)
Build the dataset once, share_memory_() it, run 4 independent single-GPU trainings for 2 epochs, and record memory.peak, per-epoch time against the 18:30 single-run baseline, and bit-equality of model_best.pt with a standalone same-seed run. Implementation proceeds only if RSS is near 1x the corpus and checkpoints match.
Tests
test_shared_dataset_tensors_are_sharedtest_shared_dataset_not_mutated_by_epochtest_two_rank_run_with_shared_dataset_matches_per_rank_copy(gloo/CPU)test_validate_request_still_refuses_chunk_dicts
Non-goals
- mmap-ing the npz (ADR 0006: degrades to ~1,668 rows/s on cache eviction).
- Sharing a DataLoader or sampler across models: samplers stay per run so paired comparisons hold.
- 主要言語
- Python
- スター
- 0
- フォーク
- 0
- 平均マージ
- 11時間 17分
- マージ済み PR(30日)
- 23
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rnabioco/leech のほかの issue
-
load_model_from_checkpoint drops num_out/signal_in_channels for models whose __init__ takes **kwargsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1週間以上 初心者へのやさしさ 18/100
メンテナーはふだん 1 日以内に返信
-
model train-many: one launcher that owns an allocation and trains a queue of configs across its GPUsオープン
難易度 5/5 1週間以上 初心者へのやさしさ 18/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
ui
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
future-agi/future-agi#5070 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
juandresrodca/AdminForge#69 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
deepset-ai/haystack-integrations#817 ·
メンテナーはふだん 12 日以内に返信
-
[Bug]: test_remote_realpath_uses_argument_vector fails on Windows with Python 3.13+ (ntpath.isabs)対応中かも @gouyu-hou が今日担当しました。 オープンtriage/confirmed
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
agentscope-ai/agentscope#4397 ·
メンテナーはふだん 2 日以内に返信