qml.concurrency.executors.base.RemoteExec

class RemoteExec(max_workers=None, persist=False, **kwargs)[source]

Bases: ABC

Abstract base class for defining a task-based parallel executor backend.

This ABC is intended to provide the highest-layer abstraction in the inheritance tree.

Parameters:
  • max_workers (int) – The size of the worker pool. This value will directly control (given backend support) the number of concurrent executions that the backend can avail of. Generally, this value should match the number of physical cores on the executing system, or with the executing remote environment. Defaults to None, which defers to support provided by the child class.

  • persist (bool) – Indicates to the executor backend that the state should persist between calls. If supported, this allows a pre-configured device to be reused for several computations but removing the need to automatically shutdown. The pool may require manual shutdown upon completion of the work, even if the executor goes out-of-scope.

  • *args – Non keyword arguments to pass through to executor backend.

  • **kwargs – Keyword arguments to pass through to executor backend.

persist

Indicates whether the executor will maintain its configured state between calls.

size

The size of the worker pool for the given executor.

persist

Indicates whether the executor will maintain its configured state between calls.

size

The size of the worker pool for the given executor.

map(fn, *args, **kwargs)

Single iterable map for batching execution of fn over data entries.

shutdown()

Disconnect from executor backend and release acquired resources.

starmap(fn, args, **kwargs)

Single iterable map for batching execution of fn over data entries, with each entry being a tuple of arguments to fn.

submit(fn, *args, **kwargs)

Single function submission for remote execution with provided args.

abstract map(fn, *args, **kwargs)[source]

Single iterable map for batching execution of fn over data entries. Length of every entry in *args must be consistent. kwargs are assumed as broadcastable to each function call.

abstract shutdown()[source]

Disconnect from executor backend and release acquired resources.

abstract starmap(fn, args, **kwargs)[source]

Single iterable map for batching execution of fn over data entries, with each entry being a tuple of arguments to fn.

abstract submit(fn, *args, **kwargs)[source]

Single function submission for remote execution with provided args.