SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... ·...

21
Multiple Platforms: Porting Agent-Based Simulation from Grids to Graphics cards Dr. Mariam Kiran University of Bradford Presentedat: Workshop on Portability Among HPC Architectures for Scientific Applications Super Computing 2015

Transcript of SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... ·...

Page 1: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

MultiplePlatforms:PortingAgent-BasedSimulationfromGridstoGraphicscardsD r. Ma r iamK i ran

Un iv ers i ty o f B radfordPresentedat:WorkshoponPortabilityAmongHPCArchitecturesforScientificApplicationsSuperComputing2015

Page 2: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

AgendafortheTalkIntroduction

Settingthestage:Agent-basedmodelling

IntroducingFLAMEanditsportabilityfromHPCtoGPU

Portabilityproblems– rewritingmodelstomakesurethey‘run’

PossiblefuturedirectionsofusingClouds

Researchchallenges

Conclusions

MARIAMKIRAN 2

Page 3: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

Computingworkingwithotherdisciplines

MARIAMKIRAN 3

Distributedandscalablecomputing

ScientificComputing

Complexsystemmodels(economic,biological,social

networks)Emergentbehaviourusingagent-basedmodelling

Agent-basedmodellingonHPCandGPU

(FLAME)www.flame.ac.uk

ModellingandSimulationon

Cloud

Page 4: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

Agent-basedModellingEachindividual isapacketofprogrammingcodeallowedtosimulatetogether

Granularity

Interactions

Overcomemostassumptionsinthemodel

Examples innature– birdflockingbehaviour (boids),crowdbehaviour inhumans

MARIAMKIRAN 4

Page 5: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

IntroducingFLAMEforbuildingagent-basedmodelsProducedattheUniversityofSheffield,UK.

Flexible Large-scaleAgent-basedModellingenvironment.

BasedonX-machinearchitecture foragents.

Beingusedinawidenumberofprojects(Modellingofcells, tissues,biologicalandeconomicscenariosornetworkingmodels)

Automaticallyproducesparallelisable codeformodels.

Easeofprogrammingfornon-computerexperts.

MARIAMKIRAN 5

Page 6: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

FLAMEfilesThis file helps with parallelisation on HPC

MARIAMKIRAN 6

Page 7: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

FLAMEadvantagesProducesautomaticallyparallelisable code.

Defaultitrunsinserial.

Butbyjustaddingaflag–p,whilecompiling, itproducesaparallelisable modelcode.

Communicationishandledusinganintelligentmessageboardlibrarywhichcanpooloutrelevantmessages,sort,randomise orfilterthemonanycriteria.

MARIAMKIRAN 7

Page 8: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

Libmboard– FLAMEmessageboardlibrary

MARIAMKIRAN 8

Page 9: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

SoftwareEngineeringperspective…FlamefollowsastrictX-machinearchitecture foritsagentsallowingittocontain◦ Memory◦ Functions◦ States◦ Messagesinandout

MARIAMKIRAN 9

Page 10: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

Portingmodels:fromHPCtoGraphicsCards

MARIAMKIRAN 10

Page 11: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

MultiplatformcapabilityYoucanwritemodelseasily

Softwareworksouthowtodistribute

Allyouhavetodoisrun

Needsomeknowledgeofthesystem

Preallocationandmemoryrequirements

Sometimesyouneedtorewritethecompletemodel

Howtotestthemodelrewrittenincorrect?

MARIAMKIRAN 11

FromFLAME

Softwaredoestherest

Page 12: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

Samemodelsrunningon(a)differentdistributionsand(b)numberofnodes

MARIAMKIRAN 12

Changingplacementofprocessesonprocessors- samemodelChangingnumberofprocessors- samemodel

Note:FutureworkonCloudsmayintroduceamultitudeofmorefactors–Energy,Cost,OptimalVMplacement,networks,andmanymore

Page 13: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

WhataretheperformancecharacteristicsMainperformancewasTime

Doweneedanymore?

-Modelchecking

-Costs

-Eco-efficiency

-Datapatterns– verifyingresults

MARIAMKIRAN 13

Page 14: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

HPCversusGPUConsiderablechangesinthesoftwaretoensureitexecutesonGPU:

◦ WritingtheAgents– differentmodeldescriptions

◦ Pre-allocationofAgentmemory– GPUneedsalladvanceknowledge– nodynamicallocationofmemoryispossible

◦ Messagecommunication:needtobreakdownbigger functionsintosimpleronemessagefuntions

