NVIDIA NVbandwidth:GPU相互接続とメモリ性能を測定する必須ツール
NVIDIAは、CUDAアプリケーション開発者がGPU間接続とメモリ性能を測定するためのツール「NVbandwidth」を開発者ブログで紹介した。
キーポイント
NVbandwidthツールの目的
GPU間の接続帯域幅とメモリ性能を測定し、CUDAアプリケーションのデータ転送性能を最適化するためのツールとして紹介されている。
開発者向けの実用性
高性能なCUDAコードを書く上で重要なデータ転送性能に焦点を当て、開発者がボトルネックを特定・改善することを支援する。
NVIDIA開発者エコシステムの強化
開発者ブログを通じてツールを提供し、NVIDIAプラットフォーム上でのアプリケーション開発効率と性能向上を促進する取り組みの一環。
影響分析・編集コメントを表示
影響分析
この記事は、NVIDIAが自社の開発者エコシステムを強化するための実用的なツールを提供していることを示しており、AI/機械学習分野でGPUを活用する開発者にとって直接的な価値がある。ただし、これは既存技術の応用・改善であり、業界を変革するような画期的な技術発表ではない。
編集コメント
開発者向けの実践的な技術情報として価値はあるが、あくまでNVIDIAの自社製品・エコシステム推進の文脈であり、業界全体に影響を与える重大ニュースとは言い難い。
CUDA アプリケーションを開発する際、優れたコードを書くために最も重要なのはデータ転送パフォーマンスです。これは単一 GPU システムにもマルチ GPU システムにも適用されます。GPU システムのメモリ特性を理解するために使用できるツールの一つが、NVIDIA NVbandwidth です。
このブログ記事では、NVbandwidth とは何か、その動作原理、主要な機能、そしてご自身の NVIDIA GPU システムをテストおよび評価するためにどのように使用できるかについて解説します。この投稿は、GPU インターコネクトのパフォーマンスを測定し検証する必要がある CUDA 開発者、システムアーキテクト、および ML インフラストラクチャエンジニアを対象としています。
NVbandwidth とは?
NVbandwidth は、コピーエンジン(CE)またはカーネルコピーメソッドのいずれかを使用して、異なるリンク間での各種メモリコピーパターンに対する帯域幅とレイテンシを測定する CUDA ベースのツールです。システム上で現在測定された帯域幅を報告し、GPU 構成のパフォーマンス特性に関する貴重な洞察を提供します。現代の GPU は驚異的な計算能力を誇りますが、そのパフォーマンスはしばしば異なるデバイス間でのデータ移動速度によって制限されます:
CPU メモリから GPU メモリへ
GPU メモリから CPU メモリへ
GPU メモリから GPU メモリへ
これらのパフォーマンス特性を理解することで、開発者は以下が可能になります:
システムパフォーマンスの評価
メモリアクセスレイテンシの測定
単一ノードおよびマルチノード GPU 展開における帯域幅の測定
異なるメモリ転送パターンがパフォーマンスに与える影響の理解
CUDA アプリケーションにおける帯域幅のボトルネックを診断する
特定のワークロード向けにメモリ転送パターンを最適化する
システム内の複数の GPU 間で帯域幅とレイテンシを比較する
パフォーマンスの監視と検証
動機
メモリ帯域幅は、LLM(大規模言語モデル)などの現代の GPU アプリケーションにおいて、重要なパフォーマンス要因です。モデルのサイズと複雑さが増すにつれて、効率的なデータ移動は、以下のような領域での最適なパフォーマンスにとってますます重要になっています:
モデルの読み込みと初期化:高速なモデル読み込みは、迅速な起動時間にとって不可欠です
推論パフォーマンス:リアルタイムの応答能力に影響します
トレーニング効率:帯域幅の制限は、異なるトレーニングフェーズのパフォーマンスに影響を与える可能性があります:
勾配更新
パラメータ同期
NVbandwidth の主な機能
包括的な帯域幅テスト
NVbandwidth は、以下の幅広い帯域幅テストをサポートしています:
単方向テスト:
ホストからデバイスへ(H2D)
デバイスからホストへ(D2H)
デバイス間(D2D)
双方向テスト:
ホストとデバイスの間
デバイス間
マルチ GPU テスト:
全ノードから 1 ノードへ(A2O)
1 ノードから全ノードへ(O2A)
全ノードからホストへ(A2H)
ホストから全ノードへ(H2A)
マルチノードテスト(MPI サポートでビルドした場合):
クラスター内のノード境界をまたぐ帯域幅を測定するためのテスト
レイテンシテスト
ホストとデバイスの間のレイテンシ
デバイス間のレイテンシ
複数のコピー方法
このツールは、メモリ転送のための 2 つの主要なメソッドを実装しています:
コピーエンジン(CE):CUDA の組み込み非同期メモリコピー関数を使用
ストリーミングマルチプロセッサ(SM):カスタム CUDA カーネルを使用して、SM 経由でコピーを実行します。
この二重のアプローチにより、システムの帯域幅能力をより包括的に理解することができます。
トポロジー非依存の設計
NVbandwidth は、単一ノードまたはマルチノードシステム内の異なる GPU インターコネクトトポロジー(NVLINK、NVLink C2C、または PCIe を使用する場合を含む)全体で効率的に動作するように設計されています。機能するためにシステムのトポロジーに関する明示的なユーザー知識は必要なく、実際にはその使用は主にトポロジーに依存しません。
柔軟な出力オプション
結果は以下の形式で表示できます:
プレーンテキスト形式(デフォルト)
JSON 形式(-j オプションを使用)
システム要件
nvbandwidth を使用するには、以下が必要です:
CUDA 対応 NVIDIA GPU
CUDA ツールキット(単一ノードバージョンでは 11.X 以上、マルチノードバージョンでは 12.3)
CUDA ツールキットのバージョンと互換性のある NVIDIA ディスプレイドライバー
C++17 互換コンパイラ(Linux では GCC 7.x 以上)
CMake(バージョン 3.20 以上、3.24 以上を推奨)
Boost program options ライブラリ
マルチノードバージョンのみ:
CUDA 12.3 ツールキットおよび 550 ドライバー以上
MPI のインストール
詳細なビルド手順が必要なユーザーは、README の指示を参照してください。
NVbandwidth の使用方法
基本的な使い方
システムのインターコネクト帯域幅を包括的に測定するには、単に以下を実行します:
./nvbandwidth
デバイス間帯域幅をコピーエンジン方式で測定し、1GiBのバッファと10回の反復回数を用い、結果をJSON形式で出力したい場合を考えます:
./nvbandwidth -t device_to_device_memcpy_read_ce -b 1024 -i 10 -j
出力例
ホストからデバイスへのコピーテストを実行した際の出力の例を示します:
Running host_to_device_memcpy_ce.memcpy CE CPU(row) -> GPU(column) bandwidth (GB/s)
0 1
0 55.63 55.64
SUM host_to_device_memcpy_ce 111.27
COEFFICIENT_OF_VARIATION host_to_device_memcpy_ce 0.00
NOTE: The reported results may not reflect the full capabilities of the platform.
Performance can vary with software drivers, hardware clocks, and system topology.
内部構造:NVbandwidthの動作原理
アーキテクチャ
NVbandwidthは、テスト定義、メモリ操作、結果報告を別々のサブシステムに分離するモジュール型設計に従っています:
CLIインターフェース:ユーザー入力を処理し、テスト実行を調整する
テストケースフレームワーク:異なる帯域幅テストを定義するための標準インターフェースを提供する
メモリコピーフレームワーク:メモリ操作を実行する中核コンポーネント
CUDAカーネル:メモリ操作を実行するための専用CUDAカーネル
出力システム:テスト結果をフォーマットして表示する NVbandwidth.cpp:178-246
測定の詳細
このツールは、パフォーマンスを正確に測定するために以下のアプローチを使用します:
まず、ホストメモリ内のフラグでスピンするスピンのカーネルをキューに追加します
スピンカーネルは、測定対象のすべてのイベントが完全にキューに追加されるまでデバイス上で実行され続けます。
次に、開始イベント、特定の回数の memcpy 反復処理、そして最後に停止イベントがキューに追加されます。
最後に、測定を開始するフラグが解放されます。
このプロセスにより、インターコネクトを介した実際の転送の測定から、キュー操作のオーバーヘッドが除外されます。
双方向帯域幅テスト
双方向テストでは、NVbandwidth はデータが両方向に同時に流れているときの帯域幅を測定します。以下の図 1 を参照してください。
図 1: H2D(ホストからデバイス)および D2H(デバイスからホスト)のデータ方向で接続された CPU と GPU
CE コピー
測定対象となるストリーム A はデバイスへの書き込みを行い、反対方向のストリーム B は読み取りを行います。
SM コピー
このテストでは、交互のスレッドワープが交互の方向にデータをコピーするカーネルコピーが起動されます。
マルチノード操作
マルチノードモードで NVbandwidth を実行するには、追加の設定と構成が必要です。
NVIDIA Internode Memory Exchange Service (IMEX) を開始します:
sudo systemctl start nvidia-imex.service
/etc/nvidia-imex/nodes_config.cfg でノードアドレスを設定します。
- MPI を使用して実行:
mpirun --allow-run-as-root --map-by ppr:4:node --bind-to core -np 8 --report-bindings
-q -mca btl_tcp_if_include enP5p9s0 --hostfile /etc/nvidia-imex/nodes_config.cfg ./nvbandwidth -p multinode
NVIDIA Multi-Node NVLink (MNNVL) システムでは、NVLink ドメインを構成するすべてのノードに対して、完全に設定され稼働中の IMEX ドメインが必要です。NVbandwidth は、ノード間で測定を調整するために MPI を使用します。以下の図 2 を参照してください。
Figure 2: NVLink で接続されたマルチノード、マルチ GPU システムの例。
出力例
ここでは、マルチノードシステム上のノード間でのピアツーピアパフォーマンスを測定した際の出力例を示します。
Running multinode_device_to_device_memcpy_read_ce.memcpy CE GPU(row) -> GPU(column) bandwidth (GB/s)
0 1 2 3 4 5 6 7
0 N/A 397.39 397.44 397.59 397.50 397.52 397.66 397.55
1 397.65 N/A 397.35 397.46 397.48 397.53 397.53 397.59
2 397.65 397.35 N/A 397.57 397.39 397.55 397.53 397.50
3 397.57 397.37 397.35 N/A 397.50 397.50 397.52 397.53
4 397.68 397.30 397.44 397.55 N/A 397.53 397.52 397.52
5 397.66 397.26 397.48 397.46 397.52 N/A 397.50 397.59
6 397.68 397.39 397.48 397.59 397.52 397.44 N/A 397.61
7 397.68 397.41 397.42 397.48 397.52 397.50 397.53 N/A
NVbandwidth のユースケース
パフォーマンス最適化
システムの帯域幅特性を理解することで、CUDA アプリケーションを最適化し、利用可能な帯域幅をより効果的に活用できます。例えば、特定のハードウェア構成において、ある転送パターンが他のパターンよりも効率的であることが判明する可能性があります。
システム評価とテスト
NVbandwidth は、異なるシステム間で帯域幅パフォーマンスを測定・比較するための標準化された手法を提供し、テストやシステム評価において有用です。
トラブルシューティング
CUDA アプリケーションでパフォーマンス上の問題が発生している場合、NVbandwidth を使用して、帯域幅の制限が要因の一つではないか特定するのに役立ちます。NVbandwidth は、特定のシステム構成における現在測定された帯域幅を報告します。パフォーマンス結果は、GPU モデル、インターコネクトの世代、現在のクロック周波数、およびシステム構成のその他の側面など、複数の要因に基づいて大きく異なる場合があります。
ハードウェア検証:新しい GPU のインストール、ドライバーのアップグレード、またはシステム変更後、NVbandwidth を使用してメモリ帯域幅のパフォーマンスが期待値を満たしていることを確認できます。これにより、アプリケーションのパフォーマンスに影響を与える可能性のあるハードウェアの問題、ドライバーの不具合、または構成エラーを特定するのに役立ちます。
パフォーマンス回帰テスト:新しいソフトウェアバージョンやシステムアップデートを展開する際、NVbandwidthはパフォーマンスの低下を検出するための基準値を提供します。変更前後の帯域幅測定を比較することで、アップデートがシステムパフォーマンスに悪影響を与えていないかどうかを迅速に特定できます。
さらに先へ
NVbandwidthは、NVIDIA GPUシステムの帯域幅特性を測定し理解するための不可欠なツールです。包括的なテストスイート、柔軟な構成オプション、シングルノードおよびマルチノード展開の両方への対応により、CUDAアプリケーションの最適化、システムパフォーマンスの評価、トラブルシューティングに貴重な洞察を提供します。
NVbandwidthを活用することで、CUDAアプリケーションのパフォーマンスを最大化し、GPUセットアップ内での最適なデータ転送能力を保証する意思決定を行うことができます。GPUクラスターが規模と複雑さを増すにつれて、NVbandwidthも進化を続け、パフォーマンススケーラビリティのテストを含む、帯域幅測定と分析における新たな課題に対応し続けています。注釈
より詳細な情報については、以下の追加リソースをご覧ください。
概要 (NVIDIA/nvbandwidth)
アーキテクチャ (NVIDIA/nvbandwidth)
ビルドと実行 (NVIDIA/nvbandwidth)
GPUシステムのパフォーマンス最適化を開始するために、今すぐNVbandwidthをダウンロードして試してみてください!
原文を表示
When you’re writing CUDA applications, one of the most important things you need to focus on to write great code is data transfer performance. This applies to both single-GPU and multi-GPU systems alike. One of the tools you can use to understand the memory characteristics of your GPU system is NVIDIA NVbandwidth.
In this blog post, we’ll explore what NVbandwidth is, how it works, its key features, and how you can use it to test and evaluate your own NVIDIA GPU systems. This post is intended for CUDA developers, system architects, and ML infrastructure engineers who need to measure and validate GPU interconnect performance.
What is NVbandwidth?
NVbandwidth is a CUDA-based tool that measures bandwidth and latency for various memory copy patterns across different links using either copy engine (CE) or kernel copy methods. It reports the current measured bandwidth on your system, providing valuable insights into the performance characteristics of your GPU setup. While modern GPUs boast impressive compute capabilities, their performance is frequently limited by how quickly data can be moved between different devices:
CPU memory to GPU memory
GPU memory to CPU memory
GPU memory to GPU memory
Understanding these performance characteristics helps developers:
Evaluate system performance
Measure memory access latency
Measure bandwidth in single and multi-node GPU deployments
Understand the performance implications of different memory transfer patterns
Diagnose bandwidth bottlenecks in CUDA applications
Optimize memory transfer patterns for specific workloads
Compare bandwidth and latency across multiple GPUs in a system
Performance monitoring and validation
Motivation
Memory bandwidth is a critical performance factor in modern GPU applications, such as LLMs. As models grow in size and complexity, efficient data movement becomes increasingly important for optimal performance in areas such as:
Model loading and initialization: Fast model loading is crucial for quick startup times
Inference performance: Affects real-time response capabilities
Training efficiency: Bandwidth limitations can affect the performance of different training phases:
Gradient updates
Parameter synchronization
Key features of NVbandwidth
Comprehensive bandwidth testing
NVbandwidth supports a wide range of bandwidth tests, including:
Unidirectional tests:
Host -> Device (H2D)
Device -> Host (D2H)
Device ↔ Device (D2D)
Bidirectional tests:
Host ↔ Device
Device ↔ Device
Multi-GPU tests:
All to One (A2O)
One to All (O2A)
All to Host (A2H)
Host to All (H2A)
Multi-node tests (when built with MPI support):
Tests for measuring bandwidth across node boundaries in a cluster
Latency testing
Host ↔ Device latency
Device ↔ Device latency
Multiple copy methods
The tool implements two primary methods for memory transfers:
Copy Engine (CE): Uses CUDA’s built-in asynchronous memory copy functions
Streaming Multiprocessor (SM): Uses custom CUDA kernels to perform copies through the SM
This dual approach allows for a more comprehensive understanding of your system’s bandwidth capabilities.
Topology agnostic design
NVbandwidth is designed to work efficiently across different GPU interconnect topologies within a single-node or multi-node system, whether using NVLINK, NVLink C2C or PCIe. It doesn’t require explicit user knowledge of the system’s topology to function, making its use largely topology agnostic in practice.
Flexible output options
Results can be displayed in:
Plain text format (default)
JSON format (using the -j option)
System requirements
To use nvbandwidth, you’ll need:
CUDA-enabled NVIDIA GPU
CUDA toolkit (version 11.X or above for the single-node version and 12.3 for the multinode version)
NVIDIA display driver compatible with the CUDA toolkit version
C++17 compatible compiler (GCC 7.x or above for Linux)
CMake (version 3.20 or above, 3.24+ recommended)
Boost program options library
Multi-node version only:
CUDA 12.3 toolkit and 550 driver or above
MPI installation
For more detailed build instructions interested users can refer to the README instructions.
Using NVbandwidth
Basic usage
To comprehensively measure your system’s interconnect bandwidth, simply run:
./nvbandwidth
Suppose you want to measure device-to-device bandwidth using the copy engine method, with a 1GiB buffer and 10 iterations, and output the results in JSON format:
./nvbandwidth -t device_to_device_memcpy_read_ce -b 1024 -i 10 -j
Example output
Here’s an example of what the output looks like when running a host-to-device copy test:
Running host_to_device_memcpy_ce.memcpy CE CPU(row) -> GPU(column) bandwidth (GB/s) 0 1 0 55.63 55.64SUM host_to_device_memcpy_ce 111.27COEFFICIENT_OF_VARIATION host_to_device_memcpy_ce 0.00NOTE: The reported results may not reflect the full capabilities of the platform.Performance can vary with software drivers, hardware clocks, and system topology.
Under the hood: How NVbandwidth works
Architecture
NVbandwidth follows a modular design that separates test definition, memory operations, and result reporting into distinct subsystems:
CLI interface: Handles user inputs and orchestrates test execution
Test case framework: Provides a standard interface for defining different bandwidth tests
Memory copy framework: Core component that performs memory operations
CUDA kernels: Specialized CUDA kernels for performing memory operations
Output System: Formats and presents test results NVbandwidth.cpp:178-246
Measurement details
The tool uses the following approach to measure performance accurately:
First, it enqueues a spin kernel that spins on a flag in host memory
The spin kernel spins on the device until all events for measurement have been fully enqueued
Next, it enqueues a start event, a certain count of memcpy iterations, and finally a stop event
Finally, it releases the flag to start the measurement
This process ensures that the overhead of enqueuing operations is excluded from the measurement of actual transfer over the interconnect.
Bidirectional bandwidth tests
For bidirectional tests, NVbandwidth measures bandwidth when data is flowing in both directions simultaneously. See Figure 1, below:
Figure 1: CPU and GPU connected by H2D and D2H data directions
CE copies
Stream A (measured stream) performs writes to the device, while Stream B in the opposite direction produces reads.
SM copies
The test launches a kernel copy where alternating thread warps are copying data in alternating directions.
Multi-node operation
Running NVbandwidth in multi-node mode requires additional setup and configuration.
Start the NVIDIA Internode Memory Exchange Service (IMEX):
sudo systemctl start nvidia-imex.service
Configure node addresses in /etc/nvidia-imex/nodes_config.cfg
- Run with MPI:
mpirun --allow-run-as-root --map-by ppr:4:node --bind-to core -np 8 --report-bindings \ -q -mca btl_tcp_if_include enP5p9s0 --hostfile /etc/nvidia-imex/nodes_config.cfg ./nvbandwidth -p multinode
NVIDIA Multi-Node NVLink (MNNVL) systems require a fully configured and operational IMEX domain for all the nodes that form the NVLink domain. NVbandwidth uses MPI for coordinating measurements across nodes. See Figure 2, below:
Figure 2: Example multi-node, multi-GPU system connected with NVLink.
Example output
Here’s an example of what the output looks like when measuring peer-to-peer performance between nodes on a multi-node system.
Running multinode_device_to_device_memcpy_read_ce.memcpy CE GPU(row) -> GPU(column) bandwidth (GB/s) 0 1 2 3 4 5 6 7 0 N/A 397.39 397.44 397.59 397.50 397.52 397.66 397.55 1 397.65 N/A 397.35 397.46 397.48 397.53 397.53 397.59 2 397.65 397.35 N/A 397.57 397.39 397.55 397.53 397.50 3 397.57 397.37 397.35 N/A 397.50 397.50 397.52 397.53 4 397.68 397.30 397.44 397.55 N/A 397.53 397.52 397.52 5 397.66 397.26 397.48 397.46 397.52 N/A 397.50 397.59 6 397.68 397.39 397.48 397.59 397.52 397.44 N/A 397.61 7 397.68 397.41 397.42 397.48 397.52 397.50 397.53 N/A
NVbandwidth use cases
Performance optimization
By understanding the bandwidth characteristics of your system, you can optimize your CUDA applications to make better use of available bandwidth. For example, you might discover that certain transfer patterns are more efficient than others for your specific hardware configuration.
System evaluation and testing
NVbandwidth provides a standardized way to measure and compare bandwidth performance across different systems, making it valuable for testing and system evaluation.
Troubleshooting
If your CUDA application is experiencing performance issues, NVbandwidth can help identify if bandwidth limitations are a contributing factor. NVbandwidth reports the current measured bandwidth on a specific system configuration. Performance results may vary significantly based on multiple factors, such as GPU model, interconnect generation, current clocks and other aspects of system configuration.
Hardware validation: After installing new GPUs, upgrading drivers, or making system changes, NVbandwidth can verify that memory bandwidth performance meets performance expectations. This helps identify hardware issues, driver problems, or configuration errors that might impact application performance.
Performance regression testing: When deploying new software versions or system updates, NVbandwidth provides a baseline for detecting performance regressions. By comparing bandwidth measurements before and after changes, you can quickly identify if updates have negatively impacted system performance.
Going further
NVbandwidth is an indispensable tool for measuring and understanding the bandwidth characteristics of NVIDIA GPU systems. It provides valuable insights for optimizing CUDA applications, evaluating system performance, and troubleshooting issues by offering a comprehensive test suite, flexible configuration options, and support for both single-node and multi-node deployments.
By leveraging NVbandwidth, you can make informed decisions to maximize the performance of your CUDA applications and ensure optimal data transfer capabilities within your GPU setup. As GPU clusters evolve in size and complexity, NVbandwidth continues to advance, addressing new challenges in bandwidth measurement and analysis, including testing performance scalability.Notes
For more in-depth information, explore these additional resources.
Overview (NVIDIA/nvbandwidth)
Architecture (NVIDIA/nvbandwidth)
Building and Running (NVIDIA/nvbandwidth)
To begin optimizing your GPU system’s performance, download and try NVbandwidth today!
関連記事
プロテオーム規模でのタンパク質構造予測を加速する方法
NVIDIAが、タンパク質が単体ではなく相互作用によって生物学的プロセスを制御する点に着目し、プロテオーム規模でのタンパク質構造予測を高速化する手法を提案している。
Kubernetes上でSlurmを使用した大規模GPUワークロードの実行
NVIDIAが、オープンソースのクラスタ管理システムSlurmをKubernetesと統合し、大規模GPUワークロードを効率的に管理・スケジューリングする方法を紹介している。SlurmはTOP500システムの65%以上で採用されている実績を持つ。
約30行のPythonとNVIDIA nvCOMPでチェックポイントコストを削減
NVIDIAが、LLM学習時のチェックポイント保存コストを削減するPythonスクリプトを公開した。約30行のコードでモデル重み・オプティマイザ状態・勾配の圧縮保存を実現し、ストレージコストとI/O負荷を低減できる。