S8223: Simulating a City: GPU Simulations of Traffic, Crowds and Beyond Dr Paul Richmond Contributors: Peter Heywood, Robert Chisholm, Mozhgan Kabiri-Chimeh, John Charlton & Steve Maddock
Context: Everyone hates delays Road Travel Projections for 2040 [1] Up to 42% increase of car ownership 19 to 55% growth of UK road traffic Demand will be greater than supply Need to improve the supply [1] Department for Transport, Road traffic forecasts 2015. https://www.gov.uk/government/uploads/system/ uploads/attachment_data/file/260700/road-transport-forecasts-2013-extended-version.pdf, Mar. 2015.
Why City Simulations? Highways England 709M costs for maintaining UK strategic Motorway and A-Road network in 2010/2011 [1] Changing and maintaining infrastructure is very expensive! Simulation allows Understanding of the impact of changes to the transport network Understanding of the impact of infrastructure investment Intelligent management of vehicles, people and public transport Investigation of shocks to the system (unusual or dangerous event) All in a safe environment with minimal cost and disruption [1] - UK Department for Transport, Cost of maintaining the Highways Agency s motorway and A road network per lane mile. https://www.gov.uk/government/publications/ cost-of-maintaining-the-highways-agency-s-motorway-and-a-road-network-per-lane-mile,2011.
The Role of GPUs Talk Outline Acceleration of existing city simulation tools The development of new simulation approaches Removal of simulation bottlenecks to do new things
Bottom Up Top Down Macro, Meso, Micro: How to Simulate a City Macroscopic Concerned with flows and networks Mesoscopic In the middle Combine aspects of micro models E.g. Junction flow delays Microscopic Individual Level Modelling (Agent Based Modelling) Car behaviours, local interactions, pedestrian behaviour Computationally expensive
Speedup compared to serial Macro/Mesoscopic simulation platform Used by Highways Agency, TfL and local councils Performance Optimised with OpenMP for multi-core Demonstrates diminishing returns Requirement to scale to regional and national models LoHAM is Londan and surrounding area Single Assignment-Loop Speedup against Thread Count (LoHAM model) 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Thread Count i7 6850k (6 cores - 12 threads) - Average of 3 repetitions Research Funded by ATKINS Global
Computational Bottleneck Iterative convergent algorithm Typical within transport modelling Simulation Adjusts network flow costs Simulates junction delays based off demand Assignment (97% serial runtime) Inputs Network and cost of links/edges Origin-Destination Matrix Output Traffic flow per edge 1. Single Source Shortest Path - SSSP All-or-Nothing Path For each origin in the O-D matrix 2. Flow (Accumulation) Apply the OD value for each trip to each link on the route Traffic flow per link (road) 100% 90% 80% 70% 60% 50% 40% 30% 20% 10% 0% Simulation Assignment Runtime (LoHAM model) Flow Serial Flow delay costs SSSP
N 1 N 2 Single Source Shortest Path For a single Origin/Source Node (N 1 ) Find the route to each Destination Node (N 7 ) With the Lowest Cumulative Weight (Cost) 0.1 0.1 0.7 N 4 N 3 N 5 0.2 0.4 0.3 0.2 N 6 N 8 0.3 N 7 Node Back link Cost N 1 Calculate for all source destination pairs N 2 N 3 0.1 N 3 N 1 0.1 N 4 N 3 0.7 N 5 N 4 0.2 N 6 N 4 0.4 N 7 N 6 0.3 N 8 N 6 0.2
Multi-GPU Origin-Vertex Frontier Gunrock [1], NVGraph: State of the art SSSP implementations Favour large dense graphs (e.g. social media graphs) Transport networks are highdiameter low density E.g. LoHAM: TODO Origin-Vertex Frontier Combines many (each origin) SSSP calculations to increase parallel workload Each origin-vertex for consideration stored in a frontier. Sorted each iteration to improve data access pattern Co-operative thread array (CTA) used to balance workload Multi-GPU: Balanced distribution of multiple vehicle classes [1] GTC 2016: ID S6374
Results
The Role of GPUs Talk Outline Acceleration of existing city simulation tools The development of new simulation approaches Removal of simulation bottlenecks to do new things
Flexible Micro-simulation with FLAME GPU High Level Description of Agents Represent the properties of Pedestrians/Vehicles. E.g. location, velocity, etc. High Level Scripting of Behaviour The model dynamics such as avoidance, car following, navigation, etc. Communication abstracted as messages to hide underlying algorithm Automated GPU Code Generation Complete abstraction from the GPU Templates generate CUDA simulation code
Road Network Model Funded by Department for Transport (TTRIG), In collaboration with TSS UK (AimSum)
FLAME GPU vehicle model function FLAME_GPU_FUNC int checknextjunction(xmachine_memory_car* agent, xmachine_message_junctionmessage_list* junctionmessage_messages, xmachine_message_junctionmessage_bounds* message_bounds) { // Get the junction of current vehicle unsigned int junction = get_staticgraph_roadnetwork_edge_destination(agent->edgeid); // Load the first junction message xmachine_message_junctionmessage* current_message = get_first_junctionmessage_message(junctionmessage_messages, message_bounds, junction); // Iterate over junction messages (vehicles at this junction) while (current_message) { // Check if agent on junction is leading this vehicle if (vehicleisleading(agent, current_message)){ updateleadvehicle(agent, current_message); } } // Get next junction message (vehicles at this junction) current_message = get_next_junctionmessage_message(current_message, junctionmessage_messages, message_bounds); } return 0;
Road Network Simulation Benchmark Scalable Manhattan Grid Network Comparative Implementation in AimSum Commercial Multi-core simulation platform Vehicle performing update calculation Neighbour vehicle considered by network communication messaging Neighbour vehicle considered by fixed radius communication messaging Neighbour vehicle considered by all to all communication messaging
Performance results Largest model: 576k Vehicles and ~2M detectors Real Time Ratio 39x Titan V 26x P100 Up to 65x Speedup Speedup Over Multi-core (512k vehicles) 65x Titan V 44x P100 Peter Heywood, Steve Maddock, Jordi Casas, David Garcia, Mark Brackstone, Paul Richmond, Data-parallel agent-based microscopic road network simulation using graphics processing units (2018), Simulation Modelling Practice and Theory, Volume 83, pp 188-200, https://doi.org/10.1016/j.simpat.2017.11.002.
The Role of GPUs Talk Outline Acceleration of existing city simulation tools The development of new simulation approaches Removal of simulation bottlenecks to do new things
Fast Accurate Pedestrian Collision Avoidance Force based pedestrian simulation models Fast but not accurate in dense conditions Results in agent overlaps ORCA[1] Model Optimal Reciprocal Collision Avoidance Solve set of linear velocity constraints Unbalanced workload per agent FLAME GPU implementation with thread block workload redistribution Example of simulation Corresponding ORCA lines for agent A [1] Van Den Berg, Jur, Stephen J. Guy, Ming Lin, and Dinesh Manocha. Reciprocal N-Body Collision Avoidance. In Robotics Research, 3 19. Springer, 2011.
SIEMENS Sheffield Advanced Multi-Model Simulator
Multi-modal Simulations Observe impact of city wide delays on rail network Measure individual passenger experience through entire journey Visualise pedestrian behaviour. E.g. station congestion Identify improvements for public transport Investigate major infrastructure investment projects High Congestion Platform Low Congestion Platform
Interactive Simulations within Virtual Environment Prototype new models such as Autonomous pods Interaction within VR via OmniDeck 6 6m 360 treadmill 16 sets active triangular rolers User location tracking Immersive interaction with crowds Simulation coupled with UNREAL engine Available at the Transport Systems Catapult (UK)
Summary and Future Work GPUs are a major step change in City simulation performance Existing tools can offer orders of magnitude in performance improvements Multi-agent simulation (with FLAME GPU) is flexible and highly efficient for vehicle and pedestrian simulations Coupling multi-agent simulation with existing modelling adds new ways to explore infrastructure and transportation initiatives Future Work: Simulation Implications for AI Can used to generate realistic training data (from dangerous or rare events) AI and ML can be coupled to predict simulation outcomes Questions? Vote for our Top 5 Finalist Poster: P8215 Data-Parallel Agent-Based Microscopic Road Network Simulation using GPUs