GPU: Linux, count the number of GPUs
This commit is contained in:
parent
c044bd788c
commit
2284cde0d8
19
fetch
19
fetch
|
@ -835,7 +835,22 @@ getcpu () {
|
||||||
getgpu () {
|
getgpu () {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux")
|
"Linux")
|
||||||
gpu="$(lspci | grep -F "VGA")"
|
# Get the GPUs
|
||||||
|
gpu="$(lspci | grep -F "VGA" | uniq -c)"
|
||||||
|
|
||||||
|
# Count the number of GPUs
|
||||||
|
count=${gpu/ ??:*}
|
||||||
|
count=${count//[[:space:]]}
|
||||||
|
|
||||||
|
# If there's more than one gpu
|
||||||
|
# Display the count.
|
||||||
|
if [ "$count" -gt 1 ]; then
|
||||||
|
count=" x $count"
|
||||||
|
else
|
||||||
|
unset count
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Format the output
|
||||||
gpu=${gpu/* VGA compatible controller: }
|
gpu=${gpu/* VGA compatible controller: }
|
||||||
gpu=${gpu/(rev*)}
|
gpu=${gpu/(rev*)}
|
||||||
|
|
||||||
|
@ -923,6 +938,8 @@ getgpu () {
|
||||||
gpu=${gpu// Series}
|
gpu=${gpu// Series}
|
||||||
gpu=${gpu/\/*}
|
gpu=${gpu/\/*}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
gpu="${gpu}${count}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
Reference in New Issue