以下のようにする。
nvidia-smi --query-gpu=timestamp,index,name,utilization.gpu,utilization.memory,memory.used,memory.free,memory.total --format=csv -l 1
timestamp, index, name, utilization.gpu [%], utilization.memory [%], memory.used [MiB], memory.free [MiB], memory.total [MiB]
2023/06/30 20:18:56.227, 0, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24257 MiB, 24576 MiB
2023/06/30 20:18:56.228, 1, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24255 MiB, 24576 MiB
2023/06/30 20:18:57.228, 0, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24257 MiB, 24576 MiB
2023/06/30 20:18:57.229, 1, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24255 MiB, 24576 MiB
2023/06/30 20:18:58.230, 0, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24257 MiB, 24576 MiB
2023/06/30 20:18:58.230, 1, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24255 MiB, 24576 MiB
2023/06/30 20:18:59.231, 0, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24257 MiB, 24576 MiB
2023/06/30 20:18:59.232, 1, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24255 MiB, 24576 MiB
2023/06/30 20:19:00.233, 0, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24257 MiB, 24576 MiB
2023/06/30 20:19:00.233, 1, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24255 MiB, 24576 MiB
2023/06/30 20:19:01.234, 0, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24257 MiB, 24576 MiB
2023/06/30 20:19:01.235, 1, NVIDIA GeForce RTX 3090, 0 %, 0 %, 2 MiB, 24255 MiB, 24576 MiBindexを指定することで、複数GPUを搭載している場合それがわかるようになる。2秒おきとかにするなら、-l 2などとすればOK。

