From f40f0205d56579fe568540d9a69904cef158c32b Mon Sep 17 00:00:00 2001 From: Miquel Massot Date: Tue, 4 Jul 2023 17:16:17 +0100 Subject: [PATCH] Fix #3: Correct GPU utilisation --- scripts/gpu_usage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gpu_usage.sh b/scripts/gpu_usage.sh index d6715cc..b72de8d 100755 --- a/scripts/gpu_usage.sh +++ b/scripts/gpu_usage.sh @@ -25,7 +25,7 @@ get_platform() { get_gpu() { gpu=$(get_platform) if [[ "$gpu" == NVIDIA ]]; then - usage=$(nvidia-smi | grep '%' | awk '{ sum += $13 } END { printf("%d%%\n", sum / NR) }') + usage=$(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | awk '{ sum += $0 } END { printf("%s%%\n", sum / NR) }') else usage='unknown' fi