Skip to content

Commit

Permalink
Set NVC_CONCURRENT_JOBS to value of num_threads argument
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg authored and LarsAsplund committed Jun 30, 2024
1 parent 1bad679 commit fbe8d06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/news.d/1036.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[NVC] VUnit now sets the ``NVC_CONCURRENT_JOBS`` environment variable to
the value of the ``--num-threads`` argument which allows ``nvc`` to
scale its worker thread count based on the number of concurrently
running simulations.
6 changes: 6 additions & 0 deletions vunit/sim_if/nvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def from_args(cls, args, output_path, **kwargs):
output_path=output_path,
prefix=prefix,
gui=args.gui,
num_threads=args.num_threads,
)

@classmethod
Expand All @@ -70,6 +71,7 @@ def __init__( # pylint: disable=too-many-arguments
self,
output_path,
prefix,
num_threads,
gui=False,
gtkwave_args="",
):
Expand All @@ -91,6 +93,10 @@ def __init__( # pylint: disable=too-many-arguments
if self.use_color:
environ["NVC_COLORS"] = "always"

# Allow NVC to scale its worker thread count based on the number
# of VUnit threads and the number of available CPUs.
environ["NVC_CONCURRENT_JOBS"] = str(num_threads)

def has_valid_exit_code(self): # pylint: disable=arguments-differ
"""
Return if the simulation should fail with nonzero exit codes
Expand Down

0 comments on commit fbe8d06

Please sign in to comment.