LoginSignup
1
1

More than 1 year has passed since last update.

【NVIDIA】NVIDIA cuda-samples使用方法

Last updated at Posted at 2022-11-17

はじめに

GitHubに書かれている手順がさっぱり・・・
見る人が見れば分かるのか???
そんな私、みなさんのためのメモです。

ですので新しい情報はないです。
GitHub見てください。

参考

環境

  • OS CentOS7.9
  • CUDA 11.2
  • GPU V100

手順

  • (1) cuda-samplesダウンロード
  • (2) cuda-samplesビルド
  • (3) 実行
  • (4) 応用

(1) cuda-samplesダウンロード

GitHubからcuda-samplesをダウンロード

- 緑色のコード⇒ダウンロードZIP
+ git clone https://github.com/NVIDIA/cuda-samples.git

(2) cuda-samplesビルド

/tmp
# /tmpなどに保存して実行
tar zxvf cuda-samples-11.8.tar.gz
Samples種類 概要
0.はじめに 初心者向けの基本的な CUDA サンプル
1.ユーティリティ GPU/CPU 帯域幅を測定する方法
2. コンセプトとテクニック CUDA 関連の概念と一般的な問題解決手法
3.CUDAの機能 CUDA 機能 (協調グループ、CUDA 並列処理など)
4. CUDA ゲートウェイ CUDA プラットフォーム ゲートウェイ
5. ドメインの本質 ドメイン (グラフィックス、金融、画像処理)
6. パフォーマンス パフォーマンスの最適化
cuda-samples-11.8/Samples/bandwidthTest
# sampleディレクトリに移動
cd cuda-samples-11.8/Samples/

#今回はGPU運用監視に使用するのでbandwidthTestディレクトリに移動
cd bandwidthTest
make
>>>
    # エラー発生
    ~~~~~
    nvcc fatal   : Unknown option '-threads'
    ~~~~~

とりあえず同一ディレクトリのMakefile内の-threads削除(303行目)

cuda-samples-11.8/Samples/1_Utilities/bandwidthTest
vi Makefile
- ALL_CCFLAGS += --std=c++11
+ ALL_CCFLAGS += --threads 0 --std=c++11

再度実行

cuda-samples-11.8/Samples/1_Utilities/bandwidthTest
make
>>>
~~~
nvcc fatal   : Unsupported gpu architecture 'compute_75'
~~~

アーキテクチャが自動判別されておりcompute_75になっていました。
今回はV100を使用しているのでSMS="70"を指定して再度実行

cuda-samples-11.8/Samples/1_Utilities/bandwidthTest
make SMS="70"

(3) 実行

cuda-samples-11.8/bin/x86_64/linux/releaseに保存される
実行するOSによって変化。

cuda-samples-11.8/bin/x86_64/linux/release
cd cuda-samples-11.8/bin/x86_64/linux/release
./bandwidthTest
>>>
[CUDA Bandwidth Test] - Starting...
Running on...

 Device 0: Tesla V100-SXM2-32GB
 Quick Mode

 Host to Device Bandwidth, 1 Device(s)
 PINNED Memory Transfers
   Transfer Size (Bytes)        Bandwidth(GB/s)
   32000000                     12.4

 Device to Host Bandwidth, 1 Device(s)
 PINNED Memory Transfers
   Transfer Size (Bytes)        Bandwidth(GB/s)
   32000000                     13.2

 Device to Device Bandwidth, 1 Device(s)
 PINNED Memory Transfers
   Transfer Size (Bytes)        Bandwidth(GB/s)
   32000000                     731.0

Result = PASS 

(4) 応用

# ヘルプ表示
./bandwidthTest -help

# 全GPUに対して実行
./bandwidthTest --device=all

# host⇔device device⇔host device⇔device経路を変えて実行
./bandwidthTest --device=all [-htod | -dtoh | -dtod ]

ひとまず実行は出来ました。
Makefile内の一部削除しているので、強引です。
参考になれば

それではまた

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1