Skip to main content

A (user-)friendly wrapper to nvidia-smi

Project description


nvsmifs

A user-friendly wrapper for nvidia-smi, forked from pmav99's repository, with added support for fan speed and power draw monitoring. This tool is particularly useful in multi-GPU systems, allowing you to filter GPUs based on resource usage (e.g., selecting the least utilized GPU).


Features

  • Enhanced GPU Monitoring: Includes fan speed and power draw metrics.
  • Resource-Based Filtering: Easily identify the least utilized GPU in your system.
  • Flexible Usage: Use as a CLI tool or integrate it as a Python library.

Table of Contents

  1. Usage
  2. Quick Example: GPU Info
  3. Prerequisites
  4. Installation
  5. Contributing
  6. License

Usage

CLI

Run the following commands to explore available options:

nvsmifs --help
nvsmifs ls --help
nvsmifs ps --help

Library

You can also use nvsmifs as a Python library for more advanced workflows:

import nvsmifs

gpus = nvsmifs.get_gpus()
available_gpus = nvsmifs.get_available_gpus()
gpu_processes = nvsmifs.get_gpu_processes()

Quick Example: GPU Info

Here's a simple Python function to display detailed GPU information:

import nvsmifs

def gpu_info():
    for gpu in nvsmifs.get_gpus():
        if gpu.display_active == 'Enabled':
            gpu_details = (
                f"ID: {gpu.id}, Power: {gpu.power_draw}W, "
                f"Name: {gpu.name}, Temp: {gpu.temperature}°C, "
                f"Fan Speed: {gpu.fan_speed}%, Utilization: {gpu.gpu_util}%"
            )
            print(gpu_details)

gpu_info()

Output example:

ID: 0, Power: 50W, Name: NVIDIA GTX 1080, Temp: 65°C, Fan Speed: 30%, Utilization: 20%

Prerequisites

Ensure the following requirements are met before using nvsmifs:

  • An NVIDIA GPU
  • nvidia-smi installed and accessible
  • Python 2.7 or 3.6+

Installation

Using pipx (Recommended)

The recommended installation method is via pipx. Install nvsmifs with:

pipx install nvsmifs

This creates a virtual environment in ~/.local/pipx/venvs/nvsmifs and adds the nvsmifs executable to ~/.local/bin.

Using pip

Alternatively, install directly with pip:

pip install --user nvsmifs

Contributing

Contributions are welcome! If you'd like to improve this project, please:

  1. Fork the repository.
  2. Create a feature branch.
  3. Submit a pull request with a clear description of your changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.


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

nvsmifs-1.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nvsmifs-1.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file nvsmifs-1.1.0.tar.gz.

File metadata

  • Download URL: nvsmifs-1.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.3 Linux/6.14.5-300.fc42.x86_64

File hashes

Hashes for nvsmifs-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e8dd2e1e53400df330489ac028833fc04612129ebfacc2513d970605d96c34b8
MD5 57126cf846877c2e3477cb17b5ca3a08
BLAKE2b-256 8e5ca5b2a2c378d679e524fb273d5a94922ab086f25ea3e31885db76078aa81f

See more details on using hashes here.

File details

Details for the file nvsmifs-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: nvsmifs-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.3 Linux/6.14.5-300.fc42.x86_64

File hashes

Hashes for nvsmifs-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e19ab4fe701eb61f566f55860b70def270b024d008699f2ee942186805849527
MD5 6a155e3a06934ffffa16096713fabbc7
BLAKE2b-256 db2522c482100685f3bfe294b6685a99bde19628095433c77076219255da9810

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