diff --git a/osaca/osaca.py b/osaca/osaca.py index 7f5a606..d010bab 100755 --- a/osaca/osaca.py +++ b/osaca/osaca.py @@ -153,7 +153,8 @@ def create_parser(parser=None): type=int, default=10, help="Set timeout in seconds for LCD analysis. After timeout, OSACA will continue" - " its analysis with the dependency paths found up to this point. Defaults to 10.", + " its analysis with the dependency paths found up to this point. Defaults to 10." + " Set to -1 for no timeout.", ) parser.add_argument( "--verbose", "-v", action="count", default=0, help="Increases verbosity level." diff --git a/osaca/semantics/kernel_dg.py b/osaca/semantics/kernel_dg.py index 94a5dfc..2bff2be 100755 --- a/osaca/semantics/kernel_dg.py +++ b/osaca/semantics/kernel_dg.py @@ -2,12 +2,10 @@ import copy import time -from collections import defaultdict -from itertools import accumulate, chain, product +from itertools import chain from multiprocessing import Manager, Process, cpu_count import networkx as nx -from osaca.parser import AttrDict from osaca.semantics import INSTR_FLAGS, ArchSemantics, MachineModel @@ -123,22 +121,27 @@ class KernelDG(nx.DiGraph): ] for p in processes: p.start() - start_time = time.time() - while time.time() - start_time <= timeout: - if any(p.is_alive() for p in processes): - time.sleep(0.2) - else: - # all procs done - for p in processes: - p.join() - break - else: - self.timed_out = True - # terminate running processes + if (timeout == -1): + # no timeout for p in processes: - if p.is_alive(): - p.kill() p.join() + else: + start_time = time.time() + while time.time() - start_time <= timeout: + if any(p.is_alive() for p in processes): + time.sleep(0.2) + else: + # all procs done + for p in processes: + p.join() + break + else: + self.timed_out = True + # terminate running processes + for p in processes: + if p.is_alive(): + p.kill() + p.join() all_paths = list(all_paths) else: # sequential execution to avoid overhead when analyzing smaller kernels