(1) bashで100万回ループ
[root@hoge ~]# cat /etc/centos-release CentOS Linux release 7.1.1503 (Core) [root@hoge ~]# dmidecode -s processor-version Intel(R) Core(TM) i7-2960XM CPU @ 2.70GHz [root@hoge ~]# echo $LANG ja_JP.UTF-8 [root@hoge ~]# time for ((i=0;++i<1000000;)) > do > : > done real 0m4.035s user 0m3.857s sys 0m0.184s何もインストールする必要がなく、簡単に測定できますが、一つ注意点があります。
なんと!ロケールが影響します。なので、条件を揃えるため、常に LANG=C に設定してから計測したほうが良いかと思います。
次が、同じマシンで LANG=C にした場合の結果です。
[root@hoge ~]# LANG=C [root@hoge ~]# echo $LANG C [root@hoge ~]# time for ((i=0;++i<1000000;)) > do > : > done real 0m3.212s user 0m3.045s sys 0m0.171sってことは、場合によっては、スクリプトの冒頭で。。。ですね。せこい最適化の前にやることはあるでしょうけど。
(2) sysbench
[root@hoge ~]# sysbench --test=cpu run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1
Doing CPU performance benchmark
Threads started!
Done.
Maximum prime number checked in CPU test: 10000
Test execution summary:
total time: 9.1036s
total number of events: 10000
total time taken by event execution: 9.1029
per-request statistics:
min: 0.88ms
avg: 0.91ms
max: 1.07ms
approx. 95 percentile: 0.93ms
Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 9.1029/0.00
このベンチは、EPEL に収録されているので、RHEL/CentOS なら、簡単にインストールできます。操作も簡単です。テストの種類はいろいろと用意されていますが、--test=cpu と --test=memory をよく使います。簡単なので。
(3) 姫野ベンチ
[root@hoge ~]# ./bmt mimax = 129 mjmax = 129 mkmax = 257 imax = 128 jmax = 128 kmax =256 Start rehearsal measurement process. Measure the performance in 3 times. MFLOPS: 1898.971870 time(s): 0.216599 1.733593e-03 Now, start the actual measurement process. The loop will be excuted in 831 times This will take about one minute. Wait for a while Loop executed for 831 times Gosa : 8.213920e-04 MFLOPS measured : 1959.001846 cpu : 58.159398 Score based on Pentium III 600MHz : 23.890266理研が公開しているベンチマークです。こちらはコンパイルが必要ですが、make 一発なので、容易だと思います。
上の結果は、C, static allocate version M のものです。
C, dynamic allocate version というのも用意されています。下が実行例です。
[root@hoge ~]# ./hime
For example:
Grid-size= XS (32x32x64)
S (64x64x128)
M (128x128x256)
L (256x256x512)
XL (512x512x1024)
Grid-size = M
mimax = 128 mjmax = 128 mkmax = 256
imax = 127 jmax = 127 kmax =255
Start rehearsal measurement process.
Measure the performance in 3 times.
MFLOPS: 322.654502 time(s): 1.249692 1.733593e-03
Now, start the actual measurement process.
The loop will be excuted in 144 times
This will take about one minute.
Wait for a while
Loop executed for 144 times
Gosa : 1.308934e-03
MFLOPS measured : 331.831996 cpu : 58.326202
Score based on Pentium III 600MHz using Fortran 77: 4.046732
(4) memtest86+
これは、ベンチマークが主目的ではないですが、メモリ性能の確認にも使います。
2016-01-17追記
手持ちマシン等のデータを集めてみようと思います。随時追加していくつもり。
| CPU | (1) 100万回 ループ |
(2) sysbench CPU |
(3) 姫野ベンチ bmt |
備考 |
|---|---|---|---|---|
| x | y | z | u | v |
| Pentium 4 3.06GHz | 10.2 | 31.1 | 415 | 2002年発表 CentOS6(i686)で計測 |
| Core 2 Duo L7100 1.20GHz | 9.5 (107%) | 34.0 (91%) | 519 (125%) | 2007年発表 CentOS7(x86_64)で計測 |
| Pentium D 950 3.40GHz | 8.9 (115%) | 20.6 (151%) | 890 (214%) | 2006年Q1 |
| Core 2 X6800 2.93GHz | 4.3 (237%) | 16.0 (194%) | 1025 (247%) | 2006年Q3 |
| Core 2 QX6800 2.93GHz | 4.3 (237%) | 16.0 (194%) | 1037 (250%) | 2007年Q2 |
| Core i7 620M 2.67GHz | 3.7 (276%) | 8.7 (359%) | 1368 (330%) | 2010年Q1 |
| Core i7 2960XM 2.70GHz | 3.2 (319%) | 9.1 (342%) | 2516 (606%) | 2011年Q4 |
| Core i5 4670 3.40GHz | 2.6 (392%) | 8.1 (384%) | 2945 (710%) | 2013年Q2 |
| Core i7 7500U 2.70GHz | 3.4 (300%) | 8.3 (374%) | 4090 (985%) | 2016年Q3 2019.11追記 |
| Core i7 8565U 1.80GHz | 1.6 (637%) | 6.9 (450%) | 7110 (1713%) | 2018年Q3 2019.12追記 CentOS8(x86_64)で計測 |
また、マルチコアは考慮されていません。
sysbench であれば、コマンドラインオプションとして --num-threads=コア数 を付与すれば、マルチコアを使ったベンチができます。そのうち計測してみたいと思ってます。
2016-02-03追記
sysbench --num-threads=T --test=cpu run を計測した値。
| CPU | コア数 | スレッド数 | sysbench CPU |
備考 |
|---|---|---|---|---|
| x | c | T | S | v |
| Pentium 4 3.06GHz | 1 | 2 | 25.3 | 2002年発表 |
| Core 2 Duo L7100 1.20GHz | 2 | 2 | 20.0 (126%) | 2007年 |
| Pentium D 950 3.40GHz | 2 | 2 | 10.6 (239%) | 2006年Q1 |
| Core 2 X6800 2.93GHz | 2 | 2 | 8.1 (312%) | 2006年Q3 |
| Core 2 QX6800 2.93GHz | 4 | 4 | 4.1 (617%) | 2007年Q2 |
| Core i7 620M 2.67GHz | 2 | 4 | 3.5 (723%) | 2010年Q1 |
| Xeon E3-1270 3.40GHz | 4 | 8 | 1.4 (1807%) | 2011年Q2 |
| Core i7 2960XM 2.70GHz | 4 | 8 | 1.5 (1687%) | 2011年Q4 |
| Core i5 4670 3.40GHz | 4 | 4 | 2.2 (1150%) | 2013年Q2 |
| Core i7 7500U 2.70GHz | 2 | 4 | 2.33 (1086%) | 2016年Q3 2019.11追記 |
| Core i7 8565U 1.80GHz | 4 | 8 | 1.33 (1902%) | 2018年Q3 2019.12追記 |
■関連記事
Linux 上でメモリ帯域幅をベンチマーク

0 件のコメント:
コメントを投稿