Skip to content

Commit

Permalink
Add option to suppress output
Browse files Browse the repository at this point in the history
  • Loading branch information
sasha0552 authored Mar 26, 2024
1 parent a96df3d commit 39db1d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions nvidia_pstate/scripts/nvidia_pstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def query_pstate(args):

# Function to specify performance state
def set_pstate(args):
nvidia_pstate.set_pstate(args.id, args.perf_state)
nvidia_pstate.set_pstate(args.id, args.perf_state, silent=args.silent)


def main():
Expand All @@ -27,6 +27,7 @@ def main():
parser.add_argument("-i", "--id", type=int, nargs="+", help="target a specific GPU")
parser.add_argument("-ps", "--perf-state", type=int, help="specify performance state")
parser.add_argument("-q", "--query", action="store_true", help="list available performance states")
parser.add_argument("-s", "--silent", action="store_true", help="suppress output messages")
parser.add_argument("-v", "--version", action="version", version=f"%(prog)s {__version__}")

# Parse command-line arguments
Expand All @@ -35,7 +36,7 @@ def main():
# Execute the appropriate function
if args.perf_state is not None:
set_pstate(args)
elif args.query is not None:
elif args.query is not None and args.query:
query_pstate(args)
else:
parser.print_help()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ requires = [
[project]
description = "A library and CLI utilities for managing performance states of NVIDIA GPUs."
name = "nvidia_pstate"
version = "1.0.3"
version = "1.0.4"
readme = "README.md"

authors = [
Expand Down

0 comments on commit 39db1d1

Please sign in to comment.