Quick grab of L2-Cache sizes on x64 for stream
By fintanr on Aug 21, 2007
One of the benchmarks we run on a regular basis is stream, which needs you to set up some feasible values based on the size of your L2 cache. Following a recent discussion over on perf-discuss I figured a bit of background and sharing was called for. Now we get access to a lot of random hardware, both new and old, particularly in the x64 space, and you generally just want to get things up and running without thinking about every small config detail, so enter smbios(1M). As an example the L2-Cache entry on a box I'm looking at currently is
ID SIZE TYPE 6 27 SMB_TYPE_CACHE (processor cache) Location Tag: L2-Cache Level: 2 Maximum Installed Size: 1048576 bytes Installed Size: 1048576 bytes Speed: Unknown Supported SRAM Types: 0x10 SMB_CAT_PBURST (pipeline burst) Current SRAM Type: 0x10 (pipeline burst) Error Correction Type: 5 (single-bit ECC) Logical Cache Type: 5 (unified) Associativity: 5 (4-way set associative) Mode: 2 (varies by address) Location: 0 (internal) Flags: 0x1 SMB_CAF_ENABLED (enabled at boot time)Now smbios is incredibly useful, but it still doesn't give us a generic solution that works most of the time for the task at hand, so enter Perl, and getl2cachesize. Its short and sweet, but if your running stream it will give you a good starting point for your array sizes. A couple of other pointers, I'll leave compiler optimizations for your on reading, but as a warning stream is very variant, so get a lot of runs, generally we get twenty iterations, average that as a single run, reboot, and get at least five runs.