﻿# Snakemake mem_mb: a job memory declaration needs scheduler and executor interpretation

Interpret Snakemake job memory resources, workflow-wide scheduling limits and executor-specific mappings without confusing host RAM, per-thread values and GPU VRAM.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-snakemake-mem-mb-job-resource-executor-mapping/
Language: en

## More threads accidentally imply the wrong memory plan

A model preprocessing rule declares host memory and several threads. An operator assumes the memory value applies independently to each thread, while another interprets it as a workflow-wide budget. Both assumptions can differ from the intended per-job resource contract and the selected executor's mapping.

Write the scope explicitly before estimating concurrency. A job's requirement, the total scheduling budget and a batch system's resource request are related values, but they are not automatically interchangeable measures of application memory.

## Rule resources describe job requirements

The [Snakemake rule reference](https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html) explains resources and distinguishes per-job requirements from per-thread assumptions. It also documents resource scopes and dynamic resource behavior. Inspect the actual rule rather than inferring scope from a short name alone.

For a preprocessing job, estimate the peak host-memory demand of that invocation. Thread count can affect that demand, but multiplying an already total estimate by threads again can overstate the requirement. Conversely, understating the peak can admit too many concurrent jobs.

## The execution budget controls admission

The [command-line guide](https://snakemake.readthedocs.io/en/stable/executing/cli.html) documents resource limits and resource overrides. These settings affect scheduling of jobs under the declared resource model. They are not continuous measurements of a running application's real resident memory.

A declared limit should therefore be checked against observations from a representative workload. [Memory pressure events](/journal/cgroup-v2-memory-high-events/) provide a separate runtime view in environments using memory control groups. An admission decision and actual pressure inside a process are different evidence.

## Executors map resources to another system

The [Slurm executor guide](https://snakemake.github.io/snakemake-plugin-catalog/plugins/executor/slurm.html) describes backend resource mapping, including job-memory options. Review the selected plugin's semantics rather than assuming a local scheduling declaration maps identically to every batch system.

Keep mutually different backend resource concepts separate when configuring a profile. The workflow author may express a portable requirement, while the operator supplies the site-specific queue and resource interpretation needed to submit that requirement correctly.

## Host memory does not allocate model VRAM

[CPU and GPU responsibilities](/journal/cpu-gpu-hybrid-architecture/) explain why a host-memory declaration cannot establish accelerator capacity. Tokenization, cached dataset pages and model device buffers belong to different parts of the workload. A job can fit host RAM and still exceed device memory during inference.

Verify a small representative execution, then inspect the requested resources, backend allocation and observed application memory separately. The final resource explanation should connect those layers without treating a successful submission as proof of sufficient capacity for every model context or batch size.
