第13章計算の性能
13.7.3. Multi-Machine Training13.7.3 複数マシンでの訓練
Distributed training on multiple machines adds a further challenge: we need to communicate with servers that are only connected across a comparatively lower bandwidth fabric that can be over an order of magnitude slower in some cases. Synchronization across devices is tricky. After all, different machines running training code will have subtly different speed. Hence we need to synchronize them if we want to use synchronous distributed optimization. Fig. 13.7.7 illustrates how distributed parallel training occurs.
英語のヒント
複数のマシンでの分散訓練は、さらなる課題を加える。比較的帯域の低いファブリックでしかつながっていないサーバーと通信する必要があり、それは場合によっては1桁以上遅いことがある。装置をまたぐ同期は厄介である。結局のところ、訓練のコードを動かす異なるマシンは、速さが微妙に違う。したがって、同期的な分散最適化を使いたいなら、それらを同期させる必要がある。図13.7.7は、分散並列訓練がどう行われるかを示している。
- A (different) batch of data is read on each machine, split across multiple GPUs and transferred to GPU memory. There predictions and gradients are computed on each GPU batch separately.
英語のヒント
各マシンで(異なる)データのバッチを読み、複数のGPUに分け、GPUのメモリに転送する。そこで、各GPUのバッチについて別々に予測と勾配を計算する。 - The gradients from all local GPUs are aggregated on one GPU (or parts of it are aggregated over different GPUs).
英語のヒント
ローカルのすべてのGPUからの勾配を一つのGPUに集める(あるいはその部分を異なるGPUで集める)。 - The gradients are sent to the CPUs.
英語のヒント
勾配をCPUに送る。 - The CPUs send the gradients to a central parameter server which aggregates all the gradients.
英語のヒント
CPUは、すべての勾配を集める中央のパラメータサーバーに勾配を送る。 - The aggregate gradients are then used to update the parameters and the updated parameters are broadcast back to the individual CPUs.
英語のヒント
集めた勾配を使ってパラメータを更新し、更新したパラメータを個々のCPUにブロードキャストして戻す。 - The information is sent to one (or multiple) GPUs.
英語のヒント
その情報を一つ(あるいは複数)のGPUに送る。 - The updated parameters are spread across all GPUs.
英語のヒント
更新したパラメータをすべてのGPUに広げる。
Fig. 13.7.7図13.7.7
Multi-machine multi-GPU distributed parallel training.
英語のヒント
複数マシン・複数GPUの分散並列訓練。
Each of these operations seems rather straightforward. And, indeed, they can be carried out efficiently within a single machine. Once we look at multiple machines, though, we can see that the central parameter server becomes the bottleneck. After all, the bandwidth per server is limited, hence for workers the time it takes to send all gradients to the server is . We can break through this barrier by increasing the number of servers to . At this point each server only needs to store of the parameters, hence the total time for updates and optimization becomes . Matching both numbers yields constant scaling regardless of how many workers we are dealing with. In practice we use the same machines both as workers and as servers. Fig. 13.7.8 illustrates the design (see also (Li et al., 2014) for details). In particular, ensuring that multiple machines work without unreasonable delays is nontrivial.
英語のヒント
これらの操作はそれぞれ、かなり素直に見える。そして実際、一つのマシンの中では効率よく行える。しかし、複数のマシンを見ると、中央のパラメータサーバーがボトルネックになることがわかる。結局のところ、サーバーあたりの帯域は限られているので、個のワーカーについて、すべての勾配をサーバーに送るのにかかる時間はである。サーバーの数をに増やせば、この壁を突破できる。このとき、各サーバーはパラメータのを格納するだけでよいので、更新と最適化の合計時間はになる。両方の数を合わせれば、扱うワーカーの数にかかわらず一定のスケーリングが得られる。実際には、同じマシンをワーカーとしてもサーバーとしても使う。図13.7.8はこの設計を示している(詳しくは(Li et al., 2014)も参照)。特に、複数のマシンが不当な遅延なしに働くようにするのは自明ではない。
Fig. 13.7.8図13.7.8
Top: a single parameter server is a bottleneck since its bandwidth is finite. Bottom: multiple parameter servers store parts of the parameters with aggregate bandwidth.
英語のヒント
上:一つのパラメータサーバーは、帯域が有限なのでボトルネックになる。下:複数のパラメータサーバーが、合計の帯域でパラメータの一部ずつを格納する。