Skip to content

Added option to hide terminal window#52

Open
PycraftDeveloper wants to merge 1 commit intoanderskm:masterfrom
PycraftDeveloper:master
Open

Added option to hide terminal window#52
PycraftDeveloper wants to merge 1 commit intoanderskm:masterfrom
PycraftDeveloper:master

Conversation

@PycraftDeveloper
Copy link
Copy Markdown

This simple update hides the terminal window pop-up that appears every time the GPU's resources are collected by using a different method for calling Nvidia-smi. This should not break compatibility with dependencies or introduce incompatibilities with different operating systems.

MagicalTux added a commit to MagicalTux/gputil that referenced this pull request Apr 17, 2026
Adopts and combines three upstream proposals:
  - anderskm#39: pci_bus attribute
  - anderskm#47: core_clock, memory_clock, vbios_version,
                        fan_speed, power_draw, power_limit
  - anderskm#52: hide_terminal_pop_up kwarg to suppress the
                        Windows console window via CREATE_NO_WINDOW

The getGPUs parser is rewritten from the original for/if-elif-else
loop into direct keyword construction of GPU, and pulls the field
list out into a module-level tuple so the query and the assignments
stay visibly in sync. All new numeric fields go through
safeFloatCast so the "[Not Supported]" / "[N/A]" sentinels some
sensors emit (fan on datacenter cards, clocks on locked GPUs) become
NaN instead of crashing the parser. pci.bus is hex with an "0x"
prefix and gets its own cast that returns None on malformed input.

The GPU constructor keeps the original positional parameters intact
and takes the seven new fields as keyword-only arguments with None
defaults, so existing callers that construct GPU directly keep
working. The hide_terminal_pop_up kwarg is a no-op on non-Windows
platforms.

Fake nvidia-smi fixture and integration tests updated to cover the
new attributes end-to-end, including the fan-less datacenter case
and the new kwarg.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant