On this page
power
Limiting Core Usage in pymocd
Optional feature for controlling multi-threading behavior.
By default, pymocd
uses rayon
, a Rust-based data-parallelism library that automatically leverages all available logical CPU threads. This is ideal for maximizing performance—but not always convenient when you need to run other tasks in parallel or are benchmarking performance under constrained conditions.
To limit CPU usage, you can set the number of threads used by pymocd
with:
pymocd.set_thread_count(n)
This function should be used before starting the algorithm! (obviously!)
Using set_thread_count again in the samr code has no effect, due to static ThreadPoolBuilder initialization
You need to ‘free’ the library from memory, to setup a new number of logical threads again.
Parameter | Type | Description |
---|---|---|
n | u16 | How many logical threads you want to use. |
Last updated 31 May 2025, 17:21 -0300 .