プリンキピア

第13章計算の性能

13.6. Concise Implementation for Multiple GPUs13.6 複数のGPUのための簡潔な実装

Implementing parallelism from scratch for every new model is no fun. Moreover, there is significant benefit in optimizing synchronization tools for high performance. In the following we will show how to do this using high-level APIs of deep learning frameworks. The mathematics and the algorithms are the same as in Section 13.5. Quite unsurprisingly you will need at least two GPUs to run code of this section.
英語のヒント
新しいモデルのたびに並列化をゼロから実装するのは楽しくない。さらに、高い性能のために同期の道具を最適化することには大きな利点がある。以下では、深層学習のフレームワークの高水準のAPIを使ってこれをどう行うかを示す。数学とアルゴリズムは13.5節と同じである。当然ながら、この節のコードを動かすには少なくとも二つのGPUが要る。
import torch
from torch import nn
from d2l import torch as d2l