Agent Simulations on Graphics Hardware
description
Transcript of Agent Simulations on Graphics Hardware
PowerPoint Presentation
Agent Simulations on Graphics HardwareTimothy Johnson - [email protected]: Dr. John Rankin1OutlineAgent SimulationsGraphics HardwareSystemModelPlanningCode GenerationSimulationAnalysisExamplesPerformance
2Agent SimulationsSimulations with hundreds or thousands of software agentsAgent-based simulations are becoming increasingly more popular [1]Each entity simulated at the individual microscopic levelEmergence of interesting complex behaviour at the macroscopic levelFields: air traffic control, disaster management, biology, crime analysis, economics, pedestrian dynamics, military simulations, etcProblemsExpensive and time consuming to developLimited in scope by available processing power
3Graphics HardwareGraphical Processing Units (GPUs) are outstripping Central Processing Units (CPUs) in terms of raw performance [2]Performance gap continuing to widenExampleIntel Core i7-4930K [$679][187.2 GFLOPS]NVIDIA GTX 780 [$639][3977 GFLOPS]Programming DifficultiesDealing with hundreds or thousands of cores and threadsData synchronisationMemory architectureData transfer between CPU and GPUShortage of high quality learning resourcesPrices retrieved from pccasegear.com on 04/11/2013
4IdeaIncrease processing power, allowing more agents to be simulated than previously possibleMake a system that does not require the user to perform GPU programming
5System OverviewModelCode GenerationPlanningSimulationAnalysis6System OverviewModelCode GenerationPlanningSimulationAnalysis7Model
8ModelResources Items agents interact with Apple, Bread, Car, Gold, WaterAttributes Represent aspects of agents Age, Height, Health, Hunger, EnergyRules Specify how an agent can interact with the worldMove, Use, Harvest, Trade, CombineGoals Define the agents behaviour during simulation Maximize Attributes, Maximize ResourcesAgent Types Built up with Attributes, Rules and Goals Farmer, Duck, Bee, PolicemanCommunities Consists of one or more Agent Types Town, Beehive, Sports team9MODEL: Duck simulationResourcesBugsBreadAttributesHungerRulesUse (Bread, Hunger, -5)Use (Bugs, Hunger, -3)Harvest (Bread)Harvest (Bugs)GoalsMinimize Attribute (Hunger)
10System OverviewModelCode GenerationPlanningSimulationAnalysis11PlanningUser enters resources, attributes, rules, goals, agents, communities into our toolSystem then automatically links goals and rules to create plans
Goal OneRule OneRule TwoRule Three12Planning: Duck Simulation
13PLANNING: DUCK SIMULATIONGoalMinimize Attribute (Hunger)RuleHarvest (Bread)RuleHarvest (Bugs)RuleUse (Bread, Hunger, -5)RuleUse (Bugs, Hunger, -3)14System OverviewModelCode GenerationPlanningSimulationAnalysis15Code generationOpenCL code kernels are created for each agent type definedOpenCL is programmed through a subset of C with its own extensionsCan run on both NVIDIA and AMD GPUsAlgorithmFor each agent typeCreate a new kernelPrepare some initial definitions and kernel argumentsIterate through each plan created in the previous stageGenerate segments of code for each rule in each planBy automatically generated optimised code, we manage to hide the difficulties of GPGPU from the user
16Code Generation: DUCK SIMULATIONGoalMinimize Attribute (Hunger)RuleHarvest (Bread)RuleHarvest (Bugs)RuleUse (Bread, Hunger, -5)RuleUse (Bugs, Hunger, -3)
17System OverviewModelCode GenerationPlanningSimulationAnalysis18SimulationCode kernels are compiledData is generated on the CPUData is transferred across to GPU memoryEach agent to be simulated is assigned its own threadSimulation begins to run
19SIMULATION: DUCK SIMULATION
20SIMULATION: DUCK SIMULATIONYellow = Ducks, Green = Bugs, Blue = Bread21System OverviewModelCode GenerationPlanningSimulationAnalysis22AnalysisAll data from the simulation, including agent positions, attribute values, resource values, plans chosen, etc can be output to file during runtimeAfter the simulation run has completed, this data can then be analysed externally by other tools23Analysis: DUCK SIMULATION
24Scenarios
Farming Simulation [3]Bee Simulation [4]Factory Simulation25Performance TestingTwo versions of the Farming Simulation createdGPU version using our systemCustom CPU-optimised versionTests carried out on four GPUs and four CPUsTwo laptop machines and two desktop machinesMillisecond per update and frame rates were calculatedTesting found modern GPUs are faster than CPUs in most cases26System performance27Beyond SimulationsMoviesGamesAdvertisements
28Questions?Timothy Johnson - [email protected]: Dr. John RankinReferences:[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