moss.parallel

Module Contents

Classes

ParallelEngine

Moss Engine for parallel simulation

ParallelManager

Helper class for managing multiple ParallelEngines.

Functions

Data

API

moss.parallel.__all__

[‘ParallelEngine’, ‘ParallelManager’]

class moss.parallel.ParallelEngine(name: str, map_file: str, person_file: str, start_step: int = 0, step_interval: float = 1, seed: int = 43, verbose_level=Verbosity.NO_OUTPUT, person_limit: int = -1, junction_yellow_time: float = 0, phase_pressure_coeff: float = 1.5, speed_stat_interval: int = 0, output_dir: str = '', out_xmin: float = -inf, out_ymin: float = -inf, out_xmax: float = inf, out_ymax: float = inf, device: int = 0)

Bases: moss.engine.Engine

Moss Engine for parallel simulation

Initialization

Args:

  • name: The name of the task (for directory naming in output)

  • map_file: The path to the map file (Protobuf format)

  • person_file: The path to the person file (Protobuf format)

  • start_step: The starting step of the simulation

  • step_interval: The interval of each step (unit: seconds)

  • seed: The random seed

  • verbose_level: The verbosity level

  • person_limit: The maximum number of persons to simulate (-1 means no limit)

  • junction_yellow_time: The yellow time of the junction traffic light

  • phase_pressure_coeff: The coefficient of the phase pressure

  • speed_stat_interval: The interval of speed statistics. Set to 0 to disable speed statistics.

  • output_dir: The AVRO output directory

  • out_xmin: The minimum x coordinate of the output bounding box

  • out_ymin: The minimum y coordinate of the output bounding box

  • out_xmax: The maximum x coordinate of the output bounding box

  • out_ymax: The maximum y coordinate of the output bounding box

  • device: The CUDA device index

init()
class moss.parallel.ParallelManager(engines: List[moss.parallel.ParallelEngine])

Bases: moss.engine.Engine

Helper class for managing multiple ParallelEngines.

Method calls on this object will be broadcast to all managed engines

Initialization

Args:

  • name: The name of the task (for directory naming in output)

  • map_file: The path to the map file (Protobuf format)

  • person_file: The path to the person file (Protobuf format)

  • start_step: The starting step of the simulation

  • step_interval: The interval of each step (unit: seconds)

  • seed: The random seed

  • verbose_level: The verbosity level

  • person_limit: The maximum number of persons to simulate (-1 means no limit)

  • junction_yellow_time: The yellow time of the junction traffic light

  • phase_pressure_coeff: The coefficient of the phase pressure

  • speed_stat_interval: The interval of speed statistics. Set to 0 to disable speed statistics.

  • output_dir: The AVRO output directory

  • out_xmin: The minimum x coordinate of the output bounding box

  • out_ymin: The minimum y coordinate of the output bounding box

  • out_xmax: The maximum x coordinate of the output bounding box

  • out_ymax: The maximum y coordinate of the output bounding box

  • device: The CUDA device index

__getitem__(i) moss.parallel.ParallelEngine
__len__()
execute(func: Callable[[int, moss.engine.Engine], Any]) List[Any]

Run func(idx, eng) in parallel and return the results as a list

moss.parallel._force_exit()
moss.parallel._instance(args, kwds, q_in: queue.SimpleQueue, q_out: queue.SimpleQueue)
moss.parallel._proxy_init(self, *args, **kwds)
moss.parallel._proxy_method(self, name, *args, **kwds)
moss.parallel._proxy_property(name, self, *args, **kwds)
moss.parallel._proxy_method_batch(self, name, *args, **kwds)
moss.parallel._proxy_property_batch(name, self, *args, **kwds)
moss.parallel._init()