Skip to Content
AIシステム性能エンジニアリング (Japanese Edition)
book

AIシステム性能エンジニアリング (Japanese Edition)

by Chris Fregly
November 2025
Intermediate to advanced
1060 pages
18h 47m
Japanese
O'Reilly Media, Inc.
Content preview from AIシステム性能エンジニアリング (Japanese Edition)

第13章 PyTorchのプロファイリング 、チューニング、スケーリング

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

AIのトレーニングと推論パイプラインは、Pythonインタプリタのオーバーヘッド、CPUホスト側のデータロードによるストール、CUDAカーネルの低利用率、GPUデバイスメモリの競合など、あらゆるレイヤーでパフォーマンスのボトルネックに直面する可能性がある。効果的に最適化するには、システム全体をカバーする複数のツールを用いて、スタックの複数のレベルでプロファイリングを行う必要がある。

本章では、最新のNVIDIA GPU上で動作するPyTorchワークロードのプロファイリング、デバッグ、システムレベルチューニングに焦点を当てる。PyTorchの組み込みプロファイラ、NVIDIAのNsightツール、LinuxのperfによるCPUプロファイリング、さらにPyTorchのメモリプロファイリングとメモリアロケータ調整を用いて、ボトルネックを特定・修正する方法を解説する。また、PyTorchが並列処理にCUDAストリームを、カーネル起動オーバーヘッド削減にCUDAグラフをどう活用するかも論じる。

次に、PyTorch Distributed Data Parallel (DDP)、Fully Sharded Data Parallel (FSDP)、その他のモデル並列性戦略を用いてデータパイプラインの最適化を行い、複数GPUへスケールアウトする方法を示す。さらに、Holistic Trace Analysis (HTA) や Perfetto を含む、マルチGPU・マルチノード環境のプロファイリング手法を実演する。

本章では、カーネル実行時間、ハードウェア利用率メトリック、メモリフットプリント、データのロード効率性、スケーリングの総合的な費用対効果に焦点を当てた、性能トレードオフと定量的な例を強調する。本章の終わりまでに、スタック全体にわたるPyTorchワークロードのプロファイリングとチューニングに効果的で包括的なアプローチを実装する方法を理解できるようになる。

NVTXマーカーとプロファイリングツール

パフォーマンスの包括的な把握には、複数レベルでのプロファイリングとシステム全体をカバーするツールの使用が重要だ。システムスタックの全レイヤーにわたる包括的プロファイリングを行うため、実務者やパフォーマンスエンジニアが用いる共通ツールとベストプラクティスセットが存在する。

ツールについて説明する前に、NVIDIA Tools Extension(NVTX)とNVTXマーカーの重要性がある。これらのマーカーはプロファイラのタイムラインビューで時間範囲を示し、異なるプロファイラが同じフェーズにわたるイベントの相関を可能にする。

例えば、"forward" のNVTX範囲は、PyTorchプロファイリング・トレースとNsight Systemsのタイムラインの両方に表示される。これにより、スタックの異なるレイヤにおけるクロスツール分析が大幅に容易になる。NVTXマーカーは、PyTorchやCUDAエコシステムに関連するあらゆるものを含む、ほとんどの現代的なAIフレームワークやライブラリでサポートされている。

NVTXマーカーは、CUDA C++、PyTorch、またはNVIDIA GPUをサポートするC++/Pythonライブラリ(例:OpenAI ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

注目すべきレーダーのトレンド2026年1月 (Japanese Edition)

注目すべきレーダーのトレンド2026年1月 (Japanese Edition)

Mike Loukides

Publisher Resources

ISBN: 0642572281526