wookayin / gpustat

📊 A simple command-line utility for querying and monitoring GPU status

Home Page:https://pypi.python.org/pypi/gpustat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON output

wookayin opened this issue · comments

JSON output

Partly included in v0.3.0

When the json output is stable, maybe we can detach the data collecting module and display module. Then we can request GPU usages from different remote data collecting nodes via HTTP or something else.

Exactly, I am hoping to decouple them so that we can collect and display GPU usages from different machines. Working on these, so stay tuned :-)

Any news on this? Wouldn't mind giving a helping hand.

I'd like to recommend an NVML binding for Python to collect GPU information rather than nvidia-smi. This library would significantly simplify the code base for information gathering.

https://github.com/jonsafari/nvidia-ml-py

@Stonesjtu Quite agree with you. It provides more information, and we could turn gpustat into a human-friendly wrapper with cleaner abstraction, providing monitoring functionalities as well. For JSON output formats, I plan to make it fully compatible with a XML format from nvidia-smi -q -x.

I'm trying to move the nvidia-smi API to nvidia-ml-py

Update: you may like to review my PR #17

JSON output is a great feature!

A few notes on the current implementation:

  • Fields with a dot (like utilization.gpu) make them harder to use in many JSON clients (like jq).
  • Numeric fields could use numeric values instead of strings

@gyscos I think fileds with dot can be naturally organized into sub-dict. e.g.

{
'utilization': 
  {
  'gpu': 40,
  'memory': 30,
  }
}

I plan to make a few of breaking changes towards 1.0, such as units and use of numerical values.

would it be possible to get driver_version and cuda_version (if available) in the json output?

@cceyda driver version has been added into the JSON output.

However, cuda version isn't something gpustat cannot retrieve from querying nvidia driver. The cuda runtime may vary by applications and dynamic libraries being loaded. Please refer to https://stackoverflow.com/questions/9727688/how-to-get-the-cuda-version for how to get the cuda version.

There won't be breaking changes in the units (e.g. MB vs bytes) but later we will add a flag/option to specify the units or to customize the JSON schema.