#nvidia #gpu #命令行工具 #record #日志文件 #时间线 #信息

app nvline

一个简单的命令行工具,用于记录您的 GPU 使用情况

1 个不稳定版本

0.1.0 2024 年 6 月 22 日

#654命令行实用工具

MIT 许可证

12KB
197 代码行

nvline

Crates.io Version Crates.io Downloads

您的 NVIDIA GPU 使用情况时间线。

cargo install nvline

功能

以下命令将每 1000 毫秒记录 nvidia-smi 输出的 100 行到 log1.jsonl

nvline --max-lines 100 --interval 1000 --file-path log1.jsonl
# 2024-06-21T04:20:58.576466Z  INFO nvline: name=NVIDIA A10G device=0 used=4 percent=4/23028 (0.02%)
# 2024-06-21T04:20:59.635555Z  INFO nvline: name=NVIDIA A10G device=0 used=4 percent=4/23028 (0.02%)
# 2024-06-21T04:21:00.691742Z  INFO nvline: name=NVIDIA A10G device=0 used=4 percent=4/23028 (0.02%)
# 2024-06-21T04:21:01.751656Z  INFO nvline: name=NVIDIA A10G device=0 used=4 percent=4/23028 (0.02%)

日志文件看起来像

{"driver_version":"545.23.08","index":0,"memory_free":22508,"memory_total":23028,"memory_used":4,"name":"NVIDIA A10G","temperature_gpu":30,"timestamp":1718943658}
{"driver_version":"545.23.08","index":0,"memory_free":22508,"memory_total":23028,"memory_used":4,"name":"NVIDIA A10G","temperature_gpu":30,"timestamp":1718943659}
{"driver_version":"545.23.08","index":0,"memory_free":22508,"memory_total":23028,"memory_used":4,"name":"NVIDIA A10G","temperature_gpu":30,"timestamp":1718943660}
{"driver_version":"545.23.08","index":0,"memory_free":22508,"memory_total":23028,"memory_used":4,"name":"NVIDIA A10G","temperature_gpu":30,"timestamp":1718943661}

命令行选项

nvline --help`
Usage: nvline [OPTIONS]

Options:
  -m, --max-lines <MAX_LINES>  Maximum number of lines to keep in the log file [default: 100]
  -i, --interval <INTERVAL>    Interval between log entries in milliseconds [default: 1000]
  -f, --file-path <FILE_PATH>  Path to the log file [default: gpu_log.jsonl]
  -h, --help                   Print help
  -V, --version                Print version

依赖项

~3–4.5MB
~79K SLoC