PvPython and PvBatch: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(Created page with "=Introduction= ParaView offers a rich and powerful Python interface. This allows users to automate processing of their data, and gives access to powerful tools in the Visuali...")
 
No edit summary
Line 1: Line 1:
=Introduction=
=Introduction=
ParaView offers a rich and powerful Python interface.  This allows users to automate processing of their data, and gives access to powerful tools in the Visualization Tool Kit (VTK).  This tutorial will describe ParaView and Python. It shows a user how to drive ParaView using Python commands, and how to automate the creation and use of these commands.
ParaView can run without opening the ParaView GUI, and is controlled through Python.   There are two Python interfaces - PvPython and PvBatch.


=PvPython=
=PvPython=
ParaView is a client/ server architecture. The client includes the ParaView GUI and display.  The server reads the user's data, processes the data, and passes these images to the clientWe can use Python to control ParaView either in the GUI, at the client level, or directly on the server.
PvPython is the Python intreface to ParaView.  You can think of PvPython as ParaView with a Python interface.  As we did with the Python Shell, you can manually type in commands to pvpython .  PvPython can also read Python command files.  For instance,
:'''fullPathToPvPython/pvpython fullPathToPythonCommandFile/commandFile.py'''
 
:'''d:\alan\paraview\pvpython d:\alan\scripts\disk_out_ref-A.py
 
*You will notice that pvpython will run the script and then exit.  The output of the script is a screenshot or or other data product.
*Anywhere that needs editing in the scripts above will be marked by the string '''editMeHere'''.
*You will need to hard code in the paths to your data, and paths for output products.
*The first time you run a script with pvpython, the output will be a postage stamp sized windowYou can change this by finding and uncommenting the line '''renderView1.ViewSize'''.
 
 
: Try making and running a script of your own.  Alternatively, try running the scripts available on the ParaView and Python wiki page.




=PvBatch=
=PvBatch=
PvBatch is like PvPython, with two exceptions.  PvBatch only accepts commands from input scripts, and PvBatch will run in parallel if it was built using MPI.  Input is exactly like PvPython.


=Sandia National Labs specific section=
=Sandia National Labs specific section=
This section is specific to the clusters and environment at Sandia National Laboratories. 


==PvBatch on the clusters==
==PvBatch on the clusters==
ssh into one of the clusters.  PvBatch can be run on the login nodes, and magically will acquire compute nodes and run your batch visualization in parallel.  You will find test scripts at /projects/viz/training/paraview.  These scripts are run as follows:
:'''/projects/viz/paraview/bin/pvbatch_redsky_mesa'''
:This is version 4.4.0 of pvbatch.
:Incorrect number of argument supplied. Expecting 4 but have 0
:Usage: /projects/viz/paraview/bin/pvbatch_redsky_mesa <Nodes> <Minutes> <HERT estimate> batchFileFullPath
:An example is
:'''/projects/viz/paraview/bin/pvbatch_redsky_mesa 1 10 FY123456 /projects/viz/training/paraview/whipple-A.py'''


==PvBatchOnNode on the clusters==
==PvBatchOnNode on the clusters==
pvbatch can be run on the same nodes as your simuation.  Ask ParaView help for more information on how to use this feature.




=Where do you go next?=
=Where do you go next?=
*ParaView Batch.
*Python calculator and programmable fitler.


=Acknowledgements=
=Acknowledgements=
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000.
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000.

Revision as of 01:50, 11 December 2015

Introduction

ParaView can run without opening the ParaView GUI, and is controlled through Python. There are two Python interfaces - PvPython and PvBatch.

PvPython

PvPython is the Python intreface to ParaView. You can think of PvPython as ParaView with a Python interface. As we did with the Python Shell, you can manually type in commands to pvpython . PvPython can also read Python command files. For instance,

fullPathToPvPython/pvpython fullPathToPythonCommandFile/commandFile.py
d:\alan\paraview\pvpython d:\alan\scripts\disk_out_ref-A.py
  • You will notice that pvpython will run the script and then exit. The output of the script is a screenshot or or other data product.
  • Anywhere that needs editing in the scripts above will be marked by the string editMeHere.
  • You will need to hard code in the paths to your data, and paths for output products.
  • The first time you run a script with pvpython, the output will be a postage stamp sized window. You can change this by finding and uncommenting the line renderView1.ViewSize.


Try making and running a script of your own. Alternatively, try running the scripts available on the ParaView and Python wiki page.


PvBatch

PvBatch is like PvPython, with two exceptions. PvBatch only accepts commands from input scripts, and PvBatch will run in parallel if it was built using MPI. Input is exactly like PvPython.


Sandia National Labs specific section

This section is specific to the clusters and environment at Sandia National Laboratories.


PvBatch on the clusters

ssh into one of the clusters. PvBatch can be run on the login nodes, and magically will acquire compute nodes and run your batch visualization in parallel. You will find test scripts at /projects/viz/training/paraview. These scripts are run as follows:


/projects/viz/paraview/bin/pvbatch_redsky_mesa
This is version 4.4.0 of pvbatch.
Incorrect number of argument supplied. Expecting 4 but have 0
Usage: /projects/viz/paraview/bin/pvbatch_redsky_mesa <Nodes> <Minutes> <HERT estimate> batchFileFullPath
An example is
/projects/viz/paraview/bin/pvbatch_redsky_mesa 1 10 FY123456 /projects/viz/training/paraview/whipple-A.py


PvBatchOnNode on the clusters

pvbatch can be run on the same nodes as your simuation. Ask ParaView help for more information on how to use this feature.


Where do you go next?

  • Python calculator and programmable fitler.

Acknowledgements

Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000.