1
0
はじめての記事投稿
Qiita Engineer Festa20242024年7月17日まで開催中!

UbuntuでどのユーザーがどのくらいGPUを使用しているか調べる方法

Last updated at Posted at 2024-06-18

このコマンドでできると思います

コマンド
paste \
<(ps --no-header up $(nvidia-smi --query-compute-apps=pid --format=csv,noheader | sed 's/,//g') \
| awk '{print $1 ": " $2 ","}') \
<(nvidia-smi --query-compute-apps=pid,used_memory --format=csv,noheader \
| sort \
| awk '!colname[$1]++{print $2 $3}')
結果
user_hoge: 11436,      1606MiB
user_fuga: 30874,      4142MiB

左からユーザー名、PID、メモリ使用量です。
現段階では工夫が足りないのでヘッダがなかったり、同じPIDで複数のGPUを使用している場合に両方の利用量を表示できなかったりします

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