Skip to content

Commit

Permalink
#18 Name from sfs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcere committed Dec 18, 2024
1 parent ecfa419 commit a2e48c6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/greedy/greedy_new_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ class SMSgreedy:

def __init__(self, json_format: SMS_T):
self.debug_mode: bool = True

self.name = json_format["name"]
# How many elements are placed in the correct position and cannot be moved further in a computation
self.fixed_elements: int = 0
self._user_instr: List[instr_JSON_T] = json_format['user_instrs']
Expand Down Expand Up @@ -646,6 +648,7 @@ def greedy(self) -> List[instr_id_T]:
self.fixed_elements = 0

self.debug_logger.debug_loop(cstate.dep_graph, optg, cstate)
self.debug_logger.debug_message(self.name)

# Case 1: Top of the stack must be removed, as it appears more time it is being used
if var_top is not None and cstate.stack_var_copies_needed[var_top] < 0:
Expand Down Expand Up @@ -1160,12 +1163,12 @@ def greedy_standalone(sms: Dict) -> Tuple[str, float, List[str]]:
return optimization_outcome, usage_stop.ru_utime + usage_stop.ru_stime - usage_start.ru_utime - usage_start.ru_stime, seq_ids


def greedy_from_file(filename: str) -> Tuple[SMS_T, List[instr_id_T]]:
def greedy_from_file(filename: str) -> Tuple[SMS_T, List[instr_id_T], str]:
logging.basicConfig(level=logging.DEBUG)
with open(filename, "r") as f:
sfs = json.load(f)
outcome, time, ids = greedy_standalone(sfs)
return sfs, ids
return sfs, ids, outcome


if __name__ == "__main__":
Expand Down

0 comments on commit a2e48c6

Please sign in to comment.