1 / 29

Agent Simulations on Graphics Hardware

Agent Simulations on Graphics Hardware. Timothy Johnson - twjohnson@students.latrobe.edu.au Supervisor: Dr. John Rankin. Outline. Agent Simulations Graphics Hardware System Model Planning Code Generation Simulation Analysis Examples Performance. Agent Simulations.

washi
Download Presentation

Agent Simulations on Graphics Hardware

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Agent Simulations on Graphics Hardware Timothy Johnson - twjohnson@students.latrobe.edu.au Supervisor: Dr. John Rankin

  2. Outline • Agent Simulations • Graphics Hardware • System • Model • Planning • Code Generation • Simulation • Analysis • Examples • Performance

  3. Agent Simulations • Simulations with hundreds or thousands of software agents • Agent-based simulations are becoming increasingly more popular [1] • Each entity simulated at the individual microscopic level • Emergence of interesting complex behaviour at the macroscopic level • Fields: air traffic control, disaster management, biology, crime analysis, economics, pedestrian dynamics, military simulations, etc • Problems • Expensive and time consuming to develop • Limited in scope by available processing power

  4. Graphics Hardware • Graphical Processing Units (GPUs) are outstripping Central Processing Units (CPUs) in terms of raw performance [2] • Performance gap continuing to widen • Example • Intel Core i7-4930K [$679][187.2 GFLOPS] • NVIDIA GTX 780 [$639][3977 GFLOPS] • Programming Difficulties • Dealing with hundreds or thousands of cores and threads • Data synchronisation • Memory architecture • Data transfer between CPU and GPU • Shortage of high quality learning resources Prices retrieved from pccasegear.com on 04/11/2013

  5. Idea • Increase processing power, allowing more agents to be simulated than previously possible • Make a system that does not require the user to perform GPU programming

  6. System Overview Model Planning Code Generation Simulation Analysis

  7. System Overview Model Planning Code Generation Simulation Analysis

  8. Model

  9. Model • Resources – Items agents interact with • Apple, Bread, Car, Gold, Water • Attributes – Represent aspects of agents • Age, Height, Health, Hunger, Energy • Rules – Specify how an agent can interact with the world • Move, Use, Harvest, Trade, Combine • Goals – Define the agent’s behaviour during simulation • Maximize Attributes, Maximize Resources • Agent Types – Built up with Attributes, Rules and Goals • Farmer, Duck, Bee, Policeman • Communities – Consists of one or more Agent Types • Town, Beehive, Sports team

  10. MODEL: Duck simulation • Resources • Bugs • Bread • Attributes • Hunger • Rules • Use (Bread, Hunger, -5) • Use (Bugs, Hunger, -3) • Harvest (Bread) • Harvest (Bugs) • Goals • Minimize Attribute (Hunger)

  11. System Overview Model Planning Code Generation Simulation Analysis

  12. Planning • User enters resources, attributes, rules, goals, agents, communities into our tool • System then automatically links goals and rules to create plans Goal One Rule One Rule Two Rule Three

  13. Planning: Duck Simulation

  14. PLANNING: DUCK SIMULATION Rule Use (Bread, Hunger, -5) Rule Use (Bugs, Hunger, -3) Goal Minimize Attribute (Hunger) Rule Harvest (Bread) Rule Harvest (Bugs)

  15. System Overview Model Planning Code Generation Simulation Analysis

  16. Code generation • OpenCL code kernels are created for each agent type defined • OpenCL is programmed through a subset of C with its own extensions • Can run on both NVIDIA and AMD GPUs • Algorithm • For each agent type • Create a new kernel • Prepare some initial definitions and kernel arguments • Iterate through each plan created in the previous stage • Generate segments of code for each rule in each plan • By automatically generated optimised code, we manage to hide the difficulties of GPGPU from the user

  17. Code Generation: DUCK SIMULATION Goal Minimize Attribute (Hunger) Rule Use (Bread, Hunger, -5) Rule Use (Bugs, Hunger, -3) Rule Harvest (Bread) Rule Harvest (Bugs)

  18. System Overview Model Planning Code Generation Simulation Analysis

  19. Simulation • Code kernels are compiled • Data is generated on the CPU • Data is transferred across to GPU memory • Each agent to be simulated is assigned its own thread • Simulation begins to run

  20. SIMULATION: DUCK SIMULATION

  21. SIMULATION: DUCK SIMULATION Yellow = Ducks, Green = Bugs, Blue = Bread

  22. System Overview Model Planning Code Generation Simulation Analysis

  23. Analysis • All data from the simulation, including agent positions, attribute values, resource values, plans chosen, etc can be output to file during runtime • After the simulation run has completed, this data can then be analysed externally by other tools

  24. Analysis: DUCK SIMULATION

  25. Scenarios Farming Simulation [3] Bee Simulation [4] Factory Simulation

  26. Performance Testing • Two versions of the “Farming Simulation” created • GPU version using our system • Custom CPU-optimised version • Tests carried out on four GPUs and four CPUs • Two laptop machines and two desktop machines • Millisecond per update and frame rates were calculated • Testing found modern GPUs are faster than CPUs in most cases

  27. System performance

  28. Beyond Simulations • Movies • Games • Advertisements

  29. Questions? Timothy Johnson - twjohnson@students.latrobe.edu.au Supervisor: Dr. John Rankin References: [1] Chan, W. K. V., Son Y. J., Macal, C. M., Agent-based simulation tutorial - simulation of emergent behavior and differences between agent-based simulation and discrete-event simulation, In Proceedings of the Winter Simulation Conference, WSC '10, 135-150, 2010. [2] Luebke, D., Humphreys, G., How GPUs Work, Computer, 40 (2), 96-100, 2007. [3] Johnson, T. W. C., Rankin, J. R., Parallel Agent Systems on a GPU for use with Simulations and Games, In Proceedings of the 1st International Conference on Computing, Information Systems and Communications, CISCO '01, 229-235, 2012. [4] Johnson, T. W. C., Rankin, J. R., User Friendly Agent-Oriented Simulation Builder, In Proceedings of the 8th International Conference on Information Technology and Applications, ICITA '08, 2013.

More Related