-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbaseline.py
More file actions
31 lines (24 loc) · 747 Bytes
/
baseline.py
File metadata and controls
31 lines (24 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import subprocess
import sys
from argparse import ArgumentParser, Namespace
import GPUtil
from threading import Thread
import time
class Monitor(Thread):
def __init__(self, delay):
super(Monitor, self).__init__()
self.stopped = False
self.delay = delay
self.start()
def run(self):
while not self.stopped:
GPUtil.showUtilization(True)
time.sleep(self.delay)
def stop(self):
self.stopped = True
monitor = Monitor(0.1)
parser = ArgumentParser(description="Training script parameters")
parser.add_argument("--quiet", action="store_true")
args = parser.parse_args(sys.argv[1:])
subprocess.call(f"python test.py {args.quiet}", shell=True)
monitor.stop()