solprop.driver.executors.pool#
Run bounded spawned workers with explicit threads and memory admission control.
Functions
|
Return this process's peak resident memory in bytes. |
Classes
|
Record the admission calculation without treating it as a hard RSS limit. |
|
Execute independent points in memory-sized spawned processes. |
- class solprop.driver.executors.pool.MemoryBudget(limit, controller, per_worker, cores, threads)[source]#
Bases:
objectRecord the admission calculation without treating it as a hard RSS limit.
- Attributes:
- limitint
Effective memory allocation, bytes, positive.
- controllerint
Controller resident memory and output allowance, bytes, non-negative.
- per_workerint
Worker estimate, bytes, positive; backend RSS is counted once.
- coresint
CPUs available to this controller, positive.
- threadsint
Threads per worker, positive.
- workers(requested=None)[source]#
Choose a count within both CPU and memory allocations.
- Parameters:
- requestedint or None, optional
Optional upper bound on workers, positive.
- Returns:
- int
Admitted workers after reserving 20 percent of memory.
- Raises:
- DriverError
If inputs are invalid or one worker cannot fit.
- class solprop.driver.executors.pool.Pool(workers=None, memory_limit=None, threads=1, pin=True, fresh=False)[source]#
Bases:
objectExecute independent points in memory-sized spawned processes.
- Attributes:
- workersint or None
Positive maximum workers; None uses the CPU and memory admission rule.
- memory_limitint or None
Positive memory cap, bytes; None reads the allocation and physical memory.
- threadsint
Threads per worker, positive and one by default.
- pinbool
Pin workers within Linux CPU affinity; unavailable on macOS.
- freshbool
Start a fresh interpreter for every point instead of persistent workers.
- budgetMemoryBudget or None
Last measured admission calculation, absent before execution.
- budget: MemoryBudget | None = None#
- run(points, work)[source]#
Probe memory and run bounded work, yielding results as they finish.
- Parameters:
- pointsiterable
Independent point descriptions with global indices.
- workcallable
Pickleable worker operation; an optional probe reports RSS and ledger.
- Yields:
- object
Results in completion order, each retaining its input identity.
- Raises:
- DriverError
If resource admission fails or a worker exits abnormally.