PvPython and PvBatch: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
Line 104: Line 104:


=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 National Laboratories is a multi-mission laboratory managed and operated by National Technology and Engineering Solutions of Sandia, LLC., a wholly owned subsidiary of Honeywell International, Inc., for the U.S. Department of Energy’s National Nuclear Security Administration under contract DE-NA-0003525.

Revision as of 20:36, 22 June 2017

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.

Example scripts

Here are four examples. We are going to create scripts using the trace recorder, then run these scripts using pvbatch.

Note that we are working around a PV 4.4/5.0 bug in the lines below that talk about SetScalarBarVisibility.
  • Read exodus data, screenshot, movie.
    • Run ParaView.
    • Start Trace
    • Read g1s1.e.16.[0-15]
    • Go to last timestep
    • Go back one timestep
    • Color by EQPS
    • Screenshot
    • Animation
    • Stop trace
    • Save this script on your cluster.
    • Edit the file, change the following:
      • Correct the path to the input data and output screenshots or animations
      • Uncomment the line that says renderView*.ViewSize. Change this to something reasonable (maybe 1920x1080)
      • Add the following line above ColorBy(....,('EQPS'))
        • g1s110fpse16Display.SetScalarBarVisibility(renderView1, False)
  • Read exodus data, Clip, Slice, screenshot, movie.
    • Run ParaView.
    • Start Trace
    • Read g1s1.e.16.[0-15]
    • Go to last timestep
    • Go back one timestep
    • Color by EQPS
    • Clip
    • Slice/ Y Normal
    • Screenshot
    • Animation
    • Stop trace
    • Save this script on your cluster.
    • Edit the file, change the following:
      • Correct the path to the input data and output screenshots or animations
      • Uncomment the line that says renderView*.ViewSize. Change this to something reasonable (maybe 1920x1080)
      • Add the following line above ColorBy(....,('EQPS'))
        • g1s110fpse16Display.SetScalarBarVisibility(renderView1, False)
  • Read exodus data, 2d plots, screenshot, movie
    • Run ParaView.
    • Start Trace
    • Read g1s1.e.16.[0-15]
    • Select point if possible
    • Plot selection (or plot over line, if necessary)
    • Plot EQPS
    • Screenshot
    • Animation
    • Stop trace
    • Edit the file, change the following:
      • Correct the path to the input data and output screenshots or animations
      • Uncomment the line that says renderView*.ViewSize. Change this to something reasonable (maybe 1920x1080)
  • Read cth data, extractCTHPart, screenshot, movie.
    • Run ParaView.
    • Start Trace
    • Read cth-med/spcta.[0-31]
    • ExtractCTHParts - 1
    • ExtractCTHParts - 2
    • Stop trace

Where do you go next?

  • Python calculator and programmable fitler.

Acknowledgements

Sandia National Laboratories is a multi-mission laboratory managed and operated by National Technology and Engineering Solutions of Sandia, LLC., a wholly owned subsidiary of Honeywell International, Inc., for the U.S. Department of Energy’s National Nuclear Security Administration under contract DE-NA-0003525.