Skip to content

Size STARsolo memory to index + sort buffer; make it configurable - #93

Merged
agillen merged 1 commit into
masterfrom
star-memory
Oct 30, 2026
Merged

agillen merged 1 commit into
masterfrom
star-memory

Conversation

@agillen

@agillen agillen commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Problem

An Alpine run was OOM-killed at starsolo. The rules requested mem_mb = 48000 but told STAR --limitBAMsortRAM 48000000000. STAR keeps the genome index (about 30 GB for human) in RAM on top of the sort buffer, so large samples exceeded the allocation while sorting.

Fix

  • Default memory: STARsolo mem_mb defaults to the STAR_INDEX size on disk + 16 GB sort buffer + 4 GB headroom (32 GB is assumed for the index when the directory is absent, e.g. in CI).
  • Overrides: raise it with a new optional key STAR_mem_mb (sample, platform, chemistry or DEFAULTS), or with set-resources / --set-resources.
  • Sort buffer: --limitBAMsortRAM is derived from the job's final mem_mb, so it follows any override. A warning is logged if less than 2 GB is left for sorting.
  • Retry: the SLURM profile sets retries: 1. mem_mb scales with the attempt number, so a failed STAR job retries with 2x memory.
  • Threads: --runThreadN {threads} replaces the hardcoded 12.
  • Docs: README, AGENTS.md, config.yaml and the profile README, including Alpine's limit of about 3.8 GB per core on acpu.

Verification (Snakemake 9.27.1 dry-runs)

Setting mem_mb --limitBAMsortRAM
default (no index present) 52000 16 GB
--set-resources starsolo_R2:mem_mb=96000 96000 60 GB
per-sample STAR_mem_mb: 80000 80000 44 GB
30000 (too small) 30000 2 GB, plus a warning

The full dry-run (38 jobs) and the --profile profiles/slurm dry-run both pass.

🤖 Generated with Claude Code

The starsolo rules requested mem_mb=48000 but passed --limitBAMsortRAM
48000000000, so STAR's peak (genome index in RAM + 48 GB sort buffer)
exceeded the allocation and large samples were OOM-killed on SLURM.

- mem_mb defaults to the STAR_INDEX size on disk + 16 GB sort buffer +
  4 GB headroom; override with STAR_mem_mb (sample/platform/chemistry/
  DEFAULTS) or set-resources; scaled by the attempt number.
- --limitBAMsortRAM is derived from the job's final mem_mb, so any
  override keeps the two in sync; warn when < 2 GB remains for sorting.
- SLURM profile: retries: 1 (STAR retries with 2x memory).
- --runThreadN {threads} instead of a hardcoded 12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agillen
agillen merged commit b588350 into master Oct 30, 2026
2 checks passed
@agillen
agillen deleted the star-memory branch October 30, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant