NA-MIC National Alliance for Medical Image Computing ParaView Server Manager Berk Geveci Andy...

19
NA-MIC National Alliance for Medical Image Computing http://na-mic.org ParaView Server Manager Berk Geveci Andy Cedilnik

Transcript of NA-MIC National Alliance for Medical Image Computing ParaView Server Manager Berk Geveci Andy...

Page 1: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

NA-MICNational Alliance for Medical Image Computing http://na-mic.org

ParaView Server Manager

Berk Geveci

Andy Cedilnik

Page 2: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Outline

• Evolution of ParaView– Early ParaView– Server manager

• Server Manager– Design– Implementation

Page 3: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

http://www.paraview.org

• Parallel visualization application for large data

• Open source, cross-platform

• Distributed data model

Page 4: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

ParaView Basics

• Uses MPI for server inter-node communication• Uses sockets for client-server communication• Clients using KWWidgets, Qt as well as web

browser• Server manager:

– C++ API– XML configuration– Tcl, Python or Java scripting (optional)

• KWWidgets client:– Tcl scripting of GUI– XML configuration of GUI

Page 5: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Early ParaView

• No client. First node of the server also hosts GUI• All nodes, including client (first) node have all

process objects (readers, filters, mappers…) and Tcl commands to access them

• First node translates GUI actions to VTK Tcl commands and all nodes process these commands

• The state of the pipeline is read back using VTK Tcl commands

Page 6: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Early ParaViewMPI

On accept:vtkSphereSource sphere0sphere0 SetPhiResolution 256

On reset:this->Script(“sphere0 GetResolution”);int val = atoi(this->SetValue(this->GetLastResult));

vtkSphereSource sphere0sphere0 SetPhiResolution 256

vtkSphereSource sphere0sphere0 SetPhiResolution 256

Page 7: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Lessons Learned:Client-Server Separation• It is not always possible to access the

display of the first node of a supercomputer

• Separate client. Client connects to server through TCP/IP socket

• Client does not hold data, only GUI• Client has a dummy, empty pipeline to

store state• Client sends VTK Tcl commands to server

Page 8: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Client-Server SeparationMPI

TCP/IP

On accept:vtkSphereSource sphere0sphere0 SetPhiResolution 256

On reset:this->Script(“sphere0 GetResolution”);this->SetValue(this->GetLastResult);

Page 9: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Lessons Learned: Issues

• Tcl based communication:– String based. Imprecise and inefficient.– Standard Tcl interpreter is not secure.

• Dummy pipeline on client:– VTK pipeline objects are not designed to only

store state. Some objects misbehave when disconnected or empty.

– Communication with server is still necessary to obtain information about distributed data.

– Client must be linked to all VTK + VTK Tcl libs.

Page 10: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Server Manager

Objectives:• Binary communication with server where possible• Replace empty pipeline on client with a proxy

representation• Separation of pipeline management from GUI to

support multiple client types• Provide default implementation of complicated,

parallel pipeline and rendering architecture to make client development easy and to reuse code

Page 11: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Client-Server Streams

• Simple communication mechanism• Binary (except method names)• Only allows access to selected VTK

objects (can be made secure)

vtkClientServerStream stream;stream << vtkCSS::New << “vtkSphereSource” << id << vtkCSSEnd;stream << vtkCSS::Invoke << id << “SetResolution” << 256 << vtkCSS:End;interpreter->ProcessStream(stream);orcommunicator->Send(stream);

Page 12: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Server Manager - Proxies

• Based on proxy design pattern

• Proxies are responsible of– Creating server-side VTK objects– Maintaining references to server-side

VTK objects using ids– Maintaining a copy of the state of the

server-side objects using properties

Page 13: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Server Manager - Properties

• Maintain the state of the server-side objects

• Each property has a set of values and one or more commands to set or get them

Page 14: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Server Manager – Proxy Manager

• Responsible of maintaining proxies

• Configured through xml description files

• Provides API to create and initialize proxies

• Provides API to save state as xml

Page 15: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Server Manager - Example

<SourceProxy name="SphereSource" class="vtkSphereSource"> <IntVectorProperty name="PhiResolution" command="SetPhiResolution" number_of_elements="1" default_values="8" > <IntRangeDomain name="range" min="3" max="1024" /> </IntVectorProperty> </SourceProxy>

Page 16: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Server Manager Example vtkSMProxy* sphereProxy = vtkSMObject::GetProxyManager()->NewProxy(“sources”, “SphereSource”));

vtkSMIntVectorPropery* prop = sphereProxy->GetProperty(“PhiResolution”);

int curVal = prop->GetElement(0);cout << “Current value: “ << curVal << endl;

int val=256;int res = prop->SetElement(0, val);if (!res){ cerr << “Value “ << val << “ is not valid” << endl; return;}sphereProxy->UpdateVTKObjects();

Page 17: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Server Manager Example

• NewProxy(): Creates a proxy and associated properties based on xml, client side only

• UpdateVTKObjects():– First time: Creates actual VTK objects

on all associated server nodes– Pushes modified property values to all

nodes

Page 18: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Server Manager - Summary

• Creates and maintains VTK objects on one or more server nodes• Maintains state on the client side and synchronizes the state with

server (push or pull)• Provides domain checking• Animation support• Specially designed to work with parallel VTK• Has default composite proxies designed for

– parallel processing – rendering: sort-first, sort-list, large tiled display modules

• Helper classes to gather information from server (for example, total bounds or total number of points of a distributed data object)

• Configurable through xml (compile-time or run-time)• Supports loading of modules in the form of dynamic libraries

(libraries are loaded on server side)

Page 19: NA-MIC National Alliance for Medical Image Computing  ParaView Server Manager Berk Geveci Andy Cedilnik.

National Alliance for Medical Image Computing http://na-mic.org

Resources

• http://www.paraview.org

• ParaView mailing list

• ParaView Guide