Skip to content

Commit 5761912

Browse files
committed
fix(findgpu): remove first gpu from output
1 parent c480d5b commit 5761912

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

overlays/packages/findgpu/script.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# https://gist.github.com/afspies/7e211b83ca5a8902849b05ded9a10696
22
# https://discuss.pytorch.org/t/it-there-anyway-to-let-program-select-free-gpu-automatically/17560/13
33

4-
import subprocess
54
import random
5+
import subprocess
66

77

88
def run_cmd(cmd: str) -> str:
@@ -34,6 +34,9 @@ def get_free_gpu_indices():
3434
if __name__ == "__main__":
3535
free_gpus = get_free_gpu_indices()
3636

37+
# remove GPU 0 from the list
38+
free_gpus = [gpu for gpu in free_gpus if gpu != 0]
39+
3740
if len(free_gpus) == 0:
3841
print("100")
3942
else:

0 commit comments

Comments
 (0)