Skip to content

Conversation

@dev-onejun
Copy link
Contributor

Hello!

I want to suggest to show gpus status independently from the experience that each gpu runs different jobs, if there are multiple gpus. (especially when users share the machine)

Please refer the attached image below.

Screenshot from 2025-12-09 12-11-24

It still support a one gpu as well.

Screenshot from 2025-12-09 12-23-38

Any additional suggestions are welcome.

Thank you.

@coderabbitai
Copy link

coderabbitai bot commented Dec 9, 2025

📝 Walkthrough

Walkthrough

Three GPU monitoring shell scripts changed output formatting from plain numeric strings to pipe-delimited, labeled strings for NVIDIA GPU paths; logic and gating remain unchanged.

Changes

Cohort / File(s) Summary
GPU Metrics Output Formatting
scripts/gpu_power.sh, scripts/gpu_ram_info.sh, scripts/gpu_usage.sh
Reformatted NVIDIA-path outputs to pipe-delimited strings. Power now prefixed with Power and emitted as `

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Areas to review:
    • Confirm downstream parsers (e.g., percent/length normalizers) handle the new pipe-delimited format.
    • Verify awk expressions produce correct values across varied GPU states (multiple GPUs, zero/edge values).
    • Check newline/trailing-pipe behavior does not break consumers.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main feature: adding support for showing NVIDIA GPU status individually for multiple GPUs, which matches the changeset modifications to output formatting in GPU-related scripts.
Description check ✅ Passed The description explains the motivation (showing GPU status independently for multi-GPU setups and shared machines) and includes example screenshots demonstrating the feature, which directly relates to the pipe-delimited output format changes in the GPU scripts.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/gpu_usage.sh (1)

46-46: Verify compatibility with normalize_percent_len for pipe-delimited format.

The change from a plain percentage to pipe-delimited format |<percentage>%| is appropriate for multi-GPU support. Confirm that the normalize_percent_len function (line 54) correctly handles the new format with embedded pipes for multiple values.

Additionally, consider adding error handling if nvidia-smi fails or returns no output, as the script currently has no guard against malformed input.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b762b3 and 57539be.

📒 Files selected for processing (3)
  • scripts/gpu_power.sh (1 hunks)
  • scripts/gpu_ram_info.sh (1 hunks)
  • scripts/gpu_usage.sh (1 hunks)
🔇 Additional comments (2)
scripts/gpu_power.sh (1)

47-47: Clarify output format: echo "Power" inclusion in usage variable may create malformed output.

Lines 47 and 49 include echo "Power" in the command chain that sets the usage variable. This produces a multi-line output where "Power" appears on the first line and the pipe-delimited metrics on subsequent lines. When echoed in main() (line 74), this produces: GPU Power\n|<values>|, which differs from the pipe-delimited format in other scripts.

Is the "Power" label intentional as part of the usage output, or should it be handled separately? Please verify this matches the intended output format shown in the PR screenshots.

Also applies to: 49-49

scripts/gpu_ram_info.sh (1)

45-45: Add explicit field separator for CSV parsing in awk to improve robustness and clarity.

Line 45 uses awk without specifying a field separator when parsing CSV output from nvidia-smi. While the implicit numeric coercion of $0 currently works, explicitly setting -F ', *' and using $1 instead of $0 follows CSV parsing best practices and prevents fragility if input format varies. Apply the suggested diff to improve code maintainability.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
scripts/gpu_power.sh (1)

47-47: Fix awk field reference in power percentage calculation.

Line 47 uses $0 / $2 * 100 in the awk expression, but with -F ', *' field separator, $0 is the entire input line. The percentage should divide the first field (power draw) by the second field (power limit). Change $0 / $2 * 100 to $1 / $2 * 100.

This issue was flagged in a prior review but the $0 reference was not corrected.

-      usage=$(echo "Power" && nvidia-smi --query-gpu=power.draw,power.limit --format=csv,noheader,nounits | awk -F ', *' '{ printf("|%d%%", $0 / $2 * 100) }' && echo "|")
+      usage=$(echo "Power" && nvidia-smi --query-gpu=power.draw,power.limit --format=csv,noheader,nounits | awk -F ', *' '{ printf("|%d%%", $1 / $2 * 100) }' && echo "|")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57539be and 306debc.

📒 Files selected for processing (2)
  • scripts/gpu_power.sh (1 hunks)
  • scripts/gpu_ram_info.sh (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
scripts/gpu_ram_info.sh (1)
scripts/utils.sh (2)
  • normalize_percent_len (26-35)
  • get_tmux_option (3-12)
🪛 Shellcheck (0.11.0)
scripts/gpu_ram_info.sh

[warning] 50-50: used_accuracy appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 51-51: total_accuracy appears unused. Verify use (or export if used externally).

(SC2034)

🔇 Additional comments (2)
scripts/gpu_power.sh (1)

49-49: Field references in wattage format are correct.

Line 49 correctly uses $1 and $2 in the printf format string. No changes needed here.

scripts/gpu_ram_info.sh (1)

50-51: Verify variable usage for used_accuracy and total_accuracy.

Lines 50–51 assign used_accuracy and total_accuracy from tmux options. Confirm whether these variables are referenced after these lines (particularly in line 52's printf format). If unused, remove the assignments; if intended for formatting, apply them to the output.

@dev-onejun
Copy link
Contributor Author

Relevant PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant