1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GPUのメモリ使用量/使用率を見るときにnvidia-smiコマンドで確認することはお手軽なこともあり多いかと思いますが、リアルタイムでモニタリングしようと思うと何回もnvidia-smiを叩き続けないといけないのか?と思ったのですがそんなことはなかったというお話。

nvidia-smiコマンドの定期実行

# 1秒間隔で実行
nvidia-smi -l 1
# 500ミリ秒=0.5秒間隔で実行
nvidia-smi -lms 500

CSV形式で出力

nvidia-smi --query-gpu=timestamp,name,utilization.gpu,memory.used --format=csv -l 3
# 以下出力例
timestamp, name, utilization.gpu [%], memory.used [MiB]
2021/03/06 14:21:31.143, GeForce GTX 1080 Ti, 0 %, 440 MiB
2021/03/06 14:21:34.144, GeForce GTX 1080 Ti, 0 %, 440 MiB
2021/03/06 14:21:37.145, GeForce GTX 1080 Ti, 15 %, 575 MiB
2021/03/06 14:21:40.145, GeForce GTX 1080 Ti, 36 %, 10595 MiB
2021/03/06 14:21:43.146, GeForce GTX 1080 Ti, 35 %, 10594 MiB

--query-gpuはGPU単位での情報。
--query-compute-appsとするとプロセス単位での情報を出力可能。
-f <FILE_PATH>を付けるとファイル出力できる。

watch

watch -n 1 nvidia-smi

1秒間隔でnvidia-smiを実行、同一画面で出力が順次更新される。

参考

1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?