gpustat icon indicating copy to clipboard operation
gpustat copied to clipboard

JSON output

Open wookayin opened this issue 7 years ago • 11 comments

wookayin avatar Mar 18 '17 21:03 wookayin

Partly included in v0.3.0

wookayin avatar Apr 10 '17 20:04 wookayin

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.

Stonesjtu avatar May 05 '17 07:05 Stonesjtu

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 :-)

wookayin avatar May 05 '17 20:05 wookayin

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

rubenvereecken avatar Aug 11 '17 14:08 rubenvereecken

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 avatar Aug 12 '17 03:08 Stonesjtu

@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.

wookayin avatar Aug 12 '17 03:08 wookayin

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

Update: you may like to review my PR #17

Stonesjtu avatar Aug 13 '17 02:08 Stonesjtu

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 avatar Aug 28 '17 18:08 gyscos

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

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

Stonesjtu avatar Aug 29 '17 02:08 Stonesjtu

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

wookayin avatar Jul 23 '19 21:07 wookayin

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

cceyda avatar Sep 25 '20 08:09 cceyda

@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.

wookayin avatar Aug 11 '22 14:08 wookayin

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.

wookayin avatar Sep 04 '22 23:09 wookayin