820 likes | 1.05k Views
Co-processing with ParaView (HPC Visualization with ParaView ). Shuaib Arshad. April 2, 2014. Agenda. I n t rodu ct ion t o Para V iew C a t al y s t C a t al y s t f or U s ers C a t al y s t f or D e v elopers. Online H e lp. E m ail li s t : para v ie w @para v ie w . org
E N D
Co-processing with ParaView(HPC Visualization with ParaView) Shuaib Arshad April 2, 2014
Agenda • IntroductiontoParaViewCatalyst • Catalyst forUsers • Catalyst forDevelopers
OnlineHelp • Emaillist:paraview@paraview.org • Doxygen: • – http://www.vtk.org/doc/nightly/html/classes.html • – http://www.paraview.org/ParaView3/Doc/Nightly/html/classes.html • Sphinx: • http://www.paraview.org/ParaView3/Doc/Nightly/www/py-doc/index.html • Websites: • http://www.paraview.org • http://catalyst.paraview.org • Examples: • https://github.com/acbauer/CatalystExampleCode
WhyInSitu? DOEExascaleInitiativeRoadmap,Architectureand TechnologyWorkshop,SanDiego,December,2009.
Two ways to run Simulation Simulation Separate MPI Catalyst Catalyst Disk Storage Disk Storage Visualization Visualization
HighLevelView • SimulationDevelopers • Passnecessarysimulation • datato ParaView • Need sufficientknowledge • ofbothcodes • VTKforgridsandfielddata • ParaViewCatalystlibraries • Transparentto simulation • users • Extensible • SimulationUsers • Knowledge of ParaViewas apost-processing/analysis tool • BasicinteractionwithGUI co- processingscriptgenerator plugin • Incrementalknowledge increasetousetheco- processingtoolsfrombasic ParaViewuse • Programmingknowledge canbeusefultoextend the tools
UserPerspective Simulation # Createthereaderandsetthe filename. reader= servermanager.sources.Reader(FileNames=path) view= servermanager.CreateRenderView() repr= servermanager.CreateRepresentation(reader, view) reader.UpdatePipeline() dataInfo =reader.GetDataInformation() pDinfo=dataInfo.GetPointDataInformation() arrayInfo = pDInfo.GetArrayInformation("displacement9") ifarrayInfo: #getthe rangeforthemagnitudeof displacement9 range=arrayInfo.GetComponentRange(-1) lut=servermanager.rendering.PVLookupTable() lut.RGBPoints =[range[0],0.0,0.0,1.0, range[1], 1.0,0.0,0.0] lut.VectorMode="Magnitude" repr.LookupTable=lut repr.ColorArrayName="displacement9" repr.ColorAttributeType="POINT_DATA" Augmented scriptin inputdeck. ScriptExport Catalyst Output Processed Data PolygonalOutput withFieldData Statistics SeriesData RenderedImages
DeveloperPerspective Catalyst Solver function calls function Co-processing calls Adaptor API INITIALIZE() ADDPIPELINE(inpipeline) REQUESTDATADESCRIPTION(intime,out fields) COPROCESS(invtkDataSet) FINALIZE()
DeveloperPerspective 0.1 0.09 0.08 0.07 0.06 0.05 0.04 0.03 0.02 0.01 0 0.5 0.45 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0 DecimateTime(sec) SliceTime(sec) 0 5000 10000 15000 20000 25000 30000 35000 0 5000 10000 15000 20000 25000 30000 35000 Cores Cores Slice Decimate
CreatingCatalystOutput • Twomainways: • Createand/ormodifyPythonscripts • ParaViewGUI plugintocreatePythonscripts • Modification withknowledgeofParaView PythonAPI • Developergenerated“canned”scripts • User provides parametersforalready created • Catalyst pipelines • User maynotevenneedtoknowParaView • SeeParaViewCatalystUser’sGuide
CreatePythonScriptsfrom ParaView • InteractwithParaViewnormally • Exportascriptthatmimics thatinteraction • Queries duringeachco-processingstep • –(oneframeata time)
ParaViewGUIPlugin • SimilartousingParaViewinteractively • Setupdesiredpipelines • Ideally,startwitharepresentativedatasetfromthe simulation • Extrapipelineinformationtotellwhattooutput duringsimulationrun • Addindataextractwriters • Createscreenshotstooutput • Bothrequirefilenameandwritefrequency
InSituDemo • CreateaParaViewCatalyst Pythonpipeline • script • Specifydesiredoutputsfromrun • Export thescript • Runthescriptwithafictitiousinput • Timedependentgridandfielddatacomefromafile • insteadoffromanactualsimulation • Examineresults
In Situ Demo–CreatingaCatalyst PythonScript • Loadcan.ex2 • – Notethatthereare44timesteps • Createdesiredpipeline
InSituDemo–AddinginWriters • Parameters: • FileName–%tgets • replacedwithtimestep • WriteFrequency
InSituDemo–SelectInputs • Usually only asingleinputbutcanhavemultiple • inputs
InSituDemo–SelectInputs • Eachpipelinesourceisapotentialinput
InSituDemo–MatchUpInputs • Sourcename(e.g.“can.ex2”)needstobe • matchedwithstringkeyinadaptor(e.g.“input”)
In Situ Demo– GeneratinganImage • Parameters/Options: • Livevisualization • RescaletoData • Range(allimages) • Individualimages • ImageType • FileName • WriteFrequency • Magnification • FittoScreen • %tgetsreplaced with timestep
In Situ Demo– GeneratingTwoImages • Parameters/Options: • Livevisualization • RescaletoData • Range(allimages) • Individualimages • ImageType • FileName • WriteFrequency • Magnification • FittoScreen
In Situ Demo–Write OuttheScript • Generatedscriptwilllook • somethinglikethis defDoCoProcessing(datadescription) input=CreateProducer(datadescription "input" ParallelMultiBlockDataSetWriter1=CreateWriter( XMLMultiBlockDataWriter "filename_%t.vtm"1
InSituDemo–RuntheScript • Putcandriver.py andthegeneratedPythonscript • inthesamedirectory • LinuxandMacfromaterminal • <path>/pvpythoncandriver.py<generatedscript> • <path>/can.ex2 • Windowsfromacommandprompt • start“simpleexample” <path>/pvpython.exe • candriver.py <generatedscript> <path>/can.ex2
LiveInSitu AnalysisandVisualization • Everythingbeforethis was“batch” • Presetinformationwithpossible logic • “Beta”functionalityforinteractingwithsimulation • dataduring simulationrun • WhenexportingaPythonscript,select“Live Visualization” • Duringsimulationrunchoosethe“Tools->Connectto • Catalyst” GUI menuitem
LiveInSitu Example • LinuxandMacfromaterminal • <path>/pvpythonlivecoprocessing.py<path>/can.ex2 • Windowsfromacommandprompt • start“simpleexample” <path>/pvpython.exe • livecoprocessing.py<path>/can.ex2 • StartParaViewandselectTools→Connectto • Catalyst • Selectport(22222is default)
LiveInSitu Example • Onlytransferrequested datafromserver (simulationrun)to client • –ExtractSurface1is • alreadygettingextracted • Use onclient tostoptransferringto client • Clickon totransfer toclientfromCatalyst
ParaViewPipelineConcept • Fundamentalconceptin • ParaView • Directedacyclic graph specifyinghow toprocess information • Filtersarenodes inthegraph • Performacertainactionona dataset(gridandfields) • Contours,streamlines,fileIO,etc. • Do notmodifyinputdataset • Catalyst executes user • pipelinesatspecifiedtimes
CatalystPipelines • UsergeneratedPythonscriptsfromthe • ParaViewplugin • ExecutedwithvtkCPPythonScriptPipeline • Hard-coded pipelines(“canned”output) • Executedwithaclassthatderives fromvtkCPPipeline
vtkCPPythonScriptPipeline • TypicallyfromParaViewscriptgeneratorplugin • InitializefromapathtoaParaViewCatalyst Pythonscript • –vtkCPPythonScriptPipeline::Initialize(constchar* • fileName) http://www.paraview.org/ParaView3/Doc/Nightly/html/classvtkCPPythonScriptPipeline.html
vtkCPPythonScriptPipeline(2) • Advantages • EasilycreatedthroughParaViewplugin • Output shouldbemoderatelyreadable • Encourageadvanceduserstomodify • CanuseParaView’sPythontraceutilityto seeoptions • View/screenshotsettings canbedifficulttoset • Cameraangle,zoom,lighting,datarepresentations,etc. • Takescareofparallel imagecompositing • Canmodifywithoutrecompiling
vtkCPPythonScriptPipeline(3) • Disadvantages • Slightoverheadcomparedto C++hard-coded pipeline • Roughly 10-5 secondsper timestep • Simulationcode mustbelinkedwithPython • Staticbuildissues • More complextominimizeexecutablesize
Hard-codedPipelines • DerivesfromvtkCPPipeline • GenerallyC++butcouldbePythoncode • MostaredonedirectlycreatingVTKfiltersand connectingthemtogether • Creatingscreenshotsfromrenderingpipelinewith compositingcanbedaunting • PossibletodousingParaViewC++proxies • Lowlevelaccessis morecomplex • Simplersetupforrenderingpipeline • Lessdependencies forcompilingandlinking http://www.paraview.org/ParaView3/Doc/Nightly/html/classvtkCPPipeline.html
Catalyst • Catalyst’sjobis tocreateandexecutepipelines
DataStructures • Simulationhasseparatedatastructuresfrom • VTKdatastructures • Useranadaptortobridgethegap • Trytoreuseexistingmemory • Alsoresponsibleforotherinteractionsbetween • simulationcodeandCatalyst Solver Adaptor
InformationFlow Solver Adaptor • Initialization • –Informationforcreatingpipelines
InformationFlow Pipeline Pipeline Solver Adaptor Pipeline • Aftersimulationcompletestimestepupdate • Time,timestep,forceoutputflag • Informationforcreatinggridandfieldinformation
InformationFlow Pipeline Pipeline Solver Adaptor Pipeline • Aftersimulationcompletestimestepupdate • –Time,timestep,forceoutputflagpassedtoeach • pipeline
InformationFlow Pipeline Pipeline Solver Adaptor Pipeline • Aftersimulationcompletestimestepupdate • –Flagindicatingwhichpipelines needtobe • executed/updated
InformationFlow Pipeline Pipeline Solver Adaptor Pipeline • Aftersimulationcompletestimestepupdate • Ifanypipelineneedstobeexecuted • Adaptorcreates VTKobjectsto representgridsandfields
InformationFlow Pipeline Pipeline Solver Adaptor Pipeline • Aftersimulationcompletestimestepupdate • –PassVTKdataobject representinggridsandfields • topipelinesthatneedtoexecute/update
InformationFlow Pipeline Pipeline Solver Adaptor Pipeline • Aftersimulationcompletestimestepupdate • –Pipelinesexecute andoutputdesiredinformation