Reach the integrated-graphics check on a box with no nvidia-smi
This commit is contained in:
@@ -176,11 +176,12 @@ function vv_docker_stopped(): array {
|
|||||||
// per GPU, so splitting the whole output on commas (as this once did) runs the rows together
|
// per GPU, so splitting the whole output on commas (as this once did) runs the rows together
|
||||||
// and only ever describes GPU 0.
|
// and only ever describes GPU 0.
|
||||||
function vv_gpu_stats_all(): array {
|
function vv_gpu_stats_all(): array {
|
||||||
$out = shell_exec('nvidia-smi --query-gpu=index,uuid,name,memory.used,memory.total,utilization.gpu,temperature.gpu,power.draw,utilization.encoder,utilization.decoder --format=csv,noheader,nounits 2>/dev/null');
|
// No early return when nvidia-smi is absent: a box with no discrete card still has to reach
|
||||||
if (!$out) return [];
|
// the integrated-graphics check below. Returning here is what kept HOST2 reporting no GPU
|
||||||
|
// even after that check existed.
|
||||||
|
$out = shell_exec('nvidia-smi --query-gpu=index,uuid,name,memory.used,memory.total,utilization.gpu,temperature.gpu,power.draw,utilization.encoder,utilization.decoder --format=csv,noheader,nounits 2>/dev/null');
|
||||||
$gpus = [];
|
$gpus = [];
|
||||||
foreach (explode("\n", trim($out)) as $line) {
|
foreach (explode("\n", trim((string)$out)) as $line) {
|
||||||
if (!$line) continue;
|
if (!$line) continue;
|
||||||
$p = array_map('trim', explode(',', $line));
|
$p = array_map('trim', explode(',', $line));
|
||||||
if (count($p) < 10) continue;
|
if (count($p) < 10) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user