concurrent.py

openmdao.util.concurrent.concurrent_eval_lb(func, cases, comm, broadcast=False)[source]

Runs a load balanced version of the given function, with the master rank (0) sending a new case to each worker rank as soon as it has finished its last case.

Args:

func : function

The function to execute in workers.

cases : collection of function args

Entries are assumed to be of the form (args, kwargs) where kwargs are allowed to be None and args should be a list or tuple.

com : MPI communicator or None

The MPI communicator that is shared between the master and workers. If None, the function will be executed serially.

broadcast : bool, optional

If True, the results will be broadcast out to the worker procs so that the return value of concurrent_eval_lb will be the full result list in every process.