gpustat icon indicating copy to clipboard operation
gpustat copied to clipboard

Let --gpuname-width clip gpu names longer than the specified width

Open gabriel-vanzandycke opened this issue 7 years ago • 3 comments

I guess the behaviour should change the output from gpustat [0] GeForce GTX 1080 Ti | 32'C, 0 % | 10795 / 11172 MB

to gpustat --gpuname-width 10 [0] GeForce GT | 32'C, 0 % | 10795 / 11172 MB

but it doesn't seem to do anything

version: gpustat 0.5.0.dev1 os: Ubuntu 16.04.5 LTS python: Python 3.6.4 :: Anaconda, Inc.

gabriel-vanzandycke avatar Sep 06 '18 07:09 gabriel-vanzandycke

The actual name width is calculated as in: https://github.com/wookayin/gpustat/blob/f39d9c9a22e73b574be179e73db70d7b4e4778c2/gpustat/core.py#L435

The name of this option should be something like min-gpuname-width. Perhaps it's assumed that user always want the whole name. So could you tell us how would you want to get a partial gpu name.

Stonesjtu avatar Sep 08 '18 14:09 Stonesjtu

So could you tell us how would you want to get a partial gpu name.

Well I am facing the same issue. In my case I have a narrow screen and all GPUs have the same name, so I would prefer to be able to hide the entire column.

I think a good behavior for --gpuname-width (and probably more intuitive), is to use the value to define the number of characters to display, so it will crop/clip the rest. Hence, a value of 0 will "hide" the column, but it also can satisfies other user preferences about how much to display.

ajason08 avatar Jul 24 '20 20:07 ajason08

@gabriel-vanzandycke @ajason08 Thanks for your suggestion. I'm considering changing the behavior to clipping as you suggested as a part of v1.0 release. Let me work on that if I have some extra cycle (contributions are still welcome).

wookayin avatar Jul 27 '20 06:07 wookayin

This now has been implemented and will be a part of v1.0 release (since it's a kind of breaking change).

Longer GPU names will truncate at left, because GPU cards are better distinguishable with suffixes rather than prefixes. For example:

❯❯❯ gpustat
[0] NVIDIA GeForce GTX TITAN X | 67°C,  77 % |  1972 / 12212 MB | ...
❯❯❯ gpustat --gpuname-width 10 
[0] …X TITAN X | 67°C,  77 % |  1972 / 12212 MB | ...
❯❯❯ gpustat --gpuname-width 0 
[0]  67°C,  70 % |  1972 / 12212 MB | ...

wookayin avatar Aug 08 '22 19:08 wookayin