Skip to content

Commit

Permalink
fix(core): num_worker must be > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Licheng-Guo committed Oct 27, 2024
1 parent 85b1514 commit e6ecfbe
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tapa/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,20 @@ def worker(task: Task, idx: int) -> None:
msg = f"HLS failed for {task.name}"
raise RuntimeError(msg)

worker_num: int | None = None
worker_num = nproc()
if worker_num_str := os.getenv("TAPA_CONCURRENCY", None) is None:
worker_num = nproc()
else:
worker_num = int(worker_num_str)
if int(worker_num_str) > 0:
worker_num = int(worker_num_str)
else:
_logger.warning(
"TAPA_CONCURRENCY is set to %s, which is invalid; using %d",
worker_num_str,
worker_num,
)

_logger.info(
"spawn %d workers for parallel HLS synthesis of the tasks",
"spawn %d workers for parallel HLS synthesis of the tasks. Set the "
"TAPA_CONCURRENCY environment variable to change the number of workers",
worker_num,
)
with futures.ThreadPoolExecutor(max_workers=worker_num) as executor:
Expand Down

0 comments on commit e6ecfbe

Please sign in to comment.