mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 12:29:19 -08:00
11 lines
332 B
Bash
Executable file
11 lines
332 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
SMI_OUTPUT="$(nvidia-smi --query-gpu=memory.used,memory.total --format=csv,noheader,nounits)"
|
|
|
|
echo "$SMI_OUTPUT" | while IFS=", " read -r usedvmem totalvmem
|
|
do
|
|
PERCENTAGE=$(echo "scale=1; (${usedvmem} / ${totalvmem}) * 100" | bc)
|
|
echo "${usedvmem}/${totalvmem}MiB (${PERCENTAGE}%)"
|
|
done
|