Skip to main content

Query nvidia-smi and return list of dictionaries with queried attributes

Project description

# pynvidiasmi Query nvidia-smi command and return its output as a list of dictionaries.

`python >> from pynvidiasmi import query, get_available_gpus >> # 'query' returns a dictionary with the queried fields >> # Possible fields can be obtained via nvidia-smi --help-query-gpu >> query(fields=["index", "name", "pstate", "utilization.gpu", "utilization.memory"]) [{'index': 0, 'name': 'A100-SXM4-40GB', 'pstate': 'P0', 'utilization.gpu': 0, 'utilization.memory': 0}, {'index': 1, 'name': 'A100-SXM4-40GB', 'pstate': 'P0', 'utilization.gpu': 47, 'utilization.memory': 10}] >> # 'get_available_gpus' queries the gpu 'times' times, waiting 'sleep' seconds between queries >> # and returns the GPUs that satisfy the memory and compute constraints all the times. >> # This helps in obtaining the GPUs that are available for starting a computation. >> get_available_gpus(memory_threshold=0, compute_threshold=0, times=3, sleep=1.0) [0] `

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pynvidiasmi-1.0.1.tar.gz (14.4 kB view details)

Uploaded Source

File details

Details for the file pynvidiasmi-1.0.1.tar.gz.

File metadata

  • Download URL: pynvidiasmi-1.0.1.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for pynvidiasmi-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4d8eef604f4b3173353448940e9a5aab951866e26f88aaff4ca7b6ed2d8e34d8
MD5 c3ff95bdbfa52137c6814d5d54418e9b
BLAKE2b-256 9c9dabc52546a1db4c10d1516a977bd0f172ce7936c1c79360d87a12ea5df89c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page