<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zhiwei Chen on Medium]]></title>
        <description><![CDATA[Stories by Zhiwei Chen on Medium]]></description>
        <link>https://medium.com/@wrightchen?source=rss-9994a400a2d1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UdgTfHaRKhri16TfI2Q32Q.jpeg</url>
            <title>Stories by Zhiwei Chen on Medium</title>
            <link>https://medium.com/@wrightchen?source=rss-9994a400a2d1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 00:01:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wrightchen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[CoreMark-Pro & CoreMark Benchmark Variation Research]]></title>
            <link>https://medium.com/@wrightchen/coremark-pro-coremark-benchmark-variation-research-0bf8e36b2323?source=rss-9994a400a2d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/0bf8e36b2323</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[coremark-pro]]></category>
            <category><![CDATA[performance-analysis]]></category>
            <category><![CDATA[coremark]]></category>
            <dc:creator><![CDATA[Zhiwei Chen]]></dc:creator>
            <pubDate>Wed, 10 Apr 2024 14:49:09 GMT</pubDate>
            <atom:updated>2024-04-10T14:49:09.431Z</atom:updated>
            <content:encoded><![CDATA[<h3>CoreMark-Pro Benchmark Variation Research</h3><h3>Introduction &amp; Background</h3><p>CoreMark-Pro is a comprehensive and advanced processor benchmark suite developed by the <strong>Embedded Microprocessor Benchmark Consortium (EEMBC)</strong>. It builds upon and extends the CoreMark benchmark to more thoroughly evaluate processor performance across a wider range of capabilities including data manipulation, control operations, floating-point computations, and parallel processing.</p><p>CoreMark-Pro is one of the workloads in the Microsoft Virtual Cline:</p><p><a href="https://microsoft.github.io/VirtualClient/docs/workloads/coremark/">CoreMark | Virtual Client Platform</a></p><p>The CoreMark-PRO benchmark contains five prevalent integer workloads and four popular floating-point workloads.</p><p>The integer workloads include JPEG compression, ZIP compression, an XML parser, the SHA-256 Secure Hash Algorithm, and a more memory-intensive version of the original CoreMark.</p><p>The floating-point workloads include a fast Fourier transform (FFT), a linear algebra routine derived from LINPACK, a greatly improved version of the Livermore loops benchmark, and a neural net algorithm to evaluate patterns.</p><p>More details can be found at:</p><p><a href="https://www.eembc.org/coremark-pro/">EEMBC</a></p><p>During our dry run, we found half of the tests had very high CV% values, and some even had CV% as high as 15%. <br>Therefore, under the default execution parameters, it is not suitable as a PnP indicator because it easily gets large differences. We need to optimize it to make it more stable.<br>After optimization, the results of each sub-test have become more stable. And the performance of MultiCore has been improved. The radix2-big-64k case has up to nearly 12 times boost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eTXms4awLRGCmSZxL323GQ.png" /></figure><h3><strong>Variation Research</strong></h3><h4><strong>Default execution command results</strong></h4><p>By checking the VC running log, I found it using the below command to execute the CoreMark-Pro.</p><pre>make TARGET=linux64 XCMD=&#39;-c160&#39; certify-all</pre><p>It uses “TARGET=linux64” to specify the target architecture is linux64, and uses “XCMD=’-c160&#39;” to specify the number of contexts under the MultiCore test is 160 (target SUT is an 8380 2 sockets system with 160 cores).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*7YSnxnomGrAEKc-jpDNS9A.png" /></figure><p>After execution, we can get the result output as shown above. It can be divided into upper and lower parts, which are the scores of each sub-test and the total score. Then there are three types of scores for each part: MultiCore, SingleCore, and Scaling. <br>Regarding how to get the overall score from the scores of each sub-test, it can be calculated by the formula in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*xtgITzZ5gs9Wx1b87oT8pQ.png" /></figure><h4><strong>The details behind the scores</strong></h4><p>To research the cause of variation, we first need to understand the details behind the scores, that is, how the test is performed, and then process the results to obtain the scores.</p><p>By researching the benchmark source code, the log output during execution, and related output files. We can learn that each sub-test is executed three times, and then take the median as the final result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pmi8yORefXGdvS7IQl0CJg.png" /><figcaption><strong>cjpeg-rose7-preset sub-test SingleCore detail score</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mhKCwJwy0bG-DVbYus2lNw.png" /><figcaption><strong>cjpeg-rose7-preset sub-test MultiCore detail score</strong></figcaption></figure><p>As shown in the figure above, cjpeg sub-test runs 10 iterations and counts the total time to calculate the iter/s score.<br>After three consecutive executions, take the median value as the final result. So the the SingleCore score is 181.82 and the MultiCore score is 2875.00.</p><h4><strong>Too short execution time issue</strong></h4><p>From the MultiCore detail score, we can find that too-short execution time and insufficient time accuracy caused a 22% difference (2875 vs. 3285) in the results of the three executions. By studying relevant official documents, I found it mentioned that each test should run for at least 10 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pvZ_JP1aT1ZX0Tw6P-OZkg.png" /></figure><p>So I changed the execution command to the following command to force each test to execute 1000 iterations.</p><pre>make TARGET=linux64 XCMD=&#39;-c160 -i1000&#39; certify-all</pre><p>However, I found the execution time increased a lot after modifying the command, but many sub-tests still have large variations.</p><p>By checking the detail score log, I found some sub-tests take a pretty long time to execute each iteration causing 1000 iterations taking about 500s.</p><p>Some sub-tests only take a short time for each iteration and MultiCopy has 160 core execute iterations simultaneously, resulting in 1000 iterations taking less than 1s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*5fxhpNOznBhiA9971OXLXg.png" /><figcaption>some sub-tests take a pretty long time to execute each iteration</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/241/1*a8udgFqF2q8UpMOUvWr_kA.png" /><figcaption>Some sub-tests only take a short time for each iteration</figcaption></figure><h4><strong>Adjust the iterations individually for each test</strong></h4><p>Since the single execution time of each test is different, I tried to use different iteration times to make the execution time of each test greater than and close to 10s.</p><p>Finally, through multiple experiments, I got the number of execution iterations required for each test in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*1HYbKp0UuiB5GpY8NQgVPw.png" /></figure><p>To let each test have its specified iteration times, I modified some files of CoreMark-Pro, which means we can use the default execution command to achieve the optimized results.</p><p>After optimization, it can be found that only one test has a CV% greater than 3%, two tests’ CV% greater than 1%, and the rest of the tests are very stable.</p><p>In addition to improved stability, many tests of MultiCore have been improved several times. This is due to the number of default execution iterations being too few and the execution time being too short, resulting in the score being lower than the true performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P4wg3OpxfOYVh72Ug3mm2w.png" /></figure><h3>CoreMark Benchmark Variation Research</h3><p>CoreMark is a simple, yet sophisticated benchmark that is designed specifically to test the functionality of a processor core. Running CoreMark produces a single-number score allowing users to make quick comparisons between processors. More details can be found at:</p><p><a href="https://github.com/eembc/coremark">GitHub - eembc/coremark: CoreMark® is an industry-standard benchmark that measures the performance of central processing units (CPU) and embedded microcrontrollers (MCU).</a></p><p>CoreMark is also a subtest within the VC test suite. During our testing, we found that the single-core performance was very stable, but when running multicore tests, the results became particularly unstable. So, I investigated the multi-copy execution flow and related code of the CoreMark and found that VC uses the following command to perform the multicore tests.</p><pre> make XCFLAGS=&quot;-DMULTITHREAD=160 -DUSE_PTHREAD&quot;  REBUILD=1 LFLAGS_END=-pthread</pre><p>It uses “-DMULTITHREAD=160” to specify the number of contexts under the multicore test is 160 (target SUT is an 8380 2 sockets system with 160 cores). And it uses “-DUSE_PTHREAD” to use the POSIX thread library.</p><p>This command uses the POSIX thread library to implement concurrency, which allows multiple threads to be created and managed within the same process. <br>In addition to this, we can also use the fork to create new processes. Each process has its own address space, and inter-process communication requires more work and consideration. This avoids thread synchronization and data race issues.</p><p>So I tried to use the following command to run the multi-core testing:</p><pre> make XCFLAGS=&quot;-DMULTITHREAD=160 -DUSE_FORK&quot;  REBUILD=1</pre><p>The specific test results are as follows. It can be found that after using the fork, the multi-core test has the same stability as the single-core test and achieves a higher score than the pthread. Therefore, for CoreMark testing on 2 sockets multi-core systems, fork should be used instead of pthread.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*njYOKNr39ZYfmFwzX3tWkg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0bf8e36b2323" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FIO Benchmark In-Depth Exploration Sharing]]></title>
            <link>https://medium.com/@wrightchen/fio-benchmark-in-depth-exploration-sharing-f7b905c3dfcb?source=rss-9994a400a2d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7b905c3dfcb</guid>
            <category><![CDATA[benchmark]]></category>
            <category><![CDATA[io]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[fios]]></category>
            <category><![CDATA[ssd]]></category>
            <dc:creator><![CDATA[Zhiwei Chen]]></dc:creator>
            <pubDate>Thu, 08 Feb 2024 08:58:15 GMT</pubDate>
            <atom:updated>2024-02-08T08:58:15.513Z</atom:updated>
            <content:encoded><![CDATA[<p>FIO (Flexible IO Tester) is an open-source, synthetic benchmarking tool capable of generating a diverse array of IO workloads, from sequential reads to random writes, and from synchronous to asynchronous operations, all tailored according to user-defined settings. As the most user-friendly and adaptable tool available, FIO facilitates swift and comprehensive IO performance assessments on storage systems, enabling the simulation of various IO load types with ease.</p><p><a href="https://github.com/axboe/fio">GitHub - axboe/fio: Flexible I/O Tester</a></p><h3><strong>Key Findings and Conclusions</strong></h3><p>The parameters of 1 Job with 8 QD are not suitable for evaluating single-core IO performance. Adjusting the IO depth parameter to 32QD can further enhance CPU utilization.</p><p>After upgrading the SSD device from PCIe 3.0 to PCIe 4.0 (Intel Optane P4800 to P5800), the parameter of 4Jobs with 32QD cannot fully squeeze out the bandwidth of PCIe 4.0. Need to increase the Jobs parameter to improve the performance of IOPS and BW. When upgrading to PCIe 5.0 SSD device (SPR/EMR/GNR), needs to evaluate whether the FIO parameters are reasonable to get the maximum IOPS and BW performance.</p><p>A total of 82 FIO tests have been defined, reaching 164 tests if considering cross-socket scenarios. These tests cover a range of read-write ratios and serve various purposes, adding latency tests in addition to BW and IOPS tests.</p><h3><strong>Background and Research Motivation</strong></h3><p>Since our current FIO test only covers the 70R30W scenario, I did some in-depth exploration of FIO (like MLC in the previous article) to see if more reasonable tests can be added to improve our coverage of the IO domain. At the same time, we can use this opportunity better to understand the testing principles and details of FIO to ensure that our testing methods and parameters are reasonable and effective.</p><p>These experiences and results can help us measure the real IO performance of the PCIe 5.0 interface with more confidence. By adding different types of FIO tests, when we encounter IO-related performance issues in the future, we’ll have more appropriate test cases to verify the IO performance as target cases. So I spent a few weeks collecting and sorting out relevant experimental data to have a deeper understanding of FIO.</p><h3><strong>Research Methods and Design</strong></h3><p>Following is the command of the 1 Job with 8QD FIO test. By understanding the meaning of each parameter, we can know the parameters in bold are key parameters.</p><pre>fio --allow_mounted_write=1 --direct=1 --buffered=0 --randrepeat=0 --filename=/dev/nvme0n1 --group_reporting --name=job --time_based --runtime=300 --ioengine=libaio --bs=4k --numjobs=1 --cpus_allowed=4 --iodepth=8 --readwrite=randrw --rwmixwrite=30</pre><blockquote>fio — allow_mounted_write=1 — direct=1 — buffered=0 — randrepeat=0 — filename=/dev/nvme0n1 — group_reporting — name=job — time_based — runtime=300 <strong>— ioengine=libaio — bs=4k — numjobs=1 — cpus_allowed=4 — iodepth=8 — readwrite=randrw — rwmixwrite=30</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hX4Vqxo5a2LjJKmhcrTezg.png" /></figure><p>To better understand the impact of these key parameters and the IO performance under different scenarios, I defined meaningful values for these parameters and tried different combinations of values to fully understand their behavior. I tested these combinations on the PCIe 3.0 and PCIe 4.0 SSDs (Intel Optane P4800 and P5800) to see how they affected different PCIe generations.</p><h3><strong>In-Depth Review of the Research Process</strong></h3><p>Before the experiment, we must first know the details of the tested hardware to know the theoretical best performance.</p><ul><li><a href="https://www.intel.com/content/www/us/en/products/sku/97161/intel-optane-ssd-dc-p4800x-series-375gb-2-5in-pcie-x4-3d-xpoint/specifications.html">Intel® Optane™ SSD DC P4800X Series (375GB, 2.5in PCIe x4, 3D XPoint™) - Product Specifications | Intel</a></li><li><a href="https://www.intel.com/content/www/us/en/products/sku/201860/intel-optane-ssd-dc-p5800x-series-800gb-2-5in-pcie-x4-3d-xpoint/specifications.html">Intel® Optane™ SSD DC P5800X Series (800GB, 2.5in PCIe x4, 3D XPoint™) - Product Specifications | Intel</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*Ls0rsIPLt7eSa_7Tu_hp6g.png" /><figcaption>Theoretical best performance</figcaption></figure><h4>ioengine<strong> Parameter Research</strong></h4><p>First, I looped through 47 different IO engines and found some engines not supported by the current HW/SW (some require a newer kernel version like io_uring).</p><p>For all executable IO engines, found that libaio has the best performance, so subsequent experiments will use libaio engine.</p><h4><strong>iodepth Parameter Research</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*euFsGNgiQBuGY6QP24-Ckg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*f70MSU0Dnq3t-XJmhTqQHQ.png" /></figure><p>When numjobs=1, the 8QD parameter can’t obtain the highest CPU utilization during randread test under P4800.</p><p>To better measure the performance of a single core, iodepth parameter should be greater than 25 to make the CPU utilization greater than 99.8%.</p><h4><strong>numjobs Parameter Research</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*e2KECay2U92h2M8dIjj66A.png" /></figure><p>When setting iodepth=32, increasing the numjobs parameter from 1 to 32, we can find numjobs=4 can’t achieve the max BW/IOPS during the randread test under P5800. Only when the numjobs parameter is greater than or equal to 6, FIO can get the maximum 4K block size BW/IOPS performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*NmPbOMiUnE--f2FSwnGvUQ.png" /><figcaption>Block Size = 4k</figcaption></figure><p>We can find the max bandwidth is equal to 6400MB/s, which is still far from the official 7200MB/s bandwidth. The IOPS is equal to 1562k, which is greater than the official performance (1500000 IOPS (4K Blocks)). If we keep numjobs=6 and continue increasing iodepth parameter to 64 or 128, the IOPS and BW won’t be impacted.</p><h4><strong>bs Parameter Research</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*0DAJhqi8UzY6FDEs_-HIQw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HZuxW_2G-x0WRhngcwe_bQ.png" /></figure><p>If we want to further improve bandwidth, we can increase the block size. And then we can obtain the 7400MB/s bandwidth, which is greater than the official performance (7200MB/s).</p><h4><strong>rwmixwrite Parameter Research</strong></h4><p>And regarding the read &amp; write mix percentage, considering the common typical applications, the following four combinations can be derived:</p><ul><li>50% read and 50% write to simulate typical computer usage</li><li>70% read and 30% write to simulate database workloads</li><li>90% read and 10% write to simulate large-scale data analysis workloads</li><li>20% read and 80% write to simulate test for log file writing</li></ul><h4><strong>Remoter Access Research</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*GBv7Aus-BQkyuiUKDB3O6g.png" /><figcaption>Block Size = 4k</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*XNtxbzG78FZNGYEaYSAVZA.png" /></figure><p>If we access the remote socket SSD device, 6 Jobs with 32 QD only can achieve 6100MB/s bandwidth, which is lower than the local access bandwidth (6400MB/s).</p><p>But if we increase the block size, FIO can obtain the max bandwidth of 7400MB/s. This shows that cross-socket access will impact some test scenarios with small block sizes, such as 4k block size.</p><h3>Define 82 FIO Single-Disk tests</h3><p>Through the above research and analysis, I defined 82 FIO single-disk tests. If considering cross-socket scenarios, there will be 164 tests. For specific details, please refer to the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bRtg1U1ws4EpcQ5uTGxX-A.png" /><figcaption>All 82 FIO single-disk tests</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aD4OI4v9D_OBOWwbkQ-stA.png" /><figcaption>1 Job for single-core Test Case</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jm7KKaJfEFTR5GkEIX2y5A.png" /><figcaption>4 Jobs for P480</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ai-Hg3MVNf7uBkXsTgEqWw.png" /><figcaption>6 Jobs for P5800</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7b905c3dfcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Measuring Cache Performance with Intel Memory Latency Checker (MLC)]]></title>
            <link>https://medium.com/@wrightchen/intel-memory-latency-checker-mlc-for-cache-testing-deep-dive-b8b2c30bacab?source=rss-9994a400a2d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8b2c30bacab</guid>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[benchmark]]></category>
            <category><![CDATA[intel]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Zhiwei Chen]]></dc:creator>
            <pubDate>Sun, 14 Jan 2024 16:04:08 GMT</pubDate>
            <atom:updated>2024-01-14T16:06:09.025Z</atom:updated>
            <content:encoded><![CDATA[<p>Intel® Memory Latency Checker (Intel® MLC) is a robust tool designed for precise measurement of memory latencies and bandwidth under varying system loads. It stands out by offering fine-grained investigation options, allowing users to analyze specific sets of cores, caches, and memory. This versatility makes Intel® MLC more than just a benchmark; it’s a sophisticated instrument for gaining nuanced insights into memory performance across diverse scenarios.</p><p><a href="https://www.intel.com/content/www/us/en/developer/articles/tool/intelr-memory-latency-checker.html">Intel® Memory Latency Checker v3.11</a></p><h3>Measuring Cache Performance with MLC</h3><p>Before we test the Cache performance, we need to know how many cores the test machine has and the cache capacity of each level. This information can be obtained through the Linux “<strong>lscpu</strong>” command. Once we know this information, we can better perform bandwidth and latency testing of each level cache.</p><pre>CPU(s):              160<br>Thread(s) per core:  2<br>Core(s) per socket:  40<br>Socket(s):           2<br>NUMA node(s):        2<br>L1d cache:           48K<br>L1i cache:           32K<br>L2 cache:            1280K<br>L3 cache:            61440K<br>NUMA node0 CPU(s):   0-39,80-119<br>NUMA node1 CPU(s):   40-79,120-159</pre><p>From the above output information, we know that the test machine has two sockets, and each socket has 40 physical cores. If we turn on the HT, which means each physical core includes two logical cores. So there are 160 logical cores in total. Each logical core needs to share the L1 &amp; L2 Cache with another logical core within the same physical core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*04t6djCHzRrcIrWCsiY6Mg.png" /></figure><h4><strong>Cache Bandwidth Testing</strong></h4><p>MLC has 3 sub-tests that can be used to measure bandwidth, namely “loaded_latency”, “max_bandwidth” and “peak_injection_bandwidth”.</p><p>The sub-tests “max_bandwidth” and “peak_injection_bandwidth” are very similar, but “max_bandwidth” will try different injection rates to arrive at the maximum possible bandwidth.</p><p>To test different levels of cache, the main difference in parameters is the buffer size used. We know the L1d is 48KB, two L1d share a 1280KB L2 cache, and each socket has 61440KB = 60MB L3 cache.</p><p>So I used 19KB for L1, 400KB for L2, and 8MB for L3. The recommendation for buffer size is it must be smaller than the size of the tested level cache and much larger than the previous cache level.</p><p>For the L1 Cache bandwidth testing, I found it can obtain a larger bandwidth when the buffer size is 19KB, I used “-b19” as the buffer option here.</p><p>For the L2 Cache bandwidth testing, the buffer size must be smaller than 1280/2 = 640KB. So I used 400KB as buffer size to avoid two L1d cache competing L2 cache resources.</p><p>For the L3 Cache bandwidth testing, since using too large a buffer will cause more TLB misses to affect the test results, I used 8MB as the buffer size.</p><p><strong>L1 Cache Bandwidth:</strong></p><pre>./mlc –loaded_latency -d0 -T -b19 -t10<br>./mlc –max_bandwidth -b19<br>./mlc –peak_injection_bandwidth -b19</pre><p><strong>L2 Cache Bandwidth:</strong></p><pre>./mlc –loaded_latency -d0 -T -b400 -t10<br>./mlc –max_bandwidth -b400<br>./mlc –peak_injection_bandwidth -b400</pre><p><strong>L3 Cache Bandwidth:</strong></p><pre>./mlc –loaded_latency -d0 -T -b8m -t10 -u<br>./mlc –max_bandwidth -b8m -u<br>./mlc –peak_injection_bandwidth -b8m -u</pre><h4><strong>Cache Latency Testing</strong></h4><p>For the cache idle latency testing, we can use the “idle_latency” sub-test with the corresponding buffer size to obtain the access latency of each cache level.</p><p>Here I test core#1 to obtain the latency of accessing each level cache. If we want to test other cores, we only need to change the “-c” and “-i” parameters.</p><p>For L1 cache latency testing, I used 20KB buffer size and initialized it by core#1 itself.</p><p>For L2 cache latency testing, I used 640KB buffer size and initialized it by another core within the same physical core.</p><p>For L2 cache latency testing, I used 640KB buffer size and initialized it by another core within the same socket.</p><p><strong>L1 Cache Latency:</strong></p><pre>./mlc - idle_latency -b20 -t10 -c1 -i1</pre><p><strong>L2 Cache Latency:</strong></p><pre>./mlc - idle_latency -b640 -t10 -c1 -i81</pre><p><strong>L3 Cache Latency:</strong></p><pre>./mlc - idle_latency -b8m -t10 -c1 -i21</pre><h4><strong>Cache Bandwidth &amp; Latency Test Results</strong></h4><p>After executing the above commands on the ICX-SP platform (CPU 8380, 2 sockets), the following test results can be obtained.</p><p>I compared the test data on the Internet and found that the data are consistent, except the L1 Cache bandwidth is lower. I will continue to research it in the future to see if the bandwidth of the L1 cache can be further improved.</p><p><strong>Cache Bandwidth Testing</strong></p><pre>L1 Cache Bandwidth: 7,430,968.4 (MB/s)<br>L2 Cache Bandwidth: 5,271,466.0 (MB/s)<br>L3 Cache Bandwidth: 2,551,124.7 (MB/s)</pre><p><strong>Cache Latency Testing</strong></p><pre>L1 Cache Latency: Each iteration took 3.4 base frequency clocks ( 1.5 ns)<br>L2 Cache Latency: Each iteration took 9.4 base frequency clocks ( 4.1 ns)<br>L3 Cache Latency: Each iteration took 51.6 base frequency clocks (22.5 ns)</pre><h4>The impact of buffer size parameter on Cache Bandwidth</h4><p>I tried the different buffer sizes and found L1 achieved the max bandwidth when the buffer size was equal to 19KB and L2 can achieve max bandwidth of around 320KB.<br>For L3 Cache, I found that when the buffer is larger than 40MB, it starts to decrease, which may be due to the increase in TLB misses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M0JOUjoGhdi9c1vkWRhCvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W5ljj2ASfj-bPkOgYmIdcw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PiE0cKuYlTFZPt5vzbAHkA.png" /></figure><h3>Cache theoretical B/W vs. MLC measured B/W</h3><p>The above Cache bandwidth test is based on the SSE instruction set. In addition, MLC also supports calling AVX2 and AVX51 instructions to test Cache bandwidth. By calculating the theoretical bandwidth of Cache, we can know the actual performance behaviors of MLC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bIFsoHJetpn4VCih2JYxJQ.png" /></figure><p>For the L1 SSE4 Store result, I found the measured B/W is almost twice the theoretical B/W, so I suspect the MLC didn’t fully access the whole 64-byte cache line under the “W5” traffic type.<br>Regarding the “-K” description, I found it mentioned full line access will be used but not sure if it refers to read or both read and write<br> “By default, past versions of MLC used partial loads for 100% reads for buffer sizes &lt; 50MB. From MLC v3.10 onwards, full line access will be used by default for all buffer sizes.”<br>Then I added “-K0” to rerun store B/W tests to force full line access, I found the store B/W drop and lower than the theoretical B/W. So I think MLC will do partial access under “W5”.</p><h4>Store results after adding the “-K0” option</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5CH87EdIYvE22l8tF_f2MA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fU90Wgp0qwYOP_dQYjZvNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*qyGBndf4ejgYW_m8fQxrFw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8b2c30bacab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stress-ng CPU Benchmark Inaccurate Timing Issue & Variation Issue Debug]]></title>
            <link>https://medium.com/@wrightchen/stress-ng-cpu-benchmark-inaccurate-timing-issue-variation-issue-debug-0b1fe28b6687?source=rss-9994a400a2d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b1fe28b6687</guid>
            <category><![CDATA[debug]]></category>
            <category><![CDATA[variation]]></category>
            <category><![CDATA[stress-ng]]></category>
            <category><![CDATA[benchmark]]></category>
            <dc:creator><![CDATA[Zhiwei Chen]]></dc:creator>
            <pubDate>Thu, 02 Nov 2023 14:41:25 GMT</pubDate>
            <atom:updated>2023-11-02T14:44:12.027Z</atom:updated>
            <content:encoded><![CDATA[<h3>Inaccurate Timing Issue Debug</h3><p>After the <a href="https://medium.com/@wrightchen/stress-ng-cpu-benchmark-research-inaccurate-timing-issue-debug-c0c6e72a09e2">previous test data analysis</a>, we learned that stress-ng has an inaccurate timing issue.</p><p>When we use the “--timeout 60” option to set the execution time to 60 seconds, there is a half chance that the real execution time is less than 60s, even less than 30s or 40s.</p><p>I reported this issue to <strong>Colin King</strong>, the author of stress-ng, and then spent a couple of days working with Colin to debug this issue.</p><p>We found this is a kernel scheduling issue. When a large number of instances need to be started in a short time, the scheduling priorities of newly started processes may block the main forking process, thereby adding a lot of delays.</p><p>Colin solved this issue by adding 1ms of yield/sleep in each instance startup phase and in logging locking to avoid the forking process being blocked. More details can be found below.</p><p><a href="https://github.com/ColinIanKing/stress-ng/commit/4db5e1f1c9d19638802639c42dc8f42906728bc8">core-helper: Add 1 ms yielding in logging and fork child startup · ColinIanKing/stress-ng@4db5e1f</a></p><p>Kudos to Colin for dedicating a significant amount of time to help resolve this issue.</p><h3>Variation Issue Debug</h3><p>After the timing issue is solved, we can do further research on stress-ng CPU stress testing to understand its stability.</p><p>I ran the following command 100 times on 3 machines and then plotted the results into the following charts.</p><pre>./stress-ng --cpu $CORES --timeout 60 --metrics --yaml output.yaml</pre><p>From the data, we know that the data of two 8380 SUTs are very stable, with the difference% and CV% both within 1%. The 8360 SUT is not very stable, the fluctuation range is about 40%. This may be an 8360 unique issue or a hardware environment issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*QJ02f6fjknURO7nXId-5FA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*VgKEwKzIMwZs_Nu7eGVJTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*76FID_c2pnr2_WBFaDJZew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*CBETB3wrzAxHf56oA7QLrw.png" /></figure><p>For the issue of 8360 SUT instability, I spent some time debugging. I found I added the “--<strong>log-lockless</strong>” option in the 8380 SUTs but not in the 8360.</p><p>If we check the “<strong>successful run completed in xxx min, xxx secs</strong>” log of 8360, we’ll find the actual execution time is not equal to 1 min, sometimes even more than 2 mins. And we can a trend that the longer the actual time, the larger the test results. If we draw a relationship between bogo-ops/s and actual time, we can get the following chart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*GW_fPdZjj7FXHeWknMOhfA.png" /></figure><p>Therefore, the latest version of stress-ng has a lock contention issue in the logging, which causes the actual execution time greater than the set value to obtain inaccurate results.</p><p>Then I rerun 100 times at the same 8360 SUT with the “--<strong>log-lockless</strong>” option. Currently, it seems that this issue can be solved perfectly by adding the “--<strong>log-lockless</strong>” option without any drawbacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*acrUWOUfI0K0WQ9--Hozxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*WaXC83D_Zdg9TqkkQgb98Q.png" /><figcaption>8360 SUT test result data (bogo-ops/s &amp; actual time) of the default execution command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*lGA-8C748e2Uhoy6TBQvKQ.png" /><figcaption>8360 SUT test result data after adding the “-<strong>-log-lockless</strong>” option</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*1eS7ZWJ0RRJCNggIC4lvLg.png" /><figcaption>Integrate</figcaption></figure><p>Then I reported this issue to Colin, and he updated the description of the “-- <strong>log-lockless</strong>” option to remind users to add this option when running N-copy CPU stressors to avoid the log message locking.</p><p><a href="https://github.com/ColinIanKing/stress-ng/commit/ce5bf596abe9d6f44437a89dff352f1c40ba0df7">Manual: add more explanation why --log-lockess is useful · ColinIanKing/stress-ng@ce5bf59</a></p><p>Colin then informed me that he had pushed two commits to remove the locking and replaced it with a buffered atomic write() call and should now be able to run stress-ng without the lock workaround.</p><p><a href="https://github.com/ColinIanKing/stress-ng/commit/e9ddb1cc6009ac830f1e2daf66cc007ad0af2ae2">core-log: change semantics of pr_lock/unlock · ColinIanKing/stress-ng@e9ddb1c</a></p><p>Then I re-executed the test 100 times on the 8360 platform and found that the results were stable, indicating that the variation problem was resolved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b1fe28b6687" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stress-ng CPU Benchmark Research & Inaccurate Timing Issue Debug]]></title>
            <link>https://medium.com/@wrightchen/stress-ng-cpu-benchmark-research-inaccurate-timing-issue-debug-c0c6e72a09e2?source=rss-9994a400a2d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0c6e72a09e2</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[benchmark]]></category>
            <category><![CDATA[stress-ng]]></category>
            <dc:creator><![CDATA[Zhiwei Chen]]></dc:creator>
            <pubDate>Thu, 02 Nov 2023 13:46:47 GMT</pubDate>
            <atom:updated>2023-11-02T13:48:27.937Z</atom:updated>
            <content:encoded><![CDATA[<h3>Stress-ng CPU Benchmark Research</h3><h3><strong>Background</strong></h3><p>Currently, we evaluating the Microsoft VirtualCline (<a href="https://github.com/microsoft/VirtualClient">https://github.com/microsoft/VirtualClient</a>) tests and trying to introduce some test cases into our PnP test list.</p><h4>Stress-ng Introduction</h4><p>The main purpose of the stress-ng tool is to stress test the various components of the system to evaluate the robustness of the system and identify potential weaknesses.</p><p>And stress-ng tool can measure stress test throughput by measuring the bogo operations per second as a micro-benchmark. The test outcomes are not precise, but they provide a rough estimate of the performance.</p><p>MS VS uses the following command to execute stress-ng to measure performance.</p><pre>./stress-ng --cpu $CORES --timeout 60 --metrics --yaml output.yaml</pre><p>This command means running $CORES (core count, 8380 2 sockets platform will be 160) instances of the CPU stressor for 60 seconds and summary performance metrics output to the “output.yaml” files.</p><p>The CPU stressor has over 75 different methods, so plenty of different ways to exercise the CPU sequentially: floating point, integer, vector math, mixed math, etc. Each CPU stressor will run on one thread. So this command will run a CPU stressor on each logical core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*g5GjpAGRP27FJ1MG6gfOAw.png" /><figcaption>stress-ng output</figcaption></figure><p>The picture above is the output result of one test, and the table below is the explanation of these indicators.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k_l2z6MzTgB1XbZE-Vtgdg.png" /></figure><p>Through analysis, we can know only <em>“</em><strong><em>bogo ops/s (usr+sys time)</em></strong><em>”</em> is suitable as a PnP indicator.</p><p>By analyzing the 100 times execution results, we can know even if we set the execution time to 60s, the actual time may be less than 60s.</p><p>The <em>“</em><strong><em>bogo ops/s (usr+sys time)</em></strong><em>”</em> will be affected by the actual execution time, we can find the <em>“</em><strong><em>bogo ops/s (usr+sys time)</em></strong><em>”</em> will decrease when execution time increases as below table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*6Zx5OZ26Pk1mDVR0m4DUkw.png" /></figure><p>Therefore, when collecting stress-ng result data, it’s necessary to ensure the actual time is the 60s to ensure the consistency of the performance behavior.</p><p>If we can ensure the test result’s actual execution time is close to 60s, then the value of <em>“</em><strong><em>bogo ops/s (usr+sys time)</em></strong><em>”</em> is stable. The CV% and Range% are small, so we can use our default CV% and difference &lt; 1% PnP criteria.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QJjsWLxc_5tU6mkYaBnaEQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0c6e72a09e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UnixBench New Criteria & Stability Further Optimized]]></title>
            <link>https://medium.com/@wrightchen/unixbench-new-criteria-stability-further-optimized-bb5accac3591?source=rss-9994a400a2d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb5accac3591</guid>
            <category><![CDATA[unixbench]]></category>
            <category><![CDATA[microbenchmark]]></category>
            <category><![CDATA[benchmark]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Zhiwei Chen]]></dc:creator>
            <pubDate>Fri, 13 Oct 2023 14:24:47 GMT</pubDate>
            <atom:updated>2023-10-13T14:24:47.877Z</atom:updated>
            <content:encoded><![CDATA[<h3>New Criteria for UnixBench Default Testing Method</h3><p>Based on the previous stability analysis, it can be concluded that changing the UnixBench default data processing method doesn’t effectively improve stability. The stability can only be improved by increasing the number of executions, but this will increase execution time.</p><p>If we keep the default number of executions and processing method, the default &lt;1% CV and Difference criteria no longer apply to all UnixBench sub-workloads.</p><p>Therefore, we need new criteria for the UnixBench if we use the UnixBench default test method. After analyzing the test data from 100 runs on both the ICX-SP and CLX-B1 platforms, I have derived the following new criteria for these two platforms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SKKnGpK42VyXpUeCqAWD5w.png" /><figcaption>New criteria for ICX-SP platform</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N1Ffre5tvDEHI4bZfkxgVw.png" /><figcaption>New criteria for CLX-B1 platform</figcaption></figure><h4><strong>New CV% Criteria Derivation</strong></h4><p>In order to obtain the new CV% criteria, I grabbed the max CV% value for each UnixBench subtest.</p><p>Additionally, to mitigate the influence of outliers, I also calculated the upper bound of the box plot for each subtest. If the max CV% value exceeds the upper bound, then the new CV% criteria will refer to the upper bound value.</p><p>For example, in the “Dhrystone 2 using register variables” single copy test of the CLX-B1 platform. Although the largest CV% reached 2.44%, if we look at the box plot, we’ll find that 2.44% is an outlier, and the 1% CV% criterion is more reasonable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*NmNMq8HmDtTkkgy3z3Q0mg.png" /><figcaption>Dhry2reg Single Copy CV% Box Plot in the CLX-B1 Platform</figcaption></figure><h4><strong>New Difference Criteria Derivation</strong></h4><p>To derive the different criteria, I collected the max performance differences (including max performance improvement percentage and max performance drop percentage).</p><p>At the same time, the average, max, and min values of all results also be calculated. Then, comparisons were made between the average, maximum, and minimum values to determine a relative range.</p><p>From the maximum and minimum values comparisons, we can understand the maximum potential difference percentage in the worst-case scenario.</p><h4><strong>New Method of Judging Difference</strong></h4><p>In the previous difference assessment, the comparison was made between the median of the previous cycle and the median of the current cycle.</p><p>However, besides this approach, we can also use a reference value for comparison. For example, we can use the average of 100 test results as the reference value, and then compare to this reference value in the subsequent cycles.</p><p>This alternative method has the following advantages and disadvantages compared to the default judgment method.</p><blockquote><strong>Compare with the previous cycle:</strong></blockquote><p><strong>Advantages: </strong>There is no need to calculate the reference value through the test, only need to compare it with the previous cycle result.</p><p><strong>Disadvantages: </strong>Two adjacent cycles may obtain the max and the min value respectively, making the difference value far greater than the judgment standard, resulting in a false alarm.</p><p>If the judgment standard is set too small, it’s easy to exceed the evaluation standard, and it’s necessary to continuously retest to meet the judgment requirements. If the judgment standard is set too large, there may be underreporting.</p><blockquote><strong>Compare with the reference value:</strong></blockquote><p><strong>Advantages: </strong>It avoids repeated testing to meet criteria requirements and underreporting situations to a certain extent. Helps identify trends and deviations from the reference value over time.</p><p><strong>Disadvantages: </strong>When the system performance changes, it’s necessary to spend time testing again to obtain a new reference value.</p><h3>Stability Further Optimized</h3><p>Through the previous analysis, we know that the effective way to improve the stability of UnixBench is to increase the number of tests to expand the sample size.</p><p>We also learned about the stability of each sub-workload through a large amount of test data. Based on this, we can increase the number of high-variation sub-workloads to improve their stability.</p><p>The study of the UnixBench source code shows that each sub-workload executed times is different when UnixBench is executed. Some sub-workloads need to be executed 10 times, with each execution taking 10 seconds, while others only require 3 executions, each taking 30 seconds or 60 seconds.</p><p>However, for the single-copy and multi-copy tests, each sub-workload has the same number of execution and execution time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xhCqHONFbEIBRAMB6-UtoA.png" /><figcaption>UnixBench default number of executions and time</figcaption></figure><p>Based on this, I first proposed a new test method 1. It increases the number of tests for unstable workloads from 10 to 20 or from 3 to 10 and keeps the test time unchanged.</p><p>However, after testing, it was found that each test time increased from 28 minutes to 51 minutes, which increased about 82% of the time. This means each cycle takes an additional 2+ hours (2 x 3 times each cycle).</p><p>So I proposed test method 2, considering single-copy and multi-copy separately, and only increasing the number of tests for unstable tests separately. In this way, each UnixBench execution time becomes 36/46 minutes, and the final effect is not much different from method 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*YzCwjVsyxy83G6475sEU8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*gXx-NdLoqxYFK5xho-HChg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*9xPAFYHZhyvXebsYpjDeCw.png" /></figure><p>After adopting the new test method, the number of single-copy and multi-copy execution times have changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uLvMSiNFiooQ5F7OGoKEnA.png" /><figcaption>Single-copy execution process</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*rcQSIyWwjr9Z2X3XEwRdkg.png" /><figcaption>Multi-copied execution process</figcaption></figure><p>Although the stability of UnixBench has been improved after using the new test method, UnixBench as a microbenchmark is still susceptible to system conditions.</p><p>So it’s unreasonable to expect all sub-workloads to show differences smaller than 1% since there are some instabilities in the execution.</p><p>I used the new test method to run 5 cycles (each cycle includes 3 times single-copy followed by 3 times multi-copy) on 4 machines to get new criteria for the new test method.</p><p>I used two 8380 ICX machines, one 8360 ICX machine, and one BDX-EX machine for testing.</p><p>By analyzing the test results (data can be found in the attachment), the following conclusions can be drawn.</p><ol><li>The stability of different machines for the same platform is different, the 8380_Machine1 is more stable than 8380_Machine2.</li><li>The stability of different platforms has huge differences, the ICX-SP platform is much more stable than the BDX-EX platform.</li><li>After increasing the number of tests for some sub-workloads, the ICX platform results have become much more stable so it’s rare to see CV% greater than 1%.</li></ol><p>Supported by the test data, after applying the new test method, the UnixBench CV% and difference of the ICX-SP platform can continue to be set at 1%.</p><p>For the case where the sub-workloads are more than 1%, it only needs a small number of reruns, so the PnP quality can be guaranteed without further expanding the criteria.</p><p>And for other platforms, platform-specific test data needs to be collected to come up with specific criteria.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb5accac3591" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UnixBench Benchmark Stability Study & Tuning]]></title>
            <link>https://medium.com/@wrightchen/unixbench-benchmark-stability-study-tuning-751efbd815d0?source=rss-9994a400a2d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/751efbd815d0</guid>
            <category><![CDATA[intel]]></category>
            <category><![CDATA[unixbench]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[performance-analysis]]></category>
            <dc:creator><![CDATA[Zhiwei Chen]]></dc:creator>
            <pubDate>Tue, 18 Jul 2023 06:34:34 GMT</pubDate>
            <atom:updated>2023-10-13T13:52:47.690Z</atom:updated>
            <content:encoded><![CDATA[<p>To study the UnixBench results variation, I analyzed 100 test results of the CLX-B1 platform and tried to improve the stability by changing the final result processing method and expanding the dataset.</p><p>Since the default data volume is not very large, there is little benefit from changing the final result processed way.</p><p>Stability can be improved by expanding the dataset, reducing the CV% from a maximum of <strong>6%</strong> to <strong>2%</strong>, but at the cost of increasing the execution time to get more data samples.</p><h4><strong>UnixBench raw result data analysis</strong></h4><p>Since UnixBench will perform 10 or 3 times for each sub-workload to obtain the final index score, 100 tests will get 1000 or 300 raw data corresponding to each sub-workload.</p><p>Extract relevant statistical indicators from the raw data of each sub-workload, the following table can be obtained. We can find that some sub-workload CV% of multiple copies is as high as 6%, and the CV% of single copy is as high as 3%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9iwqIdFLq2rGuhhxpdlDg.png" /><figcaption>Statistical indicators of 1000/300 raw data of each sub-workload on the CLX-B1 platform</figcaption></figure><p>After the raw data processing becomes the final indicator score, the multi-copy and single-copy still have CV% up to 6% and 1%, respectively. This indicates a relatively large variation in these UnixBench sub-workloads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U6JiJNeeymp03pcvMl89Lw.png" /><figcaption>Statistical indicators of 100 indicator score of each sub-workload on the CLX-B1 platform</figcaption></figure><h3><strong>UnixBench Benchmark Stability Tuning</strong></h3><p>Without changing the UnixBench source code and test environment, to improve the stability, I try to change the final result processing method and expand the dataset.<br>Before trying different processing methods, we need to understand how UnixBench defaults to get the final result.</p><h4>Original Final Result Processing Method</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*M9UM6_eOZ4eZUSMu56JWeA.png" /></figure><p>First, UnixBench will perform 10 or 3 times tests according to different sub-workload to get 10/3 raw data. For these raw data, UnixBench will remove the lowest 1/3 of the data. And then average the remaining data to obtain the final data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*_FHWlvWm83s0VnwjINBiww.png" /></figure><p>Finally, this final data need to be divided by the baseline and multiplied by 10 to get the corresponding index score. To improve stability, we can modify the execution times of each sub-workloads and the processing method of raw data.</p><h4>Try Different Processing Methods</h4><p>Since the original processing method is to discard the lowest 1/3 of data and then take the average, in addition, there are many different processing ways to get the final data.<br> Such as using different methods before taking the average, or using the median or percentile to represent the dataset. The following table are the sub-workloads CV% of multi-copy and single-copy after using different processing methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*elHpd5LQLa2vkx4Av94spg.png" /><figcaption>CV% and range obtained by different processing methods</figcaption></figure><p>Since the sub-workload with high CV% has only 3 raw data (File Copy and Process Creation). There’re no obvious differences in the different processing methods, and they have the same final results (only one raw data left after removing the max and min values).<br> To reflect different processing methods’ effects, the size of the dataset must have a certain scale. Different statistical indicators of the small dataset may get the same value. For this reason, we need to expand our dataset.</p><h4>Expand the Dataset</h4><p>The original dataset has 10 or 3 raw data according to different sub-workloads. To expand the dataset size to see the effect on stability, I changed the dataset size to 20 for each sub-workloads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l8a4QEw6j-tO8UmxG0O5Hw.png" /><figcaption>CV% and Range obtained by different processing methods after expanding the dataset to 20</figcaption></figure><p>It can be found that after expanding the dataset size, the CV% of the default processing method has been smaller. The multi-copy CV% reduced from 6% to 2% and all single-copy CV% are within 1%.<br> Correspondingly, the cost required is to increase the execution time. The sub-workloads that have 10 size dataset will take 2 times the time, and the sub-workloads of the 3 size dataset need to take 6 times the time.<br> That is, the execution time of UnixBench will increase from half an hour to more than two hours. Even so, the results of some sub-workloads are still not very stable after expanding the size of the dataset.</p><h3>Conclusion</h3><p>Without changing the source code and test environment, the UnixBench stability can be improved by expanding the size of the dataset, at the cost of increasing the test time.</p><p>If we keep the existing UnixBench execution method, it’s recommended to modify the IPU judgment method (CV% and difference need to be less than 1%) for some sub-workloads. Otherwise, there’ll be some false alarms.</p><p>We can expand the UnixBench judgment values of difference and CV%, or judge whether each sub-workload result falls within a certain interval to judge the IPU quality.</p><p>Next step I’ll execute UnixBench according to our default test method, and check its statistical indicators to derive a more appropriate judgment criteria for CV% and Difference.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=751efbd815d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UnixBench New Version Study]]></title>
            <link>https://medium.com/@wrightchen/unixbench-new-version-study-6626d6a62a50?source=rss-9994a400a2d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/6626d6a62a50</guid>
            <category><![CDATA[benchmark-study]]></category>
            <category><![CDATA[unixbench]]></category>
            <category><![CDATA[intel]]></category>
            <category><![CDATA[performance-analysis]]></category>
            <dc:creator><![CDATA[Zhiwei Chen]]></dc:creator>
            <pubDate>Mon, 17 Jul 2023 14:49:59 GMT</pubDate>
            <atom:updated>2023-10-13T13:52:24.574Z</atom:updated>
            <content:encoded><![CDATA[<p>UnixBench’s GitHub (<a href="https://github.com/kdlucas/byte-unixbench">https://github.com/kdlucas/byte-unixbench</a>) has committed many updates this year (2023).</p><p>To understand the impact of these commits on the performance results, I compared the current latest UnixBench version (a07fcc0) with the 2022 version (e477bc0) to study the difference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fvJ8ceNCtd_wZhdjaczDag.png" /><figcaption>Comparison of the results of the new version and the old version on the ICX-SP platform (2 sockets, 160 cores)</figcaption></figure><p>Through comparison, we can know that the new version has improved performance on some sub-tests, and then I’ll analyze the source code to understand the root cause of these improvements. But there are still many issues (results unstable, not representative) in UnixBench, I’ll continue to follow up and optimize it in the future.</p><h4>File Copy Workloads Changes Study</h4><p><a href="https://github.com/kdlucas/byte-unixbench/commit/81e9de58c50566da8ae45c0ea7a55e7a7066ea75">fstime.c - Seperate r/w files for each parallel (#85) · kdlucas/byte-unixbench@81e9de5</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*miyrS5767Y7HiNMCiApBJQ.png" /><figcaption>Code Changed</figcaption></figure><pre>    int pid = getpid();<br>    snprintf(FNAME0 + sizeof(&quot;dummy0&quot;), sizeof(FNAME0) - sizeof(&quot;dummy0&quot;), &quot;%d&quot;, pid);<br>    snprintf(FNAME1 + sizeof(&quot;dummy1&quot;), sizeof(FNAME1) - sizeof(&quot;dummy1&quot;), &quot;%d&quot;, pid);</pre><p>In the 2022 old version, multi-copy shares the same read file and write files (named <strong>dummy0 </strong>&amp; <strong>dummy1</strong>) when doing the copy test. It’ll cause file lock to make the multi-copy results lower than the single-copy results. <br> In the latest version, each copy has its unique read file and write file name <strong><em>dummy0-XXXXXXXXXX</em></strong> and <strong><em>dummy1-XXXXXXXXXX</em></strong> (XXXXXXXXXX will be replaced with each process ID).<br> This avoids the file lock appearance and makes the multi-copy results higher than single-copy, right now the results of multiple copies will be more reasonable.</p><h4>System Call Overhead Workload Changes Study</h4><p><a href="https://github.com/kdlucas/byte-unixbench/commit/fb4521ca2d307e7e70e515990069f7a5f54106c7">Allocate unique fd for each parallel to avoid unexpected syscall test... · kdlucas/byte-unixbench@fb4521c</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*lA-Mgj6Fp1RBFCL6PBD9ow.png" /><figcaption>Code Changed</figcaption></figure><p>In the old version, each parallel closes the same <strong>standard input (stdin)</strong> and will make the f_count have lock contention in the multi-copy test. Most of the time is wasted waiting for the data sharing, so the multiple copies score cannot truly reflect the performance. <br>New version each parallel has its unique fd to avoid lock contention, we can find the system call multi-copy result boot a lot after updating to the latest version.</p><h4>Shell Scripts Workload Changes Study</h4><p><a href="https://github.com/kdlucas/byte-unixbench/commit/6705203ac0ae1edcdafcaafc5962608f00043275">Use builtin arithmetic expansion feature to replace external expr com... · kdlucas/byte-unixbench@6705203</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*OY1BQtiqq61RrTogTZkgpw.png" /><figcaption>Code Changed</figcaption></figure><p>The old and new versions use two different ways to increment the value of the variable instance by 1.<br> The old version uses the <strong>expr command</strong> to evaluate and print the value, but the new version uses the <strong>built-in feature</strong>. That’ll quicker than call the external exper command to reduce each loop execution time.<br> Since the shell scripts test the main loop has very little code, this improvement increases the single-copy performance a lot and also improves the results of multiple copies.</p><h3>UnixBench Existing Issues</h3><p>Even after updating to the latest version, the results of UnixBench are still not very stable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Fm-sXbRgtRsZFx6emNQRQ.png" /><figcaption>CV% of the 5 execution results of the new version on the ICX-SP platform (2 sockets, 160 cores)</figcaption></figure><p>By analyzing the code of UnixBench, we know that the test logic of UnixBench is to execute each subtest 10 or 3 times. Then remove one-third of the worst scores for each sub-workload, and then average the remaining scores to obtain the final scores of each test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*M9UM6_eOZ4eZUSMu56JWeA.png" /><figcaption>Number of executions for each subtest under Multiple Copies</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*3rv6yCgjB35GiFNq4aG87g.png" /><figcaption>The number of samples to average after removing one-third of the worst scores</figcaption></figure><p>Since these tests only execute simple loops and are easily affected by the state of the system, multiple tests will get different results in a certain range.<br>In the next step, I’ll try to change the execution times, the interval between tests, and the selection logic of the final score to make the UnixBench result relatively stable. But in the end, it’s necessary to optimize the source code further to make it more stable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6626d6a62a50" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>