Worker Module

libEnsemble worker class

worker.worker_main(comm, sim_specs, gen_specs, libE_specs, workerID=None, log_comm=True, resources=None, executor=None)

Evaluates calculations given to it by the manager.

Creates a worker object, receives work from manager, runs worker, and communicates results. This routine also creates and writes to the workers summary file.

Parameters:
  • comm (communicator) – Comm object for manager communications

  • sim_specs (dict) – Parameters/information for simulation calculations

  • gen_specs (dict) – Parameters/information for generation calculations

  • libE_specs (dict) – Parameters/information for libE operations

  • workerID (int) – Manager assigned worker ID (if None, default is comm.rank)

  • log_comm (bool) – Whether to send logging over comm

  • resources (Resources)

  • executor (Executor)

Return type:

None

class worker.Worker(comm, dtypes, workerID, sim_specs, gen_specs, libE_specs)

The worker class provides methods for controlling sim and gen funcs

Object Attributes:

These are public object attributes.

Variables:
  • communicator (comm) – Comm object for manager communications

  • dtypes (dict) – Dictionary containing type information for sim and gen inputs

  • workerID (int) – The libensemble Worker ID

  • sim_specs (dict) – Parameters/information for simulation calculations

  • calc_iter (dict) – Dictionary containing counts for each type of calc (e.g. sim or gen)

Parameters:
  • comm (communicator)

  • dtypes (dtype[Any] | None | type[Any] | _SupportsDType[dtype[Any]] | str | tuple[Any, int] | tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | list[Any] | _DTypeDict | tuple[Any, Any])

  • workerID (int)

  • sim_specs (dict)

  • gen_specs (dict)

  • libE_specs (dict)

__init__(comm, dtypes, workerID, sim_specs, gen_specs, libE_specs)

Initializes new worker object

Parameters:
  • comm (communicator)

  • dtypes (dtype[Any] | None | type[Any] | _SupportsDType[dtype[Any]] | str | tuple[Any, int] | tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | list[Any] | _DTypeDict | tuple[Any, Any])

  • workerID (int)

  • sim_specs (dict)

  • gen_specs (dict)

  • libE_specs (dict)

Return type:

None

run()

Runs the main worker loop.

Return type:

None