Skip to content

Memory Errors ​

Each entry is a symptom, its cause, and a solution.

ResourceExceededError: direct dense simulation requires N bytes ​

SymptomResourceExceededError: plan_job: no feasible candidate -- direct dense simulation requires 17592186044416 bytes, budget is 7752519680 bytes; …
CauseYou asked for a statevector (or the circuit is only feasible densely), and the state needs more memory than the budget. A dense state of n qubits needs 16 · 2ⁿ bytes
SolutionAsk for less. Request counts or an expectation value instead, or use a smaller circuit, or split it. If the machine really has the memory, raise memory_budget_bytes (native API)

The default budget is lower than my RAM ​

SymptomA job that "should fit" is refused
CauseBy default only 50% of physical memory is budgeted
SolutionSet RunOptions.memory_budget_bytes explicitly through the native API. MENOSBackend has no such option

The message lists several reasons ​

SymptomA long error with several sections separated by semicolons
CauseIt names every candidate's refusal reason, so you can see what blocked each
SolutionRead each reason. A statevector request removes the stabilizer and MPS candidates ("only the dense engine can produce a statevector"), leaving only dense, which then fails on memory

A large job is refused but I only need an expectation value ​

SymptomA big circuit fails under a statevector request
CauseA statevector is 2ⁿ amplitudes regardless of what you do with it
SolutionRequest an expectation value through MENOSEstimator. Pauli propagation, MPS, tensor-network and cut strategies avoid the full state. See Expectation Values

The GPU ran out of memory ​

Symptomcuda: cudaMalloc failed: out of memory
CauseDevice memory was claimed after MENOS measured it
SolutionSee Troubleshooting CUDA

The process itself runs out of memory ​

SymptomThe operating system kills the process
CauseMemory outside what MENOS budgets: for example large counts dictionaries, statevector copies in NumPy, or other processes. MENOS budgets engine state, not your program's other allocations
SolutionRequest less, or lower the budget to leave headroom

See also ​

Memory Constraints · ResourceExceeded · Requirements

Released under the Apache-2.0 license. GitHub · PyPI