title: Why is "user" time different for same executable on two different AMD machines?
body: <p>Have tried execute the below source code on two different AMD machines which has same configurations.</p>
  <p>The &quot;user&quot; times are different for both the machines</p>
  <p>Same Source code is compiled with gcc 9 on both machines.
  They have the same objdump on both the machines.</p>
  <p>Here is the <strong>source code</strong> :</p>
  <pre><code>#include &lt;time.h&gt;
  int main()
  {
      double time_spent = 0.0;
      clock_t begin = clock();
      int a = 0;
      for(int j = 0; j &lt; 1000; j++)
      {
          for(int i = 0; i &lt; 20000000; i++)
          {
              if(i%1000000 == 0)
                  a = i;
          }
      }
      clock_t end = clock();
      time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
  
          printf(&quot;The elapsed time is %f seconds\n&quot;, time_spent);
      return 0;
  }
  </code></pre>
  <p>Output on <strong>Machine 1:</strong> (Details on Machine type mentioned below)
  The elapsed time is 21.140000 seconds
  real    <strong>21.14</strong>
  user    21.14
  sys    0.00
  mem:    520</p>
  <p>Output on <strong>Machine 2:</strong> (Details on Machine type mentioned below)
  The elapsed time is 24.580000 seconds
  real    <strong>24.59</strong>
  user    24.58
  sys    0.00
  mem:    524</p>
  <p><strong>Machine 1 Details:</strong>
  Architecture:          x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
  CPU(s):                128
  On-line CPU(s) list:   0-127
  Thread(s) per core:    2
  Core(s) per socket:    32
  Socket(s):             2
  NUMA node(s):          2
  Vendor ID:             AuthenticAMD
  CPU family:            23
  Model:                 49
  Model name:            AMD EPYC 7542 32-Core Processor
  Stepping:              0
  CPU MHz:               2894.795
  BogoMIPS:              5789.59
  Virtualization:        AMD-V
  L1d cache:             32K
  L1i cache:             32K
  L2 cache:              512K
  L3 cache:              16384K
  NUMA node0 CPU(s):     0-31,64-95
  NUMA node1 CPU(s):     32-63,96-127</p>
  <p><strong>Machine 2 Details:</strong>
  Architecture:          x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
  CPU(s):                128
  On-line CPU(s) list:   0-127
  Thread(s) per core:    2
  Core(s) per socket:    32
  Socket(s):             2
  NUMA node(s):          2
  Vendor ID:             AuthenticAMD
  CPU family:            23
  Model:                 49
  Model name:            AMD EPYC 7542 32-Core Processor
  Stepping:              0
  CPU MHz:               2894.705
  BogoMIPS:              5789.41
  Virtualization:        AMD-V
  L1d cache:             32K
  L1i cache:             32K
  L2 cache:              512K
  L3 cache:              16384K
  NUMA node0 CPU(s):     0-31,64-95
  NUMA node1 CPU(s):     32-63,96-127</p>
  <p>Already tried below options:
  (1)used &quot;tasket&quot; to pin the application to a particular CPU
  (2)used &quot;nice&quot; &amp; &quot;renice&quot; to change the priority of process
  (3)tried executing same source code from /tmp directory to ensure there was no network lag issues.
  (4)there is no load on the machines.
  (5)Have also tried using -o2, -o3 optimizations.
  (6)tried executing with sudo, still i notice consistent time difference in the execution on source code on two different machines which have same configurations.</p>
  <p>Could someone let me know as to why same source code being executed on two different AMD machines having same configurations is providing different &quot;user&quot; time</p>