diff toolbox/GPUselect.py @ 1:74fe58ff55a5 draft default tip

planemo upload for repository https://github.com/HMS-IDAC/UnMicst commit e14f76a8803cab0013c6dbe809bc81d7667f2ab9
author goeckslab
date Wed, 07 Sep 2022 23:10:14 +0000
parents 6bec4fef6b2e
children
line wrap: on
line diff
--- a/toolbox/GPUselect.py	Fri Mar 12 00:17:29 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-import subprocess, re
-import numpy as np
-
-def pick_gpu_lowest_memory():
-    output = subprocess.Popen("nvidia-smi", stdout=subprocess.PIPE, shell=True).communicate()[0]
-    output=output.decode("ascii")
-    gpu_output = output[output.find("Memory-Usage"):]
-        # lines of the form
-        # |    0      8734    C   python                                       11705MiB |
-    memory_regex = re.compile(r"[|]\s+?\D+?.+[ ](?P<gpu_memory>\d+)MiB /")
-    rows = gpu_output.split("\n")
-    result=[]
-    for row in gpu_output.split("\n"):
-        m = memory_regex.search(row)
-        if not m:
-            continue
-        gpu_memory = int(m.group("gpu_memory"))
-        result.append(gpu_memory)
-    return np.argsort(result)[0]
\ No newline at end of file