-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructs.py
68 lines (54 loc) · 2 KB
/
structs.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import datetime
"""
These classes are more or less 'static' (supposed to fit any synthesis tool).
For adding new stats to log -- use adhoc_fields.py
"""
class ExpDesc:
def __init__(self,
exp_name,
datetime_:datetime,
commit,
hardware,
note):
self.exp_name = exp_name
self.datetime = datetime_
self.commit = commit
self.hardware = hardware
self.note = note
def __str__(self):
return self.__class__.__name__ + str(self.__dict__)
class ToolRunParams:
def __init__(self, tool_cmd, tool_params, input_file, output_file, tool_log_file):
self.cmd = tool_cmd
self.params = tool_params
self.input_file = input_file
self.output_file = output_file
self.log_file = tool_log_file
def to_cmd_str(self): # TODO: clean: move out of here
return '{exec} {params} {input_file} {output}' \
.format(exec=self.cmd,
params=self.params,
input_file=self.input_file,
output='' if not self.output_file else ' -o ' + self.output_file)
def __str__(self):
return self.__class__.__name__ + str(self.__dict__)
class TimedRunParams:
def __init__(self, time_limit_sec, memory_limit_mb):
self.time_limit_sec = time_limit_sec
self.memory_limit_mb = memory_limit_mb
def __str__(self):
return self.__class__.__name__ + str(self.__dict__)
class RunResult:
def __init__(self,
total_time_sec: int or None,
circuit_size: int or None,
memory_mb: int or None,
is_realizable: str,
model: str or None):
self.total_time_sec = total_time_sec
self.circuit_size = circuit_size
self.memory_mb = memory_mb
self.is_realizable = is_realizable
self.model = model
def __str__(self):
return self.__class__.__name__ + str(self.__dict__)