PAR_MEM(8)
๐ธ NAME ๐ธ
okay bestie, meet par_mem โ the memory parallelism benchmark ๐ she's part of the LMBENCH crew, and she lives in section 8 of the manual (yep, the sysadmin girlies), so her full government name is par_mem(8). ๐
๐ SYNOPSIS ๐
par_mem [ -L <line size> ] [ -M <len> ] [ -W <warmups> ] [ -N <repetitions> ]
so the synopsis ships four little knobs, and since the page doesn't spill extra tea about them beyond this line, here they are exactly as written, no notes, no embellishment:
-L <line size>โ the line size one ๐งต-M <len>โ the len one ๐-W <warmups>โ the warmups one ๐ฅ-N <repetitions>โ the repetitions one ๐
โจ DESCRIPTION โจ
okay so par_mem measures the available parallelism in the memory hierarchy, up to len bytes. ๐ฆ
here's the vibe: modern processors can often service multiple memory requests in parallel, while older processors typically blocked on LOAD instructions and had no available parallelism at all โ other than the parallelism that cache prefetching provides, anyway. and because the available parallelism is often a function of where the data sits in the memory hierarchy, she measures it at a whole variety of points. iconic behavior honestly. ๐
๐ง how she actually does it ๐ง
to measure the available parallelism, par_mem runs a variety of experiments at each memory size โ one for each level of parallelism. the recipe:
- she builds a pointer chain of the desired length. ๐
- then she creates an array of pointers which point to chain entries that are evenly spaced across the chain.
- then she starts running the pointers forward through the chain in parallel. ๐โโ๏ธ๐โโ๏ธ
- from that she can measure the average memory latency for each level of parallelism, and the available parallelism is:
minimum average memory latency for parallelism 1 รท average memory latency across all levels of available parallelism ๐งฎ
no cap, that's the whole formula, bestie.
๐ซถ the parallelism-2 inner loop, for the visual learners ๐ซถ
for example, the inner loop which measures parallelism 2 would look something like:
for (i = 0; i < N; ++i) { p0 = (char **)*p0; p1 = (char **)*p1; }
in a for loop (the overhead of the for loop is not significant; the loop is an unrolled loop 100 loads long). ๐
so like, in this case: if the hardware can process two LOAD operations in parallel, then the overall latency of the loop should be equivalent to that of a single pointer chain, so the measured parallelism would be roughly two. ๐โจ
but if the hardware can only process a single LOAD operation at once, or if there's (significant) resource contention between the two LOAD operations, then the loop will be much slower than a loop with a single pointer chain โ so the measured parallelism will be less than two, and probably no smaller than one. ๐ it's giving "the hardware said no."
๐ OUTPUT ๐
the output format is intended as input to xgraph or some similar program (they use a perl script that produces pic input, fyi). ๐จ
there's a set of data produced for each stride. and:
- the data set title is the stride size ๐ท๏ธ
- the data points are the array size in megabytes (that's a floating point value, bestie) ๐
- plus the load latency over all points in that array โฑ๏ธ
๐ SEE ALSO ๐
go read the whole squad, they're all mother. ๐
๐ซถ AUTHOR ๐ซถ
Carl Staelin and Larry McVoy โ the icons who made her. ๐
and fr fr: Comments, suggestions, and bug reports are always welcome. ๐ they want to hear from you, don't be shy.
๐ that's the whole page, bestie โ go benchmark something and slay. periodt. ๐ โจ
(c)2000 Carl Staelin and Larry McVoy โ $Date$ ๐ this page is PAR_MEM(8), brought to you by the LMBENCH girlies. bye bestie! ๐ฆ๐
๐ฆ where this page comes from
- debian bookworm: lmbench 3.0-a9+debian.1-6
- debian trixie: lmbench 3.0-a9+debian.1-9
- ubuntu jammy: lmbench 3.0-a9+debian.1-6
- ubuntu noble: lmbench 3.0-a9+debian.1-6build3
- ubuntu questing: lmbench 3.0-a9+debian.1-9
- ubuntu resolute: lmbench 3.0-a9+debian.1-10
- ubuntu stonking: lmbench 3.0-a9+debian.1-10
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms