# GPU Power Limit Manager This bash script, named `gpu_power_limit.sh`, provides tools to manage the power limits of NVIDIA GPUs. It allows you to set, reset, or display power limits for all connected GPUs. ## Installation 1. **Clone the Repository:** ``` git clone gpu_power_limit cd gpu_power_limit ``` 2. **Make the Script Executable:** ``` chmod +x gpu_power_limit.sh ``` ## Usage The script accepts the following commands: - **Set Power Limit:** ``` ./gpu_power_limit.sh set ``` - `limit`: A numeric value in watts (e.g., `300`). - `percentage%`: A percentage reduction from the default limit (e.g., `15%`). - **Reset Power Limit:** ``` ./gpu_power_limit.sh reset ``` This command resets the power limit of all GPUs to their default values. - **Print Power Limits:** ``` ./gpu_power_limit.sh print ``` Displays the current, maximum, and minimum power limits for all GPUs. ### Examples - Set power limit to 250 watts for all GPUs: ``` ./gpu_power_limit.sh set 250 ``` - Reduce power limit by 10% for all GPUs: ``` ./gpu_power_limit.sh set 10% ``` - Reset all GPUs to their default power limits: ``` ./gpu_power_limit.sh reset ``` - Check current power limits: ``` ./gpu_power_limit.sh print ``` ## Requirements - NVIDIA GPUs with support for `nvidia-smi` command. - Bash shell. ## Notes - Ensure you have the necessary permissions to adjust GPU settings. You might need to run the script with `sudo` if you encounter permission issues. - The script checks if the new power limit is above the GPU's minimum power limit to prevent setting values too low for stable operation. ## License ``` # Copyright 2024 dvosler # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ``` ## Contributing - just ask or open an issue ## Acknowledgments - NVIDIA for the `nvidia-smi` tool which this script utilizes. Feel free to report issues or suggest improvements via the repository's issue tracker.