perf: pipeline-wide GPU + scratch optimizations#120
Open
FIrgolitsch wants to merge 4 commits into
Open
Conversation
On hosts where /tmp is small (62 GiB on the lab server) and lives on the same NVMe as the work directory, Nextflow's default 'scratch = true' fills /tmp with staged zarr outputs and crashes with ENOSPC. Adds a 'scratch_dir' param (default true, preserving previous behaviour) so per-subject configs can set it to false (run in workdir, no double-write) or to a /scratch_nvme path (stage on faster local FS without /tmp pressure). Wired into reconst_3d and preproc workflows. Per-subject configs on the server have been updated to scratch_dir = false.
Squashed from: 856a974 fix(n4): avoid doubling GPU memory in correct_bias_field astype fcecf2e perf(n4): cut per-iter D2H syncs and host-side per-section copies b6c9d12 n4: cut host-memory peak in bias-field script (relieves kcompactd0) 80e941f n4: appease ty in bias-field script (typed n4_kwargs + vol_for_blend)
…esume cache hazard)
This was referenced May 20, 2026
FIrgolitsch
added a commit
that referenced
this pull request
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Performance: pipeline-wide GPU + scratch optimizations
Stacked on #118 (pr-p-py314-modernization). Bundles the Nextflow scratch_dir config and several GPU performance fixes that touch resample + N4.
Commits
scratch_dirNextflow param so processes can stage IO on local NVMe instead of the work tree.resample prefetch+reconst_3d resample prefetch) — hides PCIe latency by prefetching tiles while the GPU resamples the previous one; tightens slot-tracking so cancelled futures release their GPU slot.n4 astype+n4 D2H syncs+n4 host-mem peak+n4 ty appease) — keeps the bias-field iteration on-device, removes unnecessary host transfers, and trims peak host memory.publishDirnow usesmode: 'symlink'for resample outputs so the run dir doesn't get duplicated on disk.Docs gaps
scratch_diris not yet mentioned indocs/NEXTFLOW_WORKFLOWS.md; that doc update will land as a follow-up so this chain matchesdevexactly.