Parallel Timeline¶
- class parallel.src.p_timeline.ParallelTimeline(lookahead: int, stop_time=inf, formalism='ket_vector', qm_ip=None, qm_port=None)¶
Class for a simulation timeline with parallel computation.
The Parallel Timeline acts behaves similarly to the Timeline class, maintaining and executing a queue of events. There is one Parallel Timeline per simulation process. Each timeline controls a subset of the simulated network nodes. For events executed on nodes belonging to other timelines, an event buffer is maintained. These buffers are exchanged between timelines at regular synchronization intervals. All Parallel Timelines in a simulation communicate with a Quantum Manager Server for shared quantum states.
- id¶
rank of MPI process running the Parallel Timeline instance.
- Type:
int
- foreign_entities¶
mapping of object names on other processes to process id.
- Type:
Dict[str, int]
- event_buffer¶
stores events for execution on foreign entities; swapped during synchronization.
- Type:
List[List[Event]]
- lookahead¶
defines width of time window for execution (simulation time between synchronization).
- Type:
int
- quantum_manager¶
local quantum manager client to communicate with server.
- Type:
- add_foreign_entity(entity_name: str, foreign_id: int)¶
Adds the name of an entity on another parallel timeline.
- Parameters:
entity_name (str) – name of the entity on another parallel timeline.
foreign_id (int) – id of the process containing the entity.
- run()¶
Main simulation method.
The run method begins simulation of events. Events are continuously popped and executed, until the simulation time limit is reached or events are exhausted. A progress bar may also be displayed, if the show_progress flag is set.
- schedule(event: Event)¶
Method to schedule an event.
- top_time() float ¶
Method to get the timestamp of the soonest event in the local queue.
Used for the conservative synchronization algorithm. If the event queue is empty, returns infinity.