We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c480d5b commit 5761912Copy full SHA for 5761912
overlays/packages/findgpu/script.py
@@ -1,8 +1,8 @@
1
# https://gist.github.com/afspies/7e211b83ca5a8902849b05ded9a10696
2
# https://discuss.pytorch.org/t/it-there-anyway-to-let-program-select-free-gpu-automatically/17560/13
3
4
-import subprocess
5
import random
+import subprocess
6
7
8
def run_cmd(cmd: str) -> str:
@@ -34,6 +34,9 @@ def get_free_gpu_indices():
34
if __name__ == "__main__":
35
free_gpus = get_free_gpu_indices()
36
37
+ # remove GPU 0 from the list
38
+ free_gpus = [gpu for gpu in free_gpus if gpu != 0]
39
+
40
if len(free_gpus) == 0:
41
print("100")
42
else:
0 commit comments