Client Side Delivery

From ParaQ Wiki
Revision as of 16:01, 12 January 2007 by DaveDemarle (talk | contribs) (add example script)
Jump to navigationJump to search

The goal of client side delivery is to provide functions that can be called from a python script to perform a parallel aggregation of data and return the result to the client. This goal is accomplished with a combination of new, modified, and existing filters. A wrapper filter that automates the creation and control of the necessary pipeline of proxies is under development.

Design

vtkSMGenericViewDisplayProxy
This filter orchestrates gathering results in paraview for the GUI. The filter internally uses a vtkReductionFilter to direct communications between the server nodes and a vtkClientServerModeData filter that transmits data from the server to the client. For our purposes we use vtkSMGenericViewDisplayProxy's FIRST_NODE_ONLY reduction type setting, which simply transmits data from the root node of the server to the client.
vtkReductionFilter
This filter does the communication needed to perform the aggregation. This filter defers all data manipulation and defers this to a user provided algorithm. The filter has been modified to run an additional user provided algorithm, which each node executes in parallel _before_ sending their data to the root node. This pregather algorithm is essential for scalability. After the root node obtains the intermediate results from all nodes, it runs a user provided algorithm as before. Both pre and post gather algorithms can refer to the same objects. The vtkMinMax filter was designed to work in this manner. The filter has also been modified to allow simple passthrough of data and to be able to pass though any one particular cluster node's data.
vtkMinMax
A new filter that performs an operation on the attribute data of its input. This filter iterates through whatever datasets it is given and calls a templated operate function on each value. The templated function is necessary to avoid double conversion and loss of precision on non double valued arrays. This filter can take one or more input datasets on its first input port and produces a single unstructured grid output that contains exactly one point and one cell.

Example use

import paraview
#connect to a running pvserver
paraview.ActiveConnection = paraview.Connect("localhost", 11111)
#create a sample data set
sphere = paraview.CreateProxy("sources", "SphereSource")
elev = paraview.CreateProxy("filters", "ElevationFilter")
elev.SetInput(sphere)
#create the reduction pipeline
fetch = paraview.CreateProxy("displays", "GenericViewDisplay")
fetch.SetInput(elev)
fetch.SetReductionType(3) #collect from root node only
#tell fetch that its vtkReductionFilter should use the new vtkMinMax
#algorithm on each node and on the root node on the gathered results
op1 = paraview.CreateProxy("filters", "Operator")
op1.SetOperation(0) #min as opposed to max
op1.UpdateVTKObjects()
fetch.SetPreReductionHelper(op1)
fetch.SetReductionHelper(op1)
#this next line can be uncommented to see just the result from node 1
#fetch.SetPassThrough(1) 
fetch.UpdateVTKObjects()
#go!
fetch.Update()
#the result will be stored in the first (and only) tuple of each array
out = fetch.GetOutput()
arr = out.GetPointData().GetArray("Elevation")
arr.GetValue(0)