ParaView/Users Guide/Batch Processing
ParaView's pvbatch and pvpython command line executables substitute a python interpreter for the Qt GUI interface that most users use to controls ParaView's back end data processing and rendering engine. Either may be used for batch processing, that is to play Visualization sessions that have been recorded and/or programmed and modified in an exact and easily repeated way.
Of the two pvbatch is more specialized for batch processing because:
- it is mated with to the backend server and thus does not require TCP socket connections to it
- can be run directly as an MPI parallel program
- does not take in commands from the terminal.
All of these mean that pvbatch is runnable even on dedicated data processing supercomputers. In this section we will focus primarily on using pvbatch. Note that in many cases the same techniques can be used in standard pvpython scripts.
To begin, since pvbatch does not accept input from the terminal, realize that one must always supply the filename of a python script that pvbatch is to execute.
Next note that unlike pvpython scripts it is not possible to Disconnect() from or Connect() to a server. This is so because pvbatch's python interpretter is directly connected to its own server.
[mpiexec -N <numprocessors>] pvbatch [args-for-pvbatch] script-filename [args-for-script]
- loading state file example
<source lang="python"> >>> from paraview.simple import *
- Load the state
>>> servermanager.LoadState("/Users/berk/myteststate.pvsm")
- Make sure that the view in the state is the active one
>>> SetActiveView(GetRenderView())
- Now render
>>> Render()
- Get the list of sources
>>> GetSources() {('Sphere1', '5'): <paraview.servermanager.Sphere object at 0xaf80e30>, ('Shrink1', '11'): <paraview.servermanager.Shrink object at 0xaf80df0>, ('Cone1', '8'): <paraview.servermanager.Cone object at 0xaf80cf0>}
- Change the resolution of the cone and render again
>>> FindSource("Cone1").Resolution = 32 >>> Render() </source>
- parameter study example
Parameter studies are one example of how batch processing can be very useful. In a parameter study one or more pipeline parameters (a filename or a timestep for example) is varied across some range but an otherwise identical script is replayed numerous times and results are saved. After the suite of sessions complete the set of results are compared.
- large data example
Another important example is for visualizing extremely large datasets that can not be easily worked with interactively. In this setting, the user first constructs a visualization off a small but representative data set. Typically this takes place by recording a session in the standard GUI client running on some small and easily accessed machine. Later, the user edits the filename property of the reader in the recorded session file to point to the large full resolution data. Finally the user submits the script to a larger machine which performs the visualization and saves off results offline.