Skip to content

Commit 3b282bb

Browse files
author
Maxim Egorushkin
committed
Benchmark command lines added.
1 parent ec5aa4d commit 3b282bb

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ CPU instruction cache efficiency and should be disabled, if possible, for best p
101101

102102
## Setup
103103

104+
```
105+
git clone git@github.com:max0x7ba/thp-usage.git
106+
cd thp-usage
107+
```
108+
109+
The following command lines are relative to `thp-usage` working directory.
110+
104111
### Enable transparent huge pages on your system
105112
The provided [THP settings](thp-always.service.d/thp-always.sh) minimize run-time of compute-heavy workloads. Feel free to adjust them for your particular use-cases and workloads.
106113

@@ -266,7 +273,17 @@ sudo apt install coreutils sed stress-ng icdiff
266273

267274
With the default settings, it times running 2,000 iterations of `stress-ng --matrix` memory-bound methods `copy` `negate`, `mult`, `add`, `mean` on `double[1024][1024]` (8MiB array) matrices using 1 CPU. Benchmarking using more than 1 CPU introduces noise of CPU contention delays into timings. For this reason, the benchmark defaults to using 1 CPU.
268275

269-
Takes ~3 seconds to run the benchmark with its default settings.
276+
Takes ~3 seconds to run the benchmark with its default settings:
277+
```
278+
./thp-benchmark.sh
279+
```
280+
281+
Settings are configurable with environment variables, e.g.:
282+
```
283+
n_cpus=8 n_ops=500 cpu_step=1 log_dir=/tmp/another-thp-benchmark ./thp-benchmark.sh
284+
```
285+
286+
`cpu_step=1` pins benchmark threads to CPUs in [0, n_cpus) range. Default `cpu_step=2` pins benchmark threads to every 2nd CPU in [0, n_cpus*2) range. This parameter prevents pinning 2 benchmark threads onto 2 SMT vCPUs sharing one CPU core. The correct value depends on the CPU topology, and it is the one that minimizes run-time when benchmarking using more than one CPU.
270287

271288
Enabling the compute-heavy THP settings should result in orders of magnitude reduction in "Cache DTLB Read Miss" metric relative to default THP settings.
272289

0 commit comments

Comments
 (0)