qml.concurrency.executors.base.IntExec¶
- class IntExec(max_workers=None, persist=False, **kwargs)[source]¶
Bases:
RemoteExec
,ABC
Executor class for native Python library concurrency support.
This class is intended to be used as the parent-class for building Python-native executors, allowing an ease of distinction from the external-based classes implemented using
ExtExec
.- 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
, leaving interpretation to 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.
Attributes
Indicates whether the executor will maintain its configured state between calls.
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.
Methods
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)¶
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()¶
Disconnect from executor backend and release acquired resources.
- abstract 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.
- abstract submit(fn, *args, **kwargs)¶
Single function submission for remote execution with provided args.