Repository navigation
Run pydeseq2 in one process - #135
Merged
Merged
Conversation
find_markers(test_use="deseq2") left pydeseq2 at its default of one joblib worker per CPU core, for both its DeseqDataSet and its DeseqStats, and the workers outlive the call. On the benchmark's PBMC 3k DE call they took the process tree from under 1 GB to 5.1 GB to save 1.6 s; the out-of-core tutorial's peak doubled to 11.5 GB. DESeq2 runs in one R process, and the answer does not depend on the worker count, so both objects now share one DefaultInference(n_cpus=1). tests/test_deseq2_seurat_parity.py records every parallel section pydeseq2 opens and requires one job; dropping the inference from either object fails it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The DE bench and the DE and out-of-core tutorial scripts re-run with the fix: DESeq2 is 4.00 s against Seurat's 10.01 s and peaks at 1.2 GB against 2.4 GB; the DE tutorial's Python peak falls from 7.2 GB to 3.1 GB and the out-of-core tutorial's from 11.5 GB to 5.6 GB. The tally is unchanged at 45/22/1. The report tells the history in section 5 and strikes the item from section 8; the changelog gains the fix and corrects the benchmark entry. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
What this does
find_markers(test_use="deseq2")left pydeseq2 at its default of one joblib worker process per CPU core. That happens twice: once in itsDeseqDataSetand again in itsDeseqStats. The workers outlive the call. Re-measuring the performance report (#134) found them:The number of processes grows with the core count, so on a 64-core server it would be 64.
multiprocessing.cpu_count()sets it, so no environment variable can cap it.DESeq2 runs in one R process, and the answer doesn't depend on the worker count. Both pydeseq2 objects now share one
DefaultInference(n_cpus=1).Test:
tests/test_deseq2_seurat_parity.py::test_the_fit_runs_in_one_processrecords every parallel section pydeseq2 opens and requiresn_jobs == 1. It also fails if no parallel section opened at all, so it can't pass by checking nothing.Measured
Same machine as #134 (Apple M5 Pro, 18 cores), both arms re-run:
de_DESeq2, PBMC 3k clusters 0 v 1DataFrame.equals) with 18 workers and with one.make_report.py. Section 5 tells the history, and section 8 strikes the item. The CHANGELOG gains the fix and corrects Re-measure the performance report for 2.0.0 #134's entry.Verification
inference=from both objects fails the new test;DeseqStatsalone also fails it, becausewald_testopens its own parallel section.tests/test_docs.pypasses, including the strict site build.main, with the fix applied part way through; the fix changes no output, as the equality check above shows.🤖 Generated with Claude Code