第13章計算の性能
13.4.6. Networks and Buses13.4.6 ネットワークとバス
Whenever a single device is insufficient for optimization we need to transfer data to and from it to synchronize processing. This is where networks and buses come in handy. We have a number of design parameters: bandwidth, cost, distance, and flexibility. On one end we have WiFi that has a pretty good range, is very easy to use (no wires, after all), cheap but it offers comparatively mediocre bandwidth and latency. No machine learning researcher within their right mind would use it to build a cluster of servers. In what follows we focus on interconnects that are suitable for deep learning.
英語のヒント
一つの装置では最適化に不十分なときはいつでも、処理を同期させるためにデータをそれとのあいだで転送する必要がある。ここでネットワークとバスが役に立つ。設計のパラメータはいくつかある。帯域、コスト、距離、柔軟性である。一方の端にはWiFiがあり、かなりよい到達範囲をもち、とても使いやすく(結局のところ線がない)、安いが、帯域と遅延は比較的凡庸である。まともな機械学習の研究者なら、誰もそれを使ってサーバーのクラスタを作りはしない。以下では、深層学習に適した相互接続に焦点を当てる。
- PCIe is a dedicated bus for very high bandwidth point-to-point connections (up to 32 GB/s on PCIe 4.0 in a 16-lane slot) per lane. Latency is in the order of single-digit microseconds (5 μs). PCIe links are precious. Processors only have a limited number of them: AMD’s EPYC 3 has 128 lanes, Intel’s Xeon has up to 48 lanes per chip; on desktop-grade CPUs the numbers are 20 (Ryzen 9) and 16 (Core i9) respectively. Since GPUs have typically 16 lanes, this limits the number of GPUs that can connect to the CPU at full bandwidth. After all, they need to share the links with other high bandwidth peripherals such as storage and Ethernet. Just like with RAM access, large bulk transfers are preferable due to reduced packet overhead.
英語のヒント
PCIeは、レーンあたりとても高い帯域の1対1接続のための専用のバスである(16レーンのスロットのPCIe 4.0で最大32 GB/s)。遅延は1桁のマイクロ秒(5 μs)程度である。PCIeのリンクは貴重である。プロセッサには限られた数しかない。AMDのEPYC 3には128レーンあり、IntelのXeonにはチップあたり最大48レーンある。デスクトップ用のCPUでは、その数はそれぞれ20(Ryzen 9)と16(Core i9)である。GPUにはふつう16レーンあるので、これにより、全帯域でCPUにつなげるGPUの数が制限される。結局のところ、それらはストレージやイーサネットのようなほかの高帯域の周辺機器とリンクを共有する必要がある。RAMのアクセスと同じように、パケットのオーバーヘッドが減るので、大きなまとまった転送が望ましい。 - Ethernet is the most commonly used way of connecting computers. While it is significantly slower than PCIe, it is very cheap and resilient to install and covers much longer distances. Typical bandwidth for low-grade servers is 1 GBit/s. Higher-end devices (e.g., C5 instances in the cloud) offer between 10 and 100 GBit/s bandwidth. As in all previous cases data transmission has significant overheads. Note that we almost never use raw Ethernet directly but rather a protocol that is executed on top of the physical interconnect (such as UDP or TCP/IP). This adds further overhead. Like PCIe, Ethernet is designed to connect two devices, e.g., a computer and a switch.
英語のヒント
イーサネットは、コンピュータをつなぐ最もよく使われる方法である。PCIeよりかなり遅いが、とても安く、設置しても壊れにくく、ずっと長い距離をカバーする。低級なサーバーの典型的な帯域は1 GBit/sである。もっと高性能な装置(たとえばクラウドのC5インスタンス)は、10〜100 GBit/sの帯域を与える。これまでのすべての場合と同じように、データの伝送にはかなりのオーバーヘッドがある。生のイーサネットを直接使うことはほとんどなく、代わりに物理的な相互接続の上で実行されるプロトコル(UDPやTCP/IPなど)を使うことに注意してほしい。これはさらにオーバーヘッドを加える。PCIeと同じように、イーサネットは、たとえばコンピュータとスイッチのように、二つの装置をつなぐよう設計されている。 - Switches allow us to connect multiple devices in a manner where any pair of them can carry out a (typically full bandwidth) point-to-point connection simultaneously. For instance, Ethernet switches might connect 40 servers at high cross-sectional bandwidth. Note that switches are not unique to traditional computer networks. Even PCIe lanes can be switched. This occurs, e.g., to connect a large number of GPUs to a host processor, as is the case for the P2 instances.
英語のヒント
- NVLink is an alternative to PCIe when it comes to very high bandwidth interconnects. It offers up to 300 Gbit/s data transfer rate per link. Server GPUs (Volta V100) have six links whereas consumer-grade GPUs (RTX 2080 Ti) have only one link, operating at a reduced 100 Gbit/s rate. We recommend to use NCCL to achieve high data transfer between GPUs.
英語のヒント
NVLinkは、とても高い帯域の相互接続については、PCIeの代わりになる。リンクあたり最大300 Gbit/sのデータ転送速度を与える。サーバー用GPU(Volta V100)には六つのリンクがあり、一般向けGPU(RTX 2080 Ti)にはリンクが一つしかなく、100 Gbit/sに落とした速さで動作する。GPU間で高いデータ転送を達成するには、NCCLを使うことを勧める。