Upgrade to Pro — share decks privately, control downloads, hide ads and more …

NVIDIA A100 GPU を搭載した Amazon EC2 P4d インスタンスのご紹介

Daisuke Miyamoto
December 25, 2020
480

NVIDIA A100 GPU を搭載した Amazon EC2 P4d インスタンスのご紹介

Amazon EC2 では、NVIDIA の最新世代 GPU である A100 GPU を搭載した P4d インスタンスがローンチされました。 この P4d インスタンスでは、これまでの P3 インスタンスと比較して、様々なDeep Learningワークロードについて約2.5倍のパフォーマンスを得られるだけでなく、400 Gbps の NVIDIA GPUDirect RDMA対応ネットワークアダプタ(EFA)や、高速な分散ストレージのサービスであるFSx for Lustre を活用して、EC2 UltraClustersという大規模なクラスタ環境を構築し、クラウド上でより大規模な処理を行うことも可能になりました。 本セッションでは、このP4dインスタンスの概要や、機械学習・HPC(High Performance Computing)での活用についてご紹介いたします。

Daisuke Miyamoto

December 25, 2020
Tweet

Transcript

  1. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Specialist Solutions Architect, HPC Daisuke Miyamoto 2020/12/24 AWSの最新GPUインスタンス Amazon EC2 P4d NVIDIA A100 GPU を搭載した Amazon EC2 P4d インスタンスのご紹介
  2. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 自己紹介 ❏ 名前 宮本 大輔 (みやもと だいすけ) ❏ 所属 アマゾン ウェブ サービス ジャパン 株式会社 技術統括本部 Specialist Solutions Architect, HPC ❏ 好きな AWS サービス ❖ AWS ParallelCluster ❖ Amazon FSx for Lustre ❖ AWS Snowball シリーズ
  3. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 本日の概要 • アクセラレーテッドコンピューティングとは • Amazon EC2 とは • Amazon EC2 におけるアクセラレータの選択肢 • P4d インスタンスのご紹介 • AWSサービス × アクセラレータの活用パターン
  4. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アクセラレーテッドコンピューティングとは
  5. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. CPU: 高速, 低効率 GPU/FPGA/ASICs: 高スループット, 高効率 特定のカテゴリのアプリケーションでは、 GPU,FPGA,ASIC などを用いる事により超並列化と高効率化が可能 アクセラレーテッドコンピューティングとは 計算の高スループット化のためには、さらなる並列化が必要とされている
  6. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. • 10〜100のプロセッシング コア • 事前定義された命令セット とデータパス幅 • 汎用コンピューティング向 けに最適化 CPU CPU、GPU、FPGA、ASICの特徴 • 数千のプロセッシングコア • 事前定義された命令セット とデータパス幅 • 並列実行に効果的な設計 GPU • 数百万のプログラマブル デジタルロジックセル • 書換え可能なハードウェア • 事前定義された命令セット はなく、広帯域のデータパ スを実装可能 FPGA DRAM Control ALU ALU Cache DRAM ALU ALU Control ALU ALU Cache DRAM ALU ALU Control ALU ALU Cache DRAM ALU ALU Control ALU ALU Cache DRAM ALU ALU • 特定の用途/機能に最適化 されたカスタム設計 • APIを通じて公開される事 前定義されたソフトウェア エクスペリエンス ASICs DRAM DRAM DRAM DRAM
  7. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. EC2のアクセラレータはCPUと協調動作 module filter1 (clock, rst, strm_in, strm_out) for (i=0; i<NUMUNITS; i=i+1) always@(posedge clock) integer i,j; //index for loops tmp_kernel[j] = k[i*OFFSETX]; コンピュートインテンシブな 並列計算をハードウェアアク セラレータ上で行う 残りの処理はCPUで行う application
  8. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 機械学習/AI アクセラレーテッドコンピューティングワークロード ハイパフォーマンス コンピューティング(HPC) グラフィックス 画像・ビデオ認識 自然言語処理 自動運転システム パーソナライゼーション レコメンデーション 流体力学計算 金融およびデータ 分析 ゲノミクス 計算化学 仮想グラフィック ワークステーショ ン 3D モデリング レンダリング ビデオ エンコーディング AR/VR ハードウェアアクセラレーションの恩恵を受けるアプリケーション例
  9. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon EC2 とは
  10. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 仮想サーバサービス Amazon EC2 (Elastic Compute Cloud) • 必要なときに必要な計算リソースを確保可能な仮想サーバサービス • 数分で起動し、秒単位の従量課金(一部タイプについては1時間単位) • ワークロードに応じて様々なインスタンスタイプを選択可能 • インスタンスを停止するだけでマシンスペック変更が可能 M5 汎用 コンピューティング 最適化 ストレージ・IO 最適化 GPU ・FPGA アクセラレーテッド メモリ最適化 X1 F1 P3 G4 T3 D2 I3 H1 R5 C5 インスタンスタイプ一覧と分類 Z1d
  11. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon EC2 で選択できる高性能CPUの選択肢 アプリケーションとワークロードに応じて 最適なコンピューティング環境を選択 Intel Xeon processor (x86_64 arch) 最大3.9GHz駆動 Cascade Lakeコア搭載 C5インスタンス AMD EPYC processor (x86_64 arch) 最大3.3GHz駆動 Romeコア搭載 C5aインスタンス AWS Graviton Processor (64-bit Arm arch) 64bit Arm Neoverse N1ベース Graviton2 CPU搭載 C6gインスタンス
  12. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon EC2 の高性能ネットワーク技術 • 拡張ネットワーキング • SR-IOVに対応し、仮想化オーバーヘッドを低減することで低レイテンシでの通信が可能 • Cluster Placement Group • インスタンスの配置を最適化することで広帯域/低レイテンシ/フルバイセクション通信を実現 • Elastic Fabric Adapter • HPC向けに、MPI (Message Passing Interface) やNCCL (NVIDIA Collective Communications Library) などの libfabric 対応のアプリケーションでの通信をより低レイテンシ化 http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/enhanced-networking.html EC2のネットワークも進化を続け 現在はEC2インスタンスあたり 最大 400Gbps (P4dインスタンス) まで サポート ※ ※インスタンスタイプとサイズによって通信帯域は異なります
  13. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. EC2 購入オプション オンデマンドインスタンス 長期コミット無し、使用分への支払い(秒 単位/時間単位)。Amazon EC2の定価 スパイクするようなワーク ロード リザーブドインスタンス (Savings Plans) 1年/3年の長期コミットをする代わり に大幅なディスカウント価格 一定の負荷の見通しがある ワークロード スポットインスタンス Amazon EC2の空きキャパシティを 活用し、最大90%値引き。中断が発 生することがある 中断に強く、かつ様々なイ ンスタンスタイプを活用で きるワークロード ワークロードに合わせて購入方法を選択することで コスト効率よくEC2を利用可能に
  14. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS におけるアクセラレータの選択肢
  15. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. AWS における汎用計算高速化の選択肢 P2 NVIDIA K80 (Kepler) NVIDIA V100 16 GB (Volta) NVIDIA V100 32 GB (Volta) NVIDIA A100 (Ampere) Xilinx UltraScale+ FPGA P3 P3dn P4d F1 New
  16. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. AWS におけるグラフィック高速化の選択肢 G2 NVIDIA K520 (Kepler) NVIDIA M60 (Maxwell) NVIDIA T4 (Turing) AMD Radeon Pro V520 G3 G4dn G4ad New
  17. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 深層学習向けアクセラレータの選択肢 Deep Learning Inference Training NVIDIA T4 (Turing) G4dn NVIDIA V100 16 GB (Volta) NVIDIA V100 32 GB (Volta) NVIDIA A100 (Ampere) P3 P3dn P4d AWS Inferentia Inf1 AWS Trainium ? Habana Gaudi from Intel ?
  18. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon EC2 G4adインスタンス • ゲームストリーミング、リモートグラフィックスワーク ステーション、レンダリングなど、グラフィックスを多 用するワークロードに最適 • グラフィックス用GPU搭載インスタンスとしては G4dn (NVIDIA T4搭載)もローンチ済みであり、多様なGPU の選択肢を提供 • CUDA、cuDNN、NVENC等のNVIDIAのライブラリを使 用しない場合は G4ad により、より高いコストパフォー マンスが得られる可能性 • AWS 米国東部 (バージニア北部)、米国西部 (オレゴン)、 および欧州 (アイルランド) リージョンで利用可能 https://aws.amazon.com/jp/blogs/aws/new-amazon-ec2-g4ad-instances-featuring-amd-gpus-for-graphics-workloads/ https://aws.amazon.com/jp/about-aws/whats-new/2020/12/announcing-new-amazon-ec2-g4ad-instances-powered-by-amd-radeon-pro-v520-gpus/ AMDの Radeon Pro V520 GPU とEPYC Roma プロセッサを搭載した G4ad インスタンスをローンチ
  19. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Habana Gaudi-based Amazon EC2 • 8カードのGaudiアクセラレーターでの深層学習ト レーニングにより、現在のGPUベースのEC2イン スタンスよりも最大40%優れたコストパフォーマ ンスを提供 • TensorFlow、PyTorchなどをサポートし、自然言 語処理、オブジェクトの検出と分類、リコメンド やパーソナライズなど、深層学習のトレーニング ワークロードに最適 • Amazon EC2 に加え、Amazon EKSとECS、およ びAmazonSageMakerが対応予定 https://aws.amazon.com/ec2/instance-types/habana-gaudi/ ディープラーニングモデルのトレーニング用に特別に設計された、 HabanaLabsのGaudiアクセラレータを搭載したAmazon EC2 インスタンス https://habana.ai/wp- content/uploads/pdf/2020/Habana%20Gaudi%20customer%20ena blement%20on%20AWS%20December%202020.pdf
  20. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. AWS Trainium • クラウドでMLモデルをトレーニングするための最高の コストパフォーマンスを提供 • AWS Inferentia と同様に Neuron SDK を利用し、 TensorFlow、MXNet、PyTorchといったフレームワー クをサポート • Trainiumチップは、画像分類、セマンティック検索、 翻訳、音声認識、自然言語処理、レコメンデーション エンジンなど、アプリケーションのディープラーニン グトレーニングワークロード向けに特別に最適化 • AmazonEC2インスタンスに加え、AWS Deep Learning AMI、Amazon SageMaker、Amazon ECS、 EKS、AWS Batchなどのマネージドサービスを介して 利用可能に https://aws.amazon.com/machine-learning/trainium/ AWSによって設計された高性能な機械学習トレーニングチップ
  21. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. P4d インスタンスのご紹介
  22. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon EC2 P4d インスタンス NVIDIA A100 Tensor Core GPU を搭載した P4d インスタンスがローンチ • p4d.24xlarge (A100 x 8枚搭載) の 1サイズのみの提供(表参照) • GPU間は 600 GB/s の NVSwitch/NVLink で接続 • インスタンスあたり 400 Gbps のEFA対応の高速なネットワークインターフェースを提供 • 1 TBのNVMe SSDを8枚搭載しており、RAID0構成時、最大 16 GB/s のスループットを提供 • Multi-Instance GPU (MIG) にも対応 • US East(N. Virginia)、US West(Oregon)で利用可能 https://aws.amazon.com/jp/ec2/instance-types/p4/
  23. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. P4d のパフォーマンス 様々な深層学習モデルのトレーニングにおいて、P3dnよりも2倍以上高速 DNN P3dn FP32 (imgs/sec) P3dn FP16 (imgs/sec) P4d Throughput TF32 (imgs/sec) P4d Throughput FP16 (imgs/sec) P4d over p3dn TF32/FP32 P4d over P3dn FP16 Resnet50 3057 7413 6841 15621 2.2 2.1 Resnet152 1145 2644 2823 5700 2.5 2.2 Inception3 2010 4969 4808 10433 2.4 2.1 Inception4 847 1778 2025 3811 2.4 2.1 VGG16 1202 2092 4532 7240 3.8 3.5 Alexnet 32198 50708 82192 133068 2.6 2.6 SSD300 1554 2918 3467 6016 2.2 2.1 https://aws.amazon.com/jp/blogs/compute/amazon-ec2-p4d-instances-deep-dive/ https://github.com/aws-samples/deep-learning-models
  24. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. P4d のネットワーク構成 1:概要 • インスタンス内の 8 GPU は、NVSwitchにより 各リンク600 GB/s のフル メッシュ構成で接続されている • インスタンス間は、EFAに対応した400 Gbps(100 Gbps × 4)のネット ワークで接続、GPUDirect RDMA にも対応 https://aws.amazon.com/jp/blogs/compute/amazon-ec2-p4d-instances-deep-dive/
  25. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. P4d のネットワーク構成 2:インスタンス内 • P4dではフルメッシュ接続により、Multi-GPU時の通信性能が向上 • NVLink の性能も P3dn 300 GB/s から P4d 600 GB/s に向上 https://aws.amazon.com/jp/blogs/compute/amazon-ec2-p4d-instances-deep-dive/ P4d P3dn ※ ベンチマーク結果は参考例です
  26. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. P4d のネットワーク構成 3:インスタンス間 • P4dでは 100 Gbps のネットワークを 4 つ接続す ることにより、400 Gbpsでのインスタンス間通信 が可能 • EFA及びGPUDirect RDMAによる低レイテンシ通 信が可能 • インスタンス作成時に 4 つの Network Interfaceを アタッチする必要がある (複数Network Interface接続時は Public IPが設定されないので注意が必要) https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#network-cards EC2 インスタンス作成時のNetwork Interface設定
  27. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. P4d のネットワーク構成 4:インスタンス間通信例(参考) NCCLの All-reduce によるテスト方法も記載(Deep Learning AMI利用) https://docs.aws.amazon.com/dlami/latest/devguide/tutorial-efa-using.html ※ ベンチマーク結果は参考例です P3dn P4d
  28. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 参考:EFA (Elastic Fabric Adapter) とは MPI/NCCL専用のネットワークアダプタ Elastic Fabric Adapter により 低レイテンシでのノード間通信を実現 • 利用には対応した環境(Intel MPI・OpenMPI・NCCL)が必要だが、プログラムの変更は原 則不要 • EFA対応インスタンス:c5n.18xlarge, m5n.24xlarge, p4d.24xlarge , p3dn.24xlarge etc. L. Shalev, H. Ayoub, N. Bshara and E. Sabbag, "Supercomputing on Nitro in AWS Cloud," in IEEE Micro, doi: 10.1109/MM.2020.3016891. https://ieeexplore.ieee.org/document/9167399
  29. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 参考:EFAで使用されているSRD (Scalable Reliable Datagram) AWS のデータセンターネットワーク向けに 新たに開発されたトランスポートプロトコル 配信保証:EC2のリソースを使用せずに保証を行う マルチパスルーティング:データセンターの複数の ネットワーク経路を活用 レイテンシ・ジッターの低減:独自の link/switch ダウ ン検出、輻輳制御 アウトオブオーダーでの転送:ブロックを抑制 Link Failure Handling - Latency Link Failure Handling - Throughput L. Shalev, H. Ayoub, N. Bshara and E. Sabbag, "Supercomputing on Nitro in AWS Cloud," in IEEE Micro, doi: 10.1109/MM.2020.3016891. https://ieeexplore.ieee.org/document/9167399
  30. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 32 * P3dn nodes, NVLINK, all-reduce via NCCL 256 V100 GPUs AWS ENA AWS EFA BERT (NLP) 1.0x 1.5x TDS-Seq2Seq (ASR) 1.0x 1.3x P3dn 0 P3dn 1 P3dn 31 … … Cloud fabric ML Training is sensitive to interconnect • All-reduce is most common collective • Large messages O(1-10MB) are common P3dn with EFA provides up to 100 Gbps Model parallelism • Different communication patterns • Needs high bisection bandwidth New emerging workloads: graph learning ENA - Elastic Network Adapter EFA - Elastic Fabric Adapter 参考:Facebook AI Research (FAIR) & EFA
  31. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. BERT (128 sequence length). Dataset is the Wikipedia/Books Corpus prepared from NVIDIA Deep Learning examples At 16 nodes of p3dn.24xl (128 V100 GPUs), we achieve ~96% scaling efficiency For more, visit https://github.com/aws-samples/eks-efa-examples Number of Nodes Number of GPUS Batch Size / GPU Max Accumulation Steps Sequence length Throughput - mixed precision (Sequences/sec) - EFA Throughpu mixed precis (Sequences/s TCP 1 8 64 128 128 1303 1298 2 16 64 128 128 2561 2531 4 32 64 128 128 5114 5102 8 64 64 128 128 10254 10061 12 96 64 128 128 15315 15151 16 128 64 128 128 20053 19954 48 384 64 256 128 61161 64 512 64 256 128 80190 参考:Elastic Kubernetes Service (EKS) & EFA
  32. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. P4d インスタンス活用事例:ZENOTECH 様 CFD(Computational Fluid Dynamics)ソフトウェアである zCFDにおいて、 149 million cell時に、既存のGPUよりも 3.5 倍高速に処理が可能に https://aws.amazon.com/jp/ec2/instance-types/p4/ https://zenotech.com/making-a-big-impact-on-cfd-simulations-zcfd-benchmarks-aws-p4d/
  33. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. P4d インスタンス活用事例:TRI-AD 様 機械学習モデルのトレーニングにおいて、 既存のコードの修正なしに学習時間を40%削減し、コストパフォーマンスも向上 https://aws.amazon.com/jp/ec2/instance-types/p4/
  34. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWSサービス × アクセラレータの活用パターン
  35. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. アクセラレータに対応したプログラムを入手 〜AWS Marketplace〜 • AWS Marketplaceからアクセラレータに対 応したOS+アプリケーションイメージ(AMI) を入手して素早く利用する https://aws.amazon.com/marketplace 例) AWS Deep Learning AMI • Deep Learning に必要なライブラリ・フレーム ワークがすべてインストールされた AMI • Ubuntu 版と Amazon Linux 版 Windows 版の 3種類を提供 • P3、G4dn、P4d のGPUやInf1のInferentia、 Elastic Inferenceのアクセラレーションにも対応 https://aws.amazon.com/jp/machine-learning/amis/ AWS Deep Learning AMI MXNet TensorFlow Caffe & Caffe2 Theano Cognitive Toolkit Torch Keras Nvidia CUDA & cuDNN Python 2 & Python 3 Intel MKL Anaconda Amazon EC2 (Amazon Linux / Ubuntu / Windows) Chainer
  36. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Amazon SageMaker 機械学習の開発・学習・推論を一気通貫にサポートするAmazon SageMakerで はGPUを用いた分散学習やInf1,ElasticInferenceを用いた推論環境のデプロイ もサポート P4d インスタンス(ml.p4d.24xlarge)もサポート済み https://aws.amazon.com/jp/about-aws/whats-new/2020/12/introducing-amazon-sagemaker-ml- p4d-instances-for-highest-performance-ml-training-in-the-cloud/
  37. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. ジョブ投入に応じて自動でスケールするクラスタを AWS 上に構築可能な AWS 公式のオープンソースソフトウェア AWS ParallelCluster の特徴 • 既存のHPC向けジョブスケジューラと Auto-Scaling を連携した環境を作成 Slurm / SGE / Torque ※に対応 • 少しのコマンド操作でクラスタ作成可能 • MPI 環境がセットアップ済みで、すぐに利用可能 • P4d インスタンスもサポート済みで、 EFA/GPUDirect RDMA の設定も簡単に実施可能 • 使用するOSやネットワーク環境、ストレージ構成な どを柔軟にカスタマイズ可能 • オープンソースソースのプロジェクトであり、誰で もソースコードを入手可能 https://github.com/aws/aws-parallelcluster AWS ParallelCluster ※ 将来的にSGE/Torqueについてはサポートの終 了がアナウンスされており、Slurmの利用を推奨
  38. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. EC2 Ultra Clusters of P4d Instances • インスタンスあたり400 Gbpsの 高速なネットワーク • GPUDirect RDMA over EFAによ る低レイテンシ通信 • 4000を超えるA100 Tensor Core GPUを接続 • FSx for Lustre による高速な分散 ストレージとS3への永続化 • 必要なときに起動して、使用した 分のみのお支払い クラウド上でスーパーコンピュータクラスの性能を実現
  39. © 2020, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. まとめ • AWS ではアクセラレーテッドコンピューティングのための数多くの選択肢 を提供中 • NVIDIA A100 Tensor Core GPU を搭載した P4d インスタンスは、 US East(N. Virginia)、US West(Oregon)で利用可能 • P4d は、A100の高い演算性能に加えて、GPU間はフルメッシュの600 GB/s、 インスタンス間は 400 Gbpsの EFA/GPUDirect RDMAに対応しており、既 存のP3dnと比較して通信性能も強化されておりコストパフォーマンスの向 上が期待できる • P4d は、Amazon EC2からの利用の他、Amazon SageMaker や AWS ParallelClusterから利用することも可能 是非皆さんのワークロードを P4d の上で動かしてみてください!