test_cpu_parallel – CPU & Memory Load Generator in Rust
test_cpu_parallel is a small, zero‑dependency load‑testing kit. It can:
- load cores to verify scaling or system/container limits
- sweep 1 → N threads and export a tidy CSV for speed‑up plots
- hammer the memory hierarchy with random‑access touches beyond the LLC
- run stand‑alone from the CLI or be embedded in your own Rust code
A two‑minute build, no external data files, works on Linux, macOS and Windows.
Link to the Project page
📦 Installation
| what you want | command |
|---|---|
| CLI binary (optimised) | cargo install test_cpu_parallel |
| Library in an app / lib | cargo add test_cpu_parallel |
| Build from source | git clone … && cargo build --release |
Note Note The tool intentionally disables compiler optimizations using an unoptimized build for
cargo build --releaseandcargo install(by settingopt-level = 0). Whilecargo buildalso generates an unoptimized binary for debug, it is not equivalent to a --release build. For consistent performance comparisons, avoid mixing cargo build binaries with --release binaries.
⚡ CLI quick‑start
# Burn four threads for a few seconds
# Sweep 1 → 16 threads, write CSV
# Stress memory with 8 workers and a 512 MiB buffer
Run test_cpu_parallel --help for the complete flag list (excerpt below).
Usage: test_cpu_parallel [OPTIONS]
-w, --num_workers <N> parallel threads (default 2)
-m, --mode <cpu|memory> workload type (default cpu)
-f, --full sweep 1‥=N threads
-o, --output_file <PATH> write CSV (full mode)
--memory_size <MiB> buffer for memory test (default 1024)
📚 Library usage
Embed the engine in unit tests, benchmarks or monitoring agents:
use TestCPUParallel;
API docs are hosted on docs.rs/test_cpu_parallel.
🔧 Building from source
# Clone and build a debug binary (recommended for comparable timings)
📊 Analysing the CSV
Full‑mode output is a single CSV line per thread count, ready to feed into
Python/pandas, gnuplot or Excel. See the Notebooks/ directory in the repo for ready‑made Jupyter notebooks that plot speed‑up and efficiency curves.
More
- Project page & extended docs – https://github.com/LucaCanali/Miscellaneous/tree/master/Performance_Testing/Test_CPU_parallel_Rust
- Blog article that motivated the tool – https://db-blog.web.cern.ch/node/189
- Licence – Apache‑2.0
Enjoy hacking your CPUs 🔥