|
| 1 | +# How to generate plots from `divan` benchmark results ? |
| 2 | + |
| 3 | +>[!NOTE] |
| 4 | +> `divan` is benchmark harness we use in `rlnc` library crate. More about `divan` @ <https://docs.rs/divan/latest/divan>. These scripts for visualizing benchmark results are both `rlnc` and `divan` specific. They are not generic. Originally I used Google Gemini 2.5 Pro to generate these scripts. |
| 5 | +
|
| 6 | +1. First create a virtual environment using `venv`. |
| 7 | + |
| 8 | + ```bash |
| 9 | + python -m venv .venv |
| 10 | + source .venv/bin/activate # When done with plot generation, run `deactivate` |
| 11 | + ``` |
| 12 | + |
| 13 | +2. Install all the dependencies inside the virtual environment. |
| 14 | + |
| 15 | + ```bash |
| 16 | + pip install -r plots/scripts/requirements.txt |
| 17 | + ``` |
| 18 | + |
| 19 | +3. Apply git patch [visualize-plot-bench-result.patch](./visualize-plot-bench-result.patch) to extend benchmark input parameter set of RLNC encoder, recoder and decoder. This patch also disables custom memory allocator which can track memory allocation when benchmarking encoding, recoding or decoding. But for plotting purposes, we are only interested in throughput for various input configurations, so we can safely disable everything else. |
| 20 | + |
| 21 | + ```bash |
| 22 | + # This patch was generated on git tag v0.8.4 of this crate |
| 23 | + # If the benchmark files are not touched after that, this patch should work. |
| 24 | + git apply plots/scripts/visualize-plot-bench-result.patch |
| 25 | + ``` |
| 26 | + |
| 27 | +4. Run benchmark program and collect console output. |
| 28 | + |
| 29 | + ```bash |
| 30 | + RUSTFLAGS="-C target-cpu=native" cargo bench --profile optimized --bench full_rlnc_encoder |
| 31 | + RUSTFLAGS="-C target-cpu=native" cargo bench --profile optimized --bench full_rlnc_recoder |
| 32 | + RUSTFLAGS="-C target-cpu=native" cargo bench --profile optimized --bench full_rlnc_decoder |
| 33 | + ``` |
| 34 | + |
| 35 | +5. Copy console output of benchmark run; open corresponding Python script, say [encoder](./scripts/plot_encoder_bench_result.py), which plots RLNC Encoder benchmark results; update `benchmark_data` string with the result you copied and you want to visualize. |
| 36 | + |
| 37 | +6. Save the updated script and run the script to get resulting plot. |
| 38 | + |
| 39 | + ```bash |
| 40 | + python plots/scripts/plot_encoder_bench_result.py |
| 41 | + # or, provide desired output filename |
| 42 | + python plots/scripts/plot_encoder_bench_result.py rlnc_encoder.png |
| 43 | + ``` |
| 44 | + |
| 45 | +7. Do same for RLNC Recoder or Decoder. |
| 46 | + |
| 47 | +All scripts are inside [scripts](./scripts) directory. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Performance Benchmarking on x86_64 with AVX2 |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +## Performance Benchmarking on Intel x86_64 with AV512 |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +## Performance Benchmarking on AMD x86_64 with AV512 |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
0 commit comments