mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2026-01-08 04:00:05 +01:00
added no timeout option
This commit is contained in:
@@ -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."
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user