Running mosaic
- mosaic.run(main, *args, **kwargs)[source]
Initialise the runtime and then run the
main
in it.- Parameters
main (callable) – Entry point for mosaic.
args (tuple, optional) – Arguments to mosaic.init.
kwargs (optional) – Keyword arguments to mosaic.init.
- mosaic.init(runtime_type='head', runtime_indices=(), address=None, port=None, parent_id=None, parent_address=None, parent_port=None, monitor_address=None, monitor_port=None, num_workers=1, num_threads=None, mode='local', monitor_strategy='round-robin', log_level='info', profile=False, node_list=None, asyncio_loop=None, wait=False, **kwargs)[source]
Starts the global mosaic runtime.
- Parameters
runtime_type (str, optional) – Type of runtime to instantiate, defaults to
head
.runtime_indices (tuple, optional) – Indices associated with the runtime, defaults to None.
address (str, optional) – Address to use for the runtime, defaults to None. If None, the comms will try to guess the address.
port (int, optional) – Port to use for the runtime, defaults to None. If None, the comms will test ports until one becomes available.
parent_id (str, optional) – UID of the parent runtime, if any.
parent_address (str, optional) – Address of the parent runtime, if any.
parent_port (int, optional) – Port of the parent runtime, if any.
monitor_address (str, optional) – Address of the monitor to connect to.
monitor_port (int, optional) – Port of the monitor to connect to.
num_workers (int, optional) – Number of workers to instantiate in each node, defaults to 1.
num_threads (int, optional) – Number of threads to assign to each worker, defaults to the number of available cores over
num_workers
.mode (str, optional) – Mode of the runtime, defaults to
local
.monitor_strategy (str, optional) – Strategy used by the monitor to allocate tessera, defaults to round robin.
log_level (str, optional) – Log level, defaults to
info
.profile (bool, optional) – Whether to start the profiler, defaults to False.
node_list (list, optional) – List of available node addresses to connect to.
asyncio_loop (object, optional) – Async loop to use in our mosaic event loop, defaults to new loop.
wait (bool, optional) – Whether or not to return control to calling frame, defaults to False.
kwargs (optional) – Extra keyword arguments.