Skip to content

Commit 640d6de

Browse files
committed
[lit] Do not create semaphores when we do not need them
Parallelism groups and semaphores are only required for parallel execution. llvm-svn: 375055
1 parent bb98234 commit 640d6de

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

llvm/utils/lit/lit/run.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ class Run(object):
1919
def __init__(self, lit_config, tests):
2020
self.lit_config = lit_config
2121
self.tests = tests
22-
# Set up semaphores to limit parallelism of certain classes of tests.
23-
self.parallelism_semaphores = {
24-
k : NopSemaphore() if v is None else
25-
multiprocessing.BoundedSemaphore(v)
26-
for k, v in lit_config.parallelism_groups.items()}
2722

2823
def execute_tests(self, progress_callback, workers, max_time):
2924
"""
@@ -76,14 +71,18 @@ def _execute_in_parallel(self, workers, max_time):
7671
if max_time:
7772
deadline = time.time() + max_time
7873

74+
semaphores = {
75+
k: NopSemaphore() if v is None else
76+
multiprocessing.BoundedSemaphore(v) for k, v in
77+
self.lit_config.parallelism_groups.items()}
78+
7979
# Start a process pool. Copy over the data shared between all test runs.
8080
# FIXME: Find a way to capture the worker process stderr. If the user
8181
# interrupts the workers before we make it into our task callback, they
8282
# will each raise a KeyboardInterrupt exception and print to stderr at
8383
# the same time.
8484
pool = multiprocessing.Pool(workers, lit.worker.initializer,
85-
(self.lit_config,
86-
self.parallelism_semaphores))
85+
(self.lit_config, semaphores))
8786

8887
# Install a console-control signal handler on Windows.
8988
if lit.util.win32api is not None:

0 commit comments

Comments
 (0)