#gpu #command-line #nvidia #command-line-tool #record #timeline #output

app nvline

A simple command line tool to record your gpu usage

1 unstable release

0.1.0 Jun 22, 2024

#911 in Command line utilities

23 downloads per month

MIT license

12KB
197 lines

nvline

Crates.io Version Crates.io Downloads

your nvidia gpu usage timeline.

cargo install nvline

Features

the following command will record 100 lines of nvidia-smi output every 1000 milliseconds to 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%)

logfile looks like

{"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}

cli options

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

Dependencies

~2.8–4MB
~73K SLoC