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
-
Install the latest NVIDIA drivers for your GeForce GPU from NVIDIA's driver page.
-
Verify that
nvidia-smiis 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
-
Create a file called
geforce_temp_monitor.servicewith 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
-
Copy the service file to the systemd folder:
sudo cp geforce_temp_monitor.service /etc/systemd/system/
-
Reload the systemd configuration:
sudo systemctl daemon-reload
-
Enable the service to start on boot:
sudo systemctl enable geforce_temp_monitor
-
Start the service:
sudo systemctl start geforce_temp_monitor
-
Check the service status:
sudo systemctl status geforce_temp_monitor
Contributing
Contributions to GeforceTempMonitor are welcome! To contribute:
- Fork the repository on GitHub.
- Make your changes and submit a pull request.
- Open an issue to discuss any ideas.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7378cc3123b2fa459a525848e1a32ef25463da60d5462a2f644709d05530c504
|
|
| MD5 |
f97ea526ea572939a91b5caeeae66922
|
|
| BLAKE2b-256 |
3cf677f23aaeeabe699f82e9bbbc607f9a1431293891dbbe1fee50c57cb485f3
|
File details
Details for the file GeforceTempMonitor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: GeforceTempMonitor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5701a5d0e2026302325a8dc0fc72399e4f0ce422c8cb842c9fd42d9f61fd6263
|
|
| MD5 |
098126eb4987f4d8d84ac0cfe119c022
|
|
| BLAKE2b-256 |
fee654351d42bae5fb9ad523052c202d35616f240455e4e4fe395ab136a818f3
|