Graviton2はRaspberry Pi 4何個分でしょう？

同じARMというだけですが、Graviton2搭載のEC2とRaspberry Pi 4でunixbenchしてみました。
https://github.com/kdlucas/byte-unixbench

| スペック | Graviton2 EC2| Raspberry Pi 4 |
| --- | --- | --- |
| インスタンスタイプ | c6g.xlarge(コンピューティング最適化) | - |
| CPU | Gravition2 | Broadcom BCM2711 | 
| CPU(クロック) | 2.5 GHz | 1.5GHz |
| CPU(コア) | 4 | 4 |
| メモリ | 8GB | 8GB |
| ディスク | 汎用SSD 8GiB | microSD 32GiB |
| OS | Amazon Linux 2 | Raspberry Pi OS(64bit) |

コア数とメモリ容量を合わせるためc6g.xlargeインスタンスを選択しました。
クロック数が結構違いますね。

## 結果
 
| テスト | Graviton2 EC2 | Raspberry Pi 4 |
| --- | ---: | ---: |
| running 1 parallel copy of tests | 1711.0 | 348.9 |
| running 4 parallel copies of tests | 4204.2| 954.8 | 

<details><summary>結果（Graviton2 EC2）</summary><div>

```
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: ip-172-31-24-63.ap-northeast-1.compute.internal: GNU/Linux
   OS: GNU/Linux -- 4.14.186-146.268.amzn2.aarch64 -- #1 SMP Tue Jul 14 18:17:02 UTC 2020
   Machine: aarch64 (aarch64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   13:58:30 up 7 min,  1 user,  load average: 0.42, 0.13, 0.04; runlevel 2020-08-26

------------------------------------------------------------------------
Benchmark Run: Wed Aug 26 2020 13:58:30 - 14:26:28
4 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       41225693.4 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     5930.3 MWIPS (9.6 s, 7 samples)
Execl Throughput                               6945.2 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1024476.6 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          285037.5 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2920798.7 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1785412.0 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 137584.6 lps   (10.0 s, 7 samples)
Process Creation                              10991.4 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   9165.4 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   2545.4 lpm   (60.0 s, 2 samples)
System Call Overhead                        1731853.4 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   41225693.4   3532.6
Double-Precision Whetstone                       55.0       5930.3   1078.2
Execl Throughput                                 43.0       6945.2   1615.2
File Copy 1024 bufsize 2000 maxblocks          3960.0    1024476.6   2587.1
File Copy 256 bufsize 500 maxblocks            1655.0     285037.5   1722.3
File Copy 4096 bufsize 8000 maxblocks          5800.0    2920798.7   5035.9
Pipe Throughput                               12440.0    1785412.0   1435.2
Pipe-based Context Switching                   4000.0     137584.6    344.0
Process Creation                                126.0      10991.4    872.3
Shell Scripts (1 concurrent)                     42.4       9165.4   2161.6
Shell Scripts (8 concurrent)                      6.0       2545.4   4242.3
System Call Overhead                          15000.0    1731853.4   1154.6
                                                                   ========
System Benchmarks Index Score                                        1711.0

------------------------------------------------------------------------
Benchmark Run: Wed Aug 26 2020 14:26:28 - 14:54:24
4 CPUs in system; running 4 parallel copies of tests

Dhrystone 2 using register variables      164931718.6 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                    23713.5 MWIPS (9.6 s, 7 samples)
Execl Throughput                              19361.7 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1063484.1 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          299432.0 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2984459.9 KBps  (30.0 s, 2 samples)
Pipe Throughput                             7148051.0 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                1322151.5 lps   (10.0 s, 7 samples)
Process Creation                              35507.0 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                  21132.9 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   3038.7 lpm   (60.0 s, 2 samples)
System Call Overhead                        4935484.7 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0  164931718.6  14133.0
Double-Precision Whetstone                       55.0      23713.5   4311.5
Execl Throughput                                 43.0      19361.7   4502.7
File Copy 1024 bufsize 2000 maxblocks          3960.0    1063484.1   2685.6
File Copy 256 bufsize 500 maxblocks            1655.0     299432.0   1809.3
File Copy 4096 bufsize 8000 maxblocks          5800.0    2984459.9   5145.6
Pipe Throughput                               12440.0    7148051.0   5746.0
Pipe-based Context Switching                   4000.0    1322151.5   3305.4
Process Creation                                126.0      35507.0   2818.0
Shell Scripts (1 concurrent)                     42.4      21132.9   4984.2
Shell Scripts (8 concurrent)                      6.0       3038.7   5064.5
System Call Overhead                          15000.0    4935484.7   3290.3
                                                                   ========
System Benchmarks Index Score                                        4204.2
```

