add multi gpu support, closes #1

This commit is contained in:
daniel
2020-08-02 12:37:13 +02:00
parent 1d48d195c5
commit 6aa2a76a90

View File

@@ -2,13 +2,17 @@
print_gpu_usage() {
function getGPUUsage() {
gpuUsage=$(nvidia-smi -q -d UTILIZATION | grep Gpu | awk '{print $3}')
gpuUsage=($(nvidia-smi -q -d UTILIZATION | grep Gpu | awk '{print $3}'))
}
getGPUUsage
if [ -z "$GpuUsage" ]; then
echo "$gpuUsage%"
else
gpuUsage=("${gpuUsage[@]/%/%}")
function join_by { local IFS="$1"; shift; echo "$*"; }
gpuUsage=`join_by " " ${gpuUsage[@]}`
if [ -z "$gpuUsage" ]; then
echo "-"
else
echo "$gpuUsage"
fi
}