diff --git a/docs/news.d/1036.feature.rst b/docs/news.d/1036.feature.rst new file mode 100644 index 000000000..740aeefec --- /dev/null +++ b/docs/news.d/1036.feature.rst @@ -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. diff --git a/vunit/sim_if/nvc.py b/vunit/sim_if/nvc.py index 4081944dc..8f64ecae3 100644 --- a/vunit/sim_if/nvc.py +++ b/vunit/sim_if/nvc.py @@ -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 @@ -70,6 +71,7 @@ def __init__( # pylint: disable=too-many-arguments self, output_path, prefix, + num_threads, gui=False, gtkwave_args="", ): @@ -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