◦ SimplerversusComplex– Removedynamicarrays- memoryneedstobesimple

◦ LoopingthroughMessages– Looptraversalisdifferent,rewrite functions

◦ Agentbirthanddeath– Advancememoryallocation

◦ Realtimevisualization– HPCdoesnotallowthis

MARIAMKIRAN 14

Page 15: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

LoopingthroughMessagesCodeforHPCneedstointroduceaflag‘finished’toleave thewhile loop.

Elsesimulationhangs!

MARIAMKIRAN 15

GPUimplementation:int MyFunction(xmahine_memory*agent,xmachine_message_list*list){

boolfinished=false;xmachine_message*message=get_first_message(list);while(message){

if(!finished){if(message->id==agent->id){

agent->state+=message->state;finished=true;

}}

message=get_next_message(message,list);}return0;

}

HPCimplementation:int MyFunction (xmahine_memory*agent,xmachine_message_list*list){

xmachine_message*message=get_first_message(list);while(message){

if(message->id==agent->id){agent->state+=message->state;return0;

}message=get_next_message(message,list);}return0;

}

Page 16: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

Whataboutcloud?OPENLABS

GIV INGACCESSEVERYWHERE

MARIAMKIRAN 16

Page 17: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

Computationally- whymovetowardsCloud?

Issues High performance computing Cloud computingKind of modelsand processing

Processing is limited is somearchitectures

Can introduce dynamicscalability for more complexprocessing.

Cost Access to expensive hardware tomodel and simulate systems.

Resources can be hired asneeded.

Failurerecovery

No fault recovery when disk spaceruns out.

Applications can burst to moreClouds if needed, automatically.

Dynamicchanges in themodel

No real time processing, jobs aresubmitted to a queue, whichmeans real time changes cannotbe incorporated in themodels.

Can execute jobs on the flywhich can read real time datafeeding to the models directly.(very useful for sensor relatedmodels)

MARIAMKIRAN 17

Page 18: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

CloudComputationalchallengesrelevanttoABMMemory constraints savedasbigdatasetsService levelagreements

Optimise computationReducetime

ReducecostsEnergyefficientcode

Hideawayasmuchcomputation aspossible

- VMdoing processing- Databeingsaved indataservers

MARIAMKIRAN 18

Page 19: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

Researchchallengesstillrelevant1.Languagetocommunicatemodelsbetweenmultiplegroups

2.Automaticallyparsethistooptimaldistributionforprocessing◦ RewritemodelsforGPU,HPC,Cloud?◦ Whataretheperformancemetricsneededbymodellers?

3.Justsavinginformationneeded,globalaverages,specificeventsforverification

‘Openlab’toexecuteandsharemodelsandresults?

Modeldescription

(1)

Particularmodellingtechnique(e.g.ABM)

Parsetoproduceautomatic

parallelisation(2)

Codeexecutes

Resultsaresaved,analysed,visualise(real-time,batch)(3)

Architecturedependency(HPC,GPU,Cloud)

whatisneeded?Globalparameters,

memoryconstraints,additionalprocessing?

Performancemetrics(whattoconsider?)

MARIAMKIRAN 19

Page 20: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

ConclusionsSimulationsaregettinglargerandmorecomplex.

Realistic simulationsrequire largerpopulations,ormultiple typesofpopulation,asthevalidityofemergentcharacteristic dependentonboth:theaccuracyofthebehaviour modelledandpopulationsizes.Forecastbehaviours ofsystemsfasterthanthewall-clock time.

Run-timecostsarepresentlyinhibiting theeffectiveuseofABMasforecastingtool.

Agent-basedmodelshavesuccessfullybeenabletouncovernewaspectsofeconomicsystemssuchastheeffectofmigrationonEUlabormarketsoruncoveringsomeunderlying factsinbiological systemsandneedHPC,GPUsandnewertechnologies.

ManymodelswrittenforHPCandGPUshouldportraysimilarcharacteristics, hidingawaymuchofthesoftwarecomplexity fromthenoncomputingscientistsusingthetoolstowritetheirmodelswhichisachallenge initsownright.

MARIAMKIRAN 20

Page 21: SC Kiran portability - press3.mcs.anl.govpress3.mcs.anl.gov/hpcport/files/2015/11/Kiran... · MARIAM KIRAN 5. FLAME files This file helps with parallelisation on HPC MARIAM KIRAN

ThankyouandAnyquestions?

MARIAMKIRAN 21