Download presentation
Presentation is loading. Please wait.
Published byMargaret McDowell Modified over 9 years ago
1
AGENT SIMULATIONS ON GRAPHICS HARDWARE Timothy Johnson - twjohnson@students.latrobe.edu.au Supervisor: Dr. John Rankin 1
2
OUTLINE Agent Simulations Graphics Hardware System Model Planning Code Generation Simulation Analysis Examples Performance 2
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 3
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 4
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 5
6
SYSTEM OVERVIEW Model Code Generation Planning Simulation Analysis 6
7
SYSTEM OVERVIEW Model Code Generation Planning Simulation Analysis 7
8
MODEL 8
9
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 9
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) 10
11
SYSTEM OVERVIEW Model Code Generation Planning Simulation Analysis 11
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 12
13
PLANNING: DUCK SIMULATION 13
14
PLANNING: DUCK SIMULATION Goal Minimize Attribute (Hunger) Goal Minimize Attribute (Hunger) Rule Harvest (Bread) Rule Harvest (Bread) Rule Harvest (Bugs) Rule Harvest (Bugs) Rule Use (Bread, Hunger, -5) Rule Use (Bread, Hunger, -5) Rule Use (Bugs, Hunger, -3) Rule Use (Bugs, Hunger, -3) 14
15
SYSTEM OVERVIEW Model Code Generation Planning Simulation Analysis 15
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 16
17
CODE GENERATION: DUCK SIMULATION Goal Minimize Attribute (Hunger) Goal Minimize Attribute (Hunger) Rule Harvest (Bread) Rule Harvest (Bread) Rule Harvest (Bugs) Rule Harvest (Bugs) Rule Use (Bread, Hunger, -5) Rule Use (Bread, Hunger, -5) Rule Use (Bugs, Hunger, -3) Rule Use (Bugs, Hunger, -3) 17
18
SYSTEM OVERVIEW Model Code Generation Planning Simulation Analysis 18
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 19
20
SIMULATION: DUCK SIMULATION 20
21
SIMULATION: DUCK SIMULATION Yellow = Ducks, Green = Bugs, Blue = Bread 21
22
SYSTEM OVERVIEW Model Code Generation Planning Simulation Analysis 22
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 23
24
ANALYSIS: DUCK SIMULATION 24
25
SCENARIOS Farming Simulation [3] Bee Simulation [4] Factory Simulation 25
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 26
27
SYSTEM PERFORMANCE 27
28
BEYOND SIMULATIONS Movies Games Advertisements 28
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. 29
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.