Syllo / nvtop

GPU & Accelerator process monitoring for AMD, Apple, Huawei, Intel, NVIDIA and Qualcomm
Other
7.79k stars 287 forks source link

fix multiple gpus selection #188

Closed cfwen closed 1 year ago

cfwen commented 1 year ago

since line 73 has moved options backward by one space (towards head) when doNotMonitor is true, idx shouldn't increase in such case.

For example, we have two gpus with [1:doNotMonitor:false, 2:doNotMonitor:true], current code would first check gpu1 and move it to the tail, after that, gpus' options would become [2:doNotMonitor:true, 1:doNotMonitor:false]. Then in next iteration, code will check gpu1 again and gpu2's option is ignored.

Syllo commented 1 year ago

You are right, thanks.

That wasn't the only error in this function: in the second loop idx was decremented instead of the inner loop induction variable!