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.1.0.tar.gz (4.1 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.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for geforcetempmonitor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7378cc3123b2fa459a525848e1a32ef25463da60d5462a2f644709d05530c504
MD5 f97ea526ea572939a91b5caeeae66922
BLAKE2b-256 3cf677f23aaeeabe699f82e9bbbc607f9a1431293891dbbe1fee50c57cb485f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for GeforceTempMonitor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5701a5d0e2026302325a8dc0fc72399e4f0ce422c8cb842c9fd42d9f61fd6263
MD5 098126eb4987f4d8d84ac0cfe119c022
BLAKE2b-256 fee654351d42bae5fb9ad523052c202d35616f240455e4e4fe395ab136a818f3

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