</div></details>


<details><summary>結果（Raspberry Pi 4）</summary><div>

```
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: raspberrypi: GNU/Linux
   OS: GNU/Linux -- 5.4.51-v8+ -- #1333 SMP PREEMPT Mon Aug 10 16:58:35 BST 2020
   Machine: aarch64 (unknown)
   Language: en_US.utf8 (charmap="ANSI_X3.4-1968", collate="ANSI_X3.4-1968")
   14:43:43 up 4 days, 11:40,  4 users,  load average: 0.25, 0.43, 0.34; runlevel Aug

------------------------------------------------------------------------
Benchmark Run: Wed Aug 26 2020 14:43:43 - 15:11:31
4 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       15215662.4 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     2548.0 MWIPS (9.2 s, 7 samples)
Execl Throughput                               1611.0 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks         99063.1 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           29139.6 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        291775.2 KBps  (30.0 s, 2 samples)
Pipe Throughput                              270717.1 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  47508.6 lps   (10.0 s, 7 samples)
Process Creation                               2797.1 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   2815.6 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    657.8 lpm   (60.1 s, 2 samples)
System Call Overhead                         233131.0 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   15215662.4   1303.8
Double-Precision Whetstone                       55.0       2548.0    463.3
Execl Throughput                                 43.0       1611.0    374.6
File Copy 1024 bufsize 2000 maxblocks          3960.0      99063.1    250.2
File Copy 256 bufsize 500 maxblocks            1655.0      29139.6    176.1
File Copy 4096 bufsize 8000 maxblocks          5800.0     291775.2    503.1
Pipe Throughput                               12440.0     270717.1    217.6
Pipe-based Context Switching                   4000.0      47508.6    118.8
Process Creation                                126.0       2797.1    222.0
Shell Scripts (1 concurrent)                     42.4       2815.6    664.1
Shell Scripts (8 concurrent)                      6.0        657.8   1096.4
System Call Overhead                          15000.0     233131.0    155.4
                                                                   ========
System Benchmarks Index Score                                         348.9

------------------------------------------------------------------------
Benchmark Run: Wed Aug 26 2020 15:11:31 - 15:39:21
4 CPUs in system; running 4 parallel copies of tests

Dhrystone 2 using register variables       60352336.5 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                    10173.2 MWIPS (9.2 s, 7 samples)
Execl Throughput                               4667.7 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        241446.5 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           69320.4 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        626527.5 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1073258.4 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 175098.6 lps   (10.0 s, 7 samples)
Process Creation                               6117.2 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   5161.1 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    892.0 lpm   (60.2 s, 2 samples)
System Call Overhead                         906068.3 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   60352336.5   5171.6
Double-Precision Whetstone                       55.0      10173.2   1849.7
Execl Throughput                                 43.0       4667.7   1085.5
File Copy 1024 bufsize 2000 maxblocks          3960.0     241446.5    609.7
File Copy 256 bufsize 500 maxblocks            1655.0      69320.4    418.9
File Copy 4096 bufsize 8000 maxblocks          5800.0     626527.5   1080.2
Pipe Throughput                               12440.0    1073258.4    862.7
Pipe-based Context Switching                   4000.0     175098.6    437.7
Process Creation                                126.0       6117.2    485.5
Shell Scripts (1 concurrent)                     42.4       5161.1   1217.2
Shell Scripts (8 concurrent)                      6.0        892.0   1486.7
System Call Overhead                          15000.0     906068.3    604.0
                                                                   ========
System Benchmarks Index Score                                         954.8
```

</div></details>

ということで、正解は**4.4~4.9個分**でした。
CPUクロック以上に性能差がありそうですね。

## Raspberry Pi 4のCPU温度

ベンチマーク中のRaspberry Pi 4のCPU温度は77℃ぐらいまで上がりました。
（ヒートシンク付き、オフィシャルケースの蓋を開けた状態）

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/41574/f7d32e17-ec67-7208-1241-b28d98526b41.png)


## 参考

https://aws.amazon.com/jp/ec2/instance-types/
https://www.raspberrypi.org/products/raspberry-pi-4-model-b/specifications/