Estimate FLOPS in Linux?

Solution 1:

apparently there's a "sysbench" benchmark package and command:

sudo apt-get install sysbench (or brew install sysbench OS X)

run it like this:

sysbench --test=cpu --cpu-max-prime=20000 --num-threads=2 run

output for comparisons:

 total time:                          15.3047s

ref: http://www.midwesternmac.com/blogs/jeff-geerling/2013-vps-benchmarks-linode

Solution 2:

The question is what do you mean by flops? If all you care about is how many of the simplest floating point operations per clock, it is probably 3x your clock speed, but that is about as meaningless as bogomips. Some floating point ops take a long time (divide, for starters), add and multiply are typically quick (one per fp unit per clock). The next issue is memory performance, there is a reason the last classic CRAY had 31 memory banks, ultimately CPU performance is limited by how fast you can read and write to memory, so what level of caching does your problem fit in? Linpack was a real benchmark once, now it fits in cache (L2 if not L1) and is more of a pure theoretical CPU benchmark. And of course, your SSE (etc) units can add floating point performance too.

What distro do you run?

This looked like a good pointer: http://linuxtoolkit.blogspot.com/2009/04/intel-optimized-linpack-benchmark-for.html

http://onemansjourneyintolinux.blogspot.com/2008/12/show-us-yer-flops.html

http://www.phoronix-test-suite.com/ might be an easier way to install a flops benchmark.

Still I do wonder why you care, what you are using it for? If you just want a meaningless number, your systems bogomips is still right there in dmesg.


Solution 3:

For ballpark-estimates:

  • Raspberry Pi 2: 299.93 * 10^6 FLOPS (source)

  • Raspberry Pi 3: 462.07 * 10^6 FLOPS (source)

  • GTX Titan Black GPU: 5.1 * 10^12 FLOPS (source)
  • Sunway TaihuLight: 93 * 10^15 FLOPS (source, record holder of 2016)

Linpack

  1. Download it (link)
  2. Extract it
  3. cd benchmarks_2017/linux/mkl/benchmarks/linpack
  4. ./runme_xeon64
  5. Wait for quite a while (more than 1 hour)

On a Thinkpad T460p (Intel i7-6700HQ CPU), it gives:

This is a SAMPLE run script for SMP LINPACK. Change it to reflect
the correct number of CPUs/threads, problem input files, etc..
./runme_xeon64: 33: [: -gt: unexpected operator
Mi 21. Dez 11:50:29 CET 2016
Intel(R) Optimized LINPACK Benchmark data

Current date/time: Wed Dec 21 11:50:29 2016

CPU frequency:    3.491 GHz
Number of CPUs: 1
Number of cores: 4
Number of threads: 4

Parameters are set to:

Number of tests: 15
Number of equations to solve (problem size) : 1000  2000  5000  10000 15000 18000 20000 22000 25000 26000 27000 30000 35000 40000 45000
Leading dimension of array                  : 1000  2000  5008  10000 15000 18008 20016 22008 25000 26000 27000 30000 35000 40000 45000
Number of trials to run                     : 4     2     2     2     2     2     2     2     2     2     1     1     1     1     1    
Data alignment value (in Kbytes)            : 4     4     4     4     4     4     4     4     4     4     4     1     1     1     1    

Maximum memory requested that can be used=9800701024, at the size=35000

=================== Timing linear equation system solver ===================

Size   LDA    Align. Time(s)    GFlops   Residual     Residual(norm) Check
1000   1000   4      0.014      46.5838  1.165068e-12 3.973181e-02   pass
1000   1000   4      0.010      64.7319  1.165068e-12 3.973181e-02   pass
1000   1000   4      0.009      77.3583  1.165068e-12 3.973181e-02   pass
1000   1000   4      0.010      67.0096  1.165068e-12 3.973181e-02   pass
2000   2000   4      0.064      83.6177  5.001027e-12 4.350281e-02   pass
2000   2000   4      0.063      84.5568  5.001027e-12 4.350281e-02   pass
5000   5008   4      0.709      117.6800 2.474679e-11 3.450740e-02   pass
5000   5008   4      0.699      119.2350 2.474679e-11 3.450740e-02   pass
10000  10000  4      4.895      136.2439 9.069137e-11 3.197870e-02   pass
10000  10000  4      4.904      135.9888 9.069137e-11 3.197870e-02   pass
15000  15000  4      17.260     130.3870 2.052533e-10 3.232773e-02   pass
15000  15000  4      18.159     123.9303 2.052533e-10 3.232773e-02   pass
18000  18008  4      31.091     125.0738 2.611497e-10 2.859910e-02   pass
18000  18008  4      31.869     122.0215 2.611497e-10 2.859910e-02   pass
20000  20016  4      44.877     118.8622 3.442628e-10 3.047480e-02   pass
20000  20016  4      44.646     119.4762 3.442628e-10 3.047480e-02   pass
22000  22008  4      57.918     122.5811 4.714135e-10 3.452918e-02   pass
22000  22008  4      57.171     124.1816 4.714135e-10 3.452918e-02   pass
25000  25000  4      86.259     120.7747 5.797896e-10 3.297056e-02   pass
25000  25000  4      83.721     124.4356 5.797896e-10 3.297056e-02   pass
26000  26000  4      97.420     120.2906 5.615238e-10 2.952660e-02   pass
26000  26000  4      96.061     121.9924 5.615238e-10 2.952660e-02   pass
27000  27000  4      109.479    119.8722 5.956148e-10 2.904520e-02   pass
30000  30000  1      315.697    57.0225  8.015488e-10 3.159714e-02   pass
35000  35000  1      2421.281   11.8061  1.161127e-09 3.370575e-02   pass

Performance Summary (GFlops)

Size   LDA    Align.  Average  Maximal
1000   1000   4       63.9209  77.3583 
2000   2000   4       84.0872  84.5568 
5000   5008   4       118.4575 119.2350
10000  10000  4       136.1164 136.2439
15000  15000  4       127.1586 130.3870
18000  18008  4       123.5477 125.0738
20000  20016  4       119.1692 119.4762
22000  22008  4       123.3813 124.1816
25000  25000  4       122.6052 124.4356
26000  26000  4       121.1415 121.9924
27000  27000  4       119.8722 119.8722
30000  30000  1       57.0225  57.0225 
35000  35000  1       11.8061  11.8061 

Residual checks PASSED

End of tests

Done: Mi 21. Dez 12:58:23 CET 2016