DemoModeltolaunchthedemomodelYoumayhavemoreentriesthanthesingleoneshowninthe 1httprepastsourceforgenetdownloadhtml2httpwwworaclecomtechnetworkjavajavasedownloadsindexhtml1 2NICKCOL ID: 155934
Download Pdf The PPT/PDF document "REPASTSIMPHONYBATCHRUNSGETTINGSTARTEDNIC..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
2NICKCOLLIER,JONATHANOZIK-REPASTDEVELOPMENTTEAMscreenshot,inwhichcase,justbesuretoselectJZombies DemoModel.DonotselectZombies DemoModel. Figure1.JZombiesModelLauncher2.TheBatchRunConfigurationGUITheBatchRunCongurationGUIisusedtocongureandlaunchthebatchrun.TostartthecongurationGUI,starttheJZombiesdemomodel(seesection1)andclickonthelightningboltinthetoolbar(g.2).NotethatyoucanalsostarttheGUIasastand-aloneapplication.Seesection6.4forthedetails. Figure2.BatchRunCongurationGUILaunchTheGUIisusedtocongureabatchrun.Thiscongurationcanbesavedandthenloadedatafuturetime.ThecongurationGUIconsistsofatoolbarandfourtabbedpanels(g.3).Therstfourtoolbarbuttons areusedtocreateanewconguration,openanexistingconguration,savethecurrentconguration,andsavethecurrentcongurationinanewle.Hoveringoverthebuttonswiththemousewillshowatooltipexplainingthebuttonsfunction.Thefthbutton willreloadthepropertiesinthemodelpanelfromthecurrentmodel.Theremainingtwobuttonshavetodowithperformingthebatchrunsitself.Regardlessoftypeofbatchrun(local,distributed,andsoforth),thebatchrunrequiresenoughofRepastSimphonyaswellasthemodeltoberuninordertowork.Thesepartsarebundled 6NICKCOLLIER,JONATHANOZIK-REPASTDEVELOPMENTTEAMtherighthandside\HostProperties"displaysthepropertiesforthehostselectedonthelefthandside.Newhostscanbecreatedusingthe\AddHost" button.Acopyofanexistinghostcanbemadewiththe\CopyHost" button.Existinghostscanbedeletedbyselectingthehosttodeleteandpressingthe\DeleteHost" button. Figure5.HostsPanelTheHostPropertiesare:Type:Thetypeofhost:localorremote.User:Theusernameoftheaccountontheremotemachine.Thisisonlyusedforaremotehost.Host:Thenameoripaddressoftheremotemachine.Thisisonlyusedforaremotehost.SSHKeyFile:ThenameoftheprivateSSHkeyleusedtoauto-loginontheremotehost.Thisisonlyusedforaremotehost.Instances:Thenumberofinstancestorunonthehost.Eachinstancewillbeas-signedachunkoftheparameterspacetorun.Eachofthehostsdenedonthehostpanelwillbeusedtoperformthebatchruns.Forexample,ifonelocalhostandoneremotehostisdenedandthelocalhosthastwo REPASTSIMPHONYBATCHRUNSGETTINGSTARTED7instancesandtheremotehosthasasingleinstance,thenthebatchparameterspacewillbedividedinthirds.Two-thirdswillberunlocallyinparallel:eachinstanceonthelocalmachinewillrunathirdofthespace.Theremainingthirdwillberunontheremotemachine.Thenumberofinstancestorunonamachineshouldberoughlythenumberofhardwarethreadsavailableonthemachine.Ofcourse,yourmilagemayvary,especiallyifthemachineisperformingothercomputationallyexpensivetasks.2.3.1.LocalRuns.Localrunsaretheeasiestrunstoperform,requiringtheleastamountofexternalsetup.Tocongurealocalrun,createahost(orchoseanexistingone)andsetitstypetoLOCAL.YouwillseethehostlabeledassomethinglikeX@localhostwhereXistheusernameoftheaccountrunningtheGUI.Whenyouperformalocalrun,theGUIcopiesthearchivepayloadmentionedabovetoatemporarylocationonthemachine'shard-drive.Thispayloadisunzippedandtheparameterspaceisdividedamongtheinstancestoberunlocallyandtherunsarebegun.Oncetherunshaveended,theoutputgeneratedbyeachinstanceisconcatenatedtogetherandplacedintheoutputdirectoryspeciedinthemodelpanel.2.3.2.RemoteRuns.Remoterunsaremorecomplicatedandyoumayhavetodosomesetuponthelocalandremotemachine.Remotemachinescanbeanythingfrommiscel-laneoussparemachinesthatyoumighthaveuptoamazon'scloudcomputingservices.RemoterunsworkoverSecureShell(SSH).SSHisacryptographicnetworkprotocolforsecuredatacommunication,remoteshellservicesorcommandexecutionandothersecurenetworkservicesbetweentwonetworkedcomputersthatconnect,viaasecurechanneloveraninsecurenetwork,aserverandaclient(runningSSHserverandSSHclientprograms,respectively).AnymachinethatallowsyoutoconnecttoitviaSSHandcanrunajavavirtualmachinecanbeusedtoperformaremoterun.Seesection6onhowtosetuptheremotemachines.Onthelocalside,thatis,onthemachineyouarerunningthebatchcongurationGUIon,youwillneedtobesetuptoauto-logintotheremotemachineusingpublickeyauthentication.Thisconsistsofcreatingasshpublic/privatekeypaironyourmachine,ifthosedon'talreadyexist,copyingthatkeytotheremotemachineandthenappendingthekeytothelistofauthorizedkeysontheremotemachine.Someusefulreferencesthatdescribethisare:OSX-http://smbjorklund.no/ssh-login-without-password-using-os-xWindows-Seebelow.Linux-https://hkn.eecs.berkeley.edu/dhsu/ssh public key howto.htmlOthersitesexistaswell,google\sshpublickeyauthentication"formoreinformation.Thesituationonwindowsismorecomplicated.OSXandLinuxcomewithsshandthusthebuilt-inabilitytogeneratepublic/privatekeypairs.Unfortunately,thisisnotthecaseforWindowsandthussomesetupisrequired.ThefollowingstepsdescribeonewaytogeneratethekeypairandcopyittotheremotemachineunderWindows.(1)DownloadandinstalltheGitClientfromhttp://git-scm.com/download/win. REPASTSIMPHONYBATCHRUNSGETTINGSTARTED9nameoripaddressofthemachinetologinintoandtheSSHKeyFileistheprivatekeyleonthelocalmachineusedtoauto-logintotheremotemachine.Thisleistypicallycalledid rsaina.sshdirectoryintheuser'shomedirectory,butitmaybedierent.Whenperformingabatchrunusingaremotehost,theactivepayloadwillbecopiedtotheaccountoftheuserspeciedinthehostproperties.Afterthat,therunoccursasitdoesinthelocalversion.Thearchiveisunzippedandtheparameterspaceisdividedamongtheinstancestoberunonthatremotehost.WhentheinstancerunshaveendedtheoutputiscopiedbacktothemachinewheretheGUIwasrun,concatenatedandwrittentotheoutputdirectory.3.PreparingYourModelforBatchRunsTherstrequirementforabatchrunisthatyourmodelmustterminateeachrun.WhenrunningthemodelviatheGUIthisistypicallydonebyclickingthestopbutton.Inthebatchruncase,youmustsetandchecksometerminationconditionandthenstopthemodelifthatconditionismet.Or,setthemodeltoterminateatsomespecictick.IntheJZombiescase,therstofthesemightlooklike:if(context.getObjects(Human.class).size()==0){RunEnvironment.getInstance().endRun();}ThischeckstoseeifthereareanymoreHumansandifnotthenitcallsRunEnvironmenttoendtherun.Contexthereisthemodel'smastercontext.Somethinglikethiscouldbescheduledtoexecuteonceeverytickeithermanuallyorviaascheduledmethodonthecontextbuilder.Thesecondoptionlookslike:RunEnvironment.getInstance().endAt(30);Thisschedulesthesimulationtoendattick30.ItcanbeplacedintheContextBuilderforyourmodel.Thesecondrequirementconcernsthemodel'sleoutput.ThebatchmechanismassumesthattheoutputiscapturedusingRepastSimphony'sFileSinksandthattheleswillbewrittensomewhereinthe\instance"directorywherethemodelruns.Thebestwaytoinsurethatthisoccurstospecifythelewithonlythelenamewithoutanypathinformation.Makesurethatthelenamedoesnotbeginwitha\/"(underOSX,Linux)or\X:n"or\n"(underwindowswhereXisanydriveletter).Thenameitselfcanbeanything.Figure7isanexampleofanacceptablele.4.BatchRunModelOutputAsmentionedabovetheoutputfromeachinstancewillbeconcatenatedandcopiedintotheoutputdirectoryspeciedintheGUI.Thelesinkoutputwilllookthesameasanormalnon-batchrunexceptthattherunnumberswilllikelynotbeinnumericordergiventhattheconcatenationmakesnoaccountfororder.Forexample,theoutputfromrun11mayappearbeforethatfromrun2. 12NICKCOLLIER,JONATHANOZIK-REPASTDEVELOPMENTTEAM Figure8.ModelPanelForRunusingthatinformation.(Inwhatfollows,thelepathshavebeenshortenedforformattingpurposes.Youwillseethefulllepath).INFO[AWT-EventQueue-0]16:55:18,582repast.simphony.batch.gui.BatchConfigMediator-Writingbatchrunconfigfileto:JZombies_Demo/output/config.propsThesecondstatusmessagesaysthatthebatch params.xmllethatwascreatedviatheGUIis\unrolled"andwrittentoatemporarydirectory.\Unrolling"herereferstoexplicitlyproducingandwritingeachindividualparametercombinationtoale.Itisthisunrolledparameterlethatisdividedanddistributedtothehostsforrunning.INFO[AWT-EventQueue-0]16:55:18,588repast.simphony.batch.gui.BatchConfigMediator-Unrollingbatchparameterfile:JZombies_Demo/batch/batch_params.xmlto/var/folders/31/yd0l22kx35zgy1wbnc8p7gbr0000gr/T/unrolledParamFile.txtThenextsectionistheoutputoftheAntscript(seehttp://ant.apache.org)thatcreatesthearchivepayload.Herewecanseethecreationofaworkingdirectoryunderneathatemporarydirectory.ThisworkingdirectorywillcontainthemodelitselfandtheRepastSimphonycodenecessarytorunthemodel.The[copy]and[jar]sectionsreportmodelcodeandlesbeingcopiedintotheworkingdirectoryandthecreationofjararchives REPASTSIMPHONYBATCHRUNSGETTINGSTARTED13 Figure9.BatchPanelForRuncontainingthenecessaryrepastcode.(I'vereplacedpartofthetemporarypathwith\..."andtruncatedthejarsectionabittoimprovethereadabilityhere.)make_zip:[delete]Deletingdirectory/private/var/folders/.../working[mkdir]Createddir:/private/var/folders/.../working[mkdir]Createddir:/private/var/folders/.../working/bin[mkdir]Createddir:/private/var/folders/.../working/scenario.rs[copy]Copying2filesto/private/var/folders/.../working[copy]Copying3resourcesto/private/var/folders/.../working[copy]Copying1resourceto/private/var/folders/.../working/binmake_pre_reqs:[mkdir]Createddir:/private/var/folders/.../working/data[mkdir]Createddir:/private/var/folders/.../working/lib...[jar]Buildingjar:/private/var/folders/.../working/lib/repast.simphony.batch.jar[jar]Buildingjar:/private/var/folders/.../working/lib/repast.simphony.statecharts.jar[copy]Copying69filesto/private/var/folders/.../working/lib[jar]Buildingjar:/private/var/folders/.../working/lib/model.jar[copy]Copying10filesto/private/var/folders/.../working/scenario.rs 14NICKCOLLIER,JONATHANOZIK-REPASTDEVELOPMENTTEAM Figure10.HostsPanelForRun[move]Moving1fileto/private/var/folders/.../working/scenario.rs[jar]Buildingjar:JZombies_Demo/output/complete_model.jar[echo]Completedbuildingmodelarchive.Thearchivepayloadisthencopiedtothelocalandremotehosts.Theprocesshereisthataziparchiveiscreatedcontainingthearchivepayloadaswellassomeadditionalcongurationdata.Thisziparchiveisnamedwiththeusernamefollowedbythehosttogetherwithatimestamp(e.g.nick localhost4106394375716993975.zip).Inthecaseofalocalhost,theziparchiveiscopiedtoalocaltemporarydirectorywhosenamebeginswithsimphony model followedbyatimestamp(e.g.simphony model 1368219324898).INFO[SwingWorker-pool-1-thread-2]16:56:26,990repast.simphony.batch.ssh.LocalSession-Copyinglocally/var/folders/.../nick_localhost4106394375716993975.zipto/var/folders/.../simphony_model_1368219324898INFO[SwingWorker-pool-1-thread-2]16:56:27,411repast.simphony.batch.ssh.LocalSession-CopyingFinished.Theremotehostworkssimilarly.Theziparchiveiscopiedtoasimphony model plustimestampdirectoryontheremotehost.Inthiscase,theziparchiveisnamedubuntu ec2-107-20-23-221.compute-1.amazonaws.com8807870753490178805.zipandtheremotedirec-toryis/simphony model 1368219324898/.INFO[SwingWorker-pool-1-thread-2]16:56:09,829 16NICKCOLLIER,JONATHANOZIK-REPASTDEVELOPMENTTEAMPolledsimphony_model_1368219324898onec2-107-20-23-221.compute-1.amazonaws.comforDONE:yesINFO[pool-3-thread-1]16:56:52,796repast.simphony.batch.ssh.RemoteDonePoller-Polledsimphony_model_1368219324898onXXX.XXX.XXX.XXXforDONE:yesIftherewaserrorduringtherun,thatshouldbereportedhereaspartofthepolling.Assumingtherewasn'tthenthelocalandremoteoutputiscopiedandconcatenatedintotheoutputdirectorythatwasspeciedintheGUI.INFO[SwingWorker-pool-1-thread-2]16:56:55,630repast.simphony.batch.ssh.RemoteSession-Findingandcopyingremoteoutputfromsshtesting@XXX.XXX.XXX.XXX:simphony_model_1368219324898to/var/folders/.../sshtesting_XXX.XXX.XXX.XXXINFO[SwingWorker-pool-1-thread-2]16:56:58,412repast.simphony.batch.ssh.RemoteSession-Findingandcopyingremoteoutputfromubuntu@ec2-107-20-23-221.compute-1.amazonaws.com:simphony_model_1368219324898to/var/folders/.../ubuntu_ec2-107-20-23-221.compute-1.amazonaws.comINFO[SwingWorker-pool-1-thread-2]16:57:00,247repast.simphony.batch.ssh.LocalSession-Findingoutputonlocalhostin/var/folders/.../simphony_model_1368219324898INFO[SwingWorker-pool-1-thread-2]16:57:00,266repast.simphony.batch.ssh.SessionsDriver-AggregatingoutputintoJZombies_Demo/outputINFO[SwingWorker-pool-1-thread-2]16:57:00,267repast.simphony.batch.ssh.SessionsDriver-Finished.ElapsedTime:1.5906 Figure11.PassphraseDialog REPASTSIMPHONYBATCHRUNSGETTINGSTARTED176.RemoteMachineSetupInordertoperformarunonaremotemachinethatmachinemustbesetuptoacceptansshconnectionandyoumusthaveanaccountontheremotemachine.Oncethere-motemachinehasbeensetupforsshlogins,youthenneedtoaddyourpublickeytoitsauthorized keysleasdescribedinsection2.3.2.TheremotemachinemusthaveJava7installedanditmustbebethedefaultJava.6.1.OSX.AllowingremoteloginsonOSXisdoneusingtheSystemPreferencesonthemachineyouwanttoremotelyloginto.StartSystemPreferencesanddoubleclickonthesharingicon.SelecttheRemoteLoginasseeningure12.Makesureyouallowaccessfortheuseryouwillbelogginginas.Youshouldnowbeabletosshintotheremotemachineandcopyyourpublickeystotheserverasdescribedinlinksgiveninsection2.3.2. Figure12.EnablingSSHDonOSX6.2.Linux/Unix.ChancesareiftheremotemachineisrunningLinuxoranotherUnixvariantitisalreadysetuptoallowsshlogins.Ifnot,followyourdistributionsinstructionsforturningonthesshdservice.Youshouldnowbeabletosshintotheremotemachineandcopyyourpublickeystotheserverasdescribedinsection2.3.2. REPASTSIMPHONYBATCHRUNSGETTINGSTARTED23Wehavecoveredtherstoftheseinsection2.TheremainingtwoallowyoutolaunchthecongurationGUIandthusbatchrunswithoutlaunchingtherepastruntime.7.1.LaunchingfromEclipse.TolaunchthebatchGUIfromtheeclipselauncher,openthelaunchersfolderinyourmodel'seclipseprojectandrightclickonthelaunchlethatbeginswith\Batch"(g20).Select\RunAs"fromthepopupmenuandthentheBatchmodelentry.ThiswilllaunchthebatchGUIandloadtheselectedmodelintoit.NotethatwhenrunningviathelaunchersomeoftheoutputthatwouldnormallybeintheBatchRunGUIConsolewillshowupinEclipse'sconsole. Figure20.EclipseLauncherforBatchRunGUI7.2.LaunchingasaStandaloneApplication.TolaunchthebatchGUIasastandaloneapplicationnavigatetowhereRepastSimphonyisinstalled.Doubleclickthebatch runner.jar.8.RunningonaClusterorHPCMachineItisalsopossibletoperformbatchrunsonaclusterorahighperformancecomputing(HPC)typemachine.Suchmachinearecomposedofmanyprocessorseachofwhichcanrunoneormorebatchruninstancesandallofwhichhaveaccesstoasharedlesystem.Cluster/HPCrunswillusethepayloadarchiveproducedbytheGUIbutarenotthemselvesrunviatheGUI.Thesebatchrunswillusethejobsubmissionparadigmthatisstandardonthesetypesofmachines.TherststepforrunningamodelonanHPCmachineistocopythepayloadcom-plete model.jartotheremotemachine.Thepayloadislocatedinthemodel'soutputdirectoryandcanbecreatedusingtheBatchCongurationGUIwiththecreatearchivebutton( ).Thetransferisoftendoneviascporsimilarsecurecopymethods.Aftercopyingthepayloadtothedesiredlocation,thenextstepistounzipthepayload:unzipcomplete_model.jar