Optimize memory management and fix parallel deadlocks for HPC#28
Open
Lesky47 wants to merge 3 commits into
Open
Optimize memory management and fix parallel deadlocks for HPC#28Lesky47 wants to merge 3 commits into
Lesky47 wants to merge 3 commits into
Conversation
ASCAT expects data frames; convert SNPpos to data.frame. Deep copy of SNPpos to avoid modifying the original object by reference.
- Replaced DT sorting with setorder. Replaced 'foreach' + '.combine="rbind"' with 'lapply' + 'rbindlist' to avoid quadratic copying. Peak RAM dropped from >400GB to ~20GB with 16 cores in this step. Runtime dropped from 1.5 hrs to seconds. - Updated parallelization in allele counting with 'callr' package. Previous 'doParallel::stopImplicitCluster' creates OpenMP deadlocks for the second bam at allele counting step. Now using callr::r() to isolate per-sample processing. Reclaims memory and clears locks between BAM files. - Bugfix: Corrected invalid 'on=' argument to 'by=' in SNP data.table merge
NMNS93
requested changes
Mar 7, 2026
Collaborator
NMNS93
left a comment
There was a problem hiding this comment.
Other than the TODO, LGTM. Thanks!
| tsnps <- tsnps[BAF_n >= 0.08 & BAF_n <= 0.92] | ||
|
|
||
| # Temporarily changed to 0.2 and 0.8 for high coverage WGBS data. | ||
| # TODO: fix this later !!! |
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.
Replaced DT sorting with setorder. Replaced 'foreach' + '.combine="rbind"' with 'lapply' + 'rbindlist' to avoid quadratic copying. Peak RAM dropped from >400GB to ~20GB with 16 cores in this step. Runtime dropped from 1.5 hrs to seconds.
Updated parallelization in allele counting with 'callr' package. Previous 'doParallel::stopImplicitCluster' creates OpenMP deadlocks for the second bam at allele counting step. Now using callr::r() to isolate per-sample processing. Reclaims memory and clears locks between BAM files.
Bugfix: Corrected invalid 'on=' argument to 'by=' in SNP data.table merge