Linux如何监视显存和内存的使用情况
显存(2秒刷新一次内存消耗):
nvidia-smi -l 2 > logGPU.txt
真的是服了,nvdia-smi会报错
WARNING: infoROM is corrupted at gpu 0000:60:00.0
新的解决方案:自己写一个watch脚本 。.sh
#!/bin/bash
while true
do
nvidia-smi | tee -a /logMonitor.txt
free -h | tee -a logMonitor.txt
sleep 1s
done
内存(输出带时间戳的内存消耗):
vmstat 2 -a -S M -w -t > logCPU.txt
Log the Memory Consumption on Linux | Baeldung on Linux
vmstat 1 3 -a -S M -w -t
- 1: delay in printing the statistics
- 3: number of times we wanted to print the statistics
- -a: print the active and inactive memory information; by default, it prints the buffer and cache information
- -S M: tells to print the statistics in MB
- -w: set the wide mode to accommodate the large values
- -t: to print the timestamp in the result