Skip to main content

A Python library to monitor temperatures for GeForce cards using nvidia-smi.

Project description

GeforceTempMonitor

GeforceTempMonitor is a Python-based library for monitoring NVIDIA GPU temperatures, specifically for GeForce cards. Since NVIDIA's NVML library only provides support for Tesla and Quadro GPUs, and does not natively support GeForce cards, this library abstracts the functionality of nvidia-smi to provide a straightforward way to query temperature data programmatically.

To address this limitation, GeforceTempMonitor parses and processes data from nvidia-smi, allowing users to monitor GeForce GPU temperatures seamlessly.

With GeforceTempMonitor, you can track the temperature of your GPUs in real-time or as part of a monitoring script, making it easier to manage and optimize your system's performance.


Disclaimer

This project is not affiliated with NVIDIA in any way.

Adjusting GPU-related settings or running custom scripts can have unintended consequences, including hardware overheating or system instability. Use this library at your own risk, and make sure you test it thoroughly in your environment before relying on it for critical applications.


Installation

You can install the package using pip:

pip install geforce-temp-monitor

Usage

Command-Line Interface

To monitor GPU temperatures directly, run the following command:

geforce_temp_monitor

This will output the temperature of all available GPUs to the console in real-time.

Custom Interval

You can specify the interval (in seconds) for monitoring:

geforce_temp_monitor --interval <seconds>

Replace <seconds> with your desired interval.


Python Library

The library can also be used programmatically within your own Python scripts:

from geforce_temp_monitor import get_gpu_temperatures

# Get a dictionary of GPU temperatures
temperatures = get_gpu_temperatures()

# Print the temperature of each GPU
for gpu, temp in temperatures.items():
    print(f"GPU {gpu}: {temp}°C")

Setting Up on Linux

To ensure nvidia-smi is available in your environment, follow these steps:

Install NVIDIA Drivers

  1. Install the latest NVIDIA drivers for your GeForce GPU from NVIDIA's driver page.

  2. Verify that nvidia-smi is working by running:

    nvidia-smi
    

    You should see a summary of your GPU(s) along with metrics like temperature and utilization.


Running as a Systemd Service

To enable continuous monitoring, you can set up GeforceTempMonitor as a systemd daemon service.

Steps

  1. Create a file called geforce_temp_monitor.service with the following content:

    [Unit]
    Description=GPU Temperature Monitor
    After=multi-user.target
    
    [Service]
    Type=simple
    ExecStart=/usr/bin/python3 -m geforce_temp_monitor --interval 10
    Restart=always
    
    [Install]
    WantedBy=multi-user.target
    
  2. Copy the service file to the systemd folder:

    sudo cp geforce_temp_monitor.service /etc/systemd/system/
    
  3. Reload the systemd configuration:

    sudo systemctl daemon-reload
    
  4. Enable the service to start on boot:

    sudo systemctl enable geforce_temp_monitor
    
  5. Start the service:

    sudo systemctl start geforce_temp_monitor
    
  6. Check the service status:

    sudo systemctl status geforce_temp_monitor
    

Contributing

Contributions to GeforceTempMonitor are welcome! To contribute:

  1. Fork the repository on GitHub.
  2. Make your changes and submit a pull request.
  3. Open an issue to discuss any ideas.

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

geforcetempmonitor-0.2.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

GeforceTempMonitor-0.2.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file geforcetempmonitor-0.2.0.tar.gz.

File metadata

  • Download URL: geforcetempmonitor-0.2.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for geforcetempmonitor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 70b212a655718cacf497ba73dff4316a14cfb04de69fc951f95d1e433cc0f44d
MD5 30c3e42ebb0f86fc6011968033b85e61
BLAKE2b-256 26ef824fc4c12db02375ef9dd99c7c2e5b661cc7bbb1da743c6ad46654233d83

See more details on using hashes here.

File details

Details for the file GeforceTempMonitor-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for GeforceTempMonitor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d0d8c804d3629fd4bbd7cee2e5a2377a96fd62cbf0a9a24ce02a1f0c4956049
MD5 2adbf7751a6d505d112678521cd9d173
BLAKE2b-256 901ac8b969e22ad6f1713e097f1fcd4a2040da87c3bb0d1232803e522adb7c73

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