[Paraview] PythonScriptCoProcessingExample mpirun Problem

peacemaker peacemaker1 at web.de
Tue Dec 6 03:31:43 EST 2011


Hi,

Im trying to run the PythonScriptCoProcessingExample(.cxx) included in ParaView sourcecode - this is my first "getting in touch" with MPI + ParaView (and Coprocessing of course) so maybe it`s just a very simple problem. I already succesfully compiled Paraview with Coprocessing and python (Ubuntu 11.10) and I`m running the source with COPROCESSOR_USE_MPI. 
When I run it like: 
mpirun -n 1 ./CoProcessing ./PythonScriptTest.py 
then I get as result CPGrid0_mpirun1.png and CPPressure0_mpirun1.png - looks good.
If I try:
mpirun -n 2  ./CoProcessing ./PythonScriptTest.py 
then I get as result CPGrid0_mpirun2.png and CPPressure0_mpirun2.png - these pictures seem to be incorrect. 
In vtkPVCustomTestDriver.cxx there are source lines like:
...
#ifdef COPROCESSOR_USE_MPI
  myid = vtkMPICommunicator::GetWorldCommunicator()->GetLocalProcessId();
#endif
....
gridBuilder->SetSpacing(spacing);
  double origin[3] = {myid*49*.2,20,300};
.....
If I understand it correctly there should be just a shift on the x-axis between the grids? The pictures get more and more messy, when I increase the numer of processes.
After little messing around with the pyton-script needed to run this example (see bottom of this Mail) I got the following output when running it with mpirun -n 3: CPPressure0_changedscript_mpirun3.png. The halfs of the 2nd and 3rd grid are missing.

What am I doing wrong? Is this example not supposed to be run with MPI? How does Coprocessing merge the data from different processes and how does the picture get built?

I already tested this on a different PC with the same result. I hope you can help me.  

Best wishes

Marek


changed Python Script:
def DoCoProcessing(datadescription):
  timestep = datadescription.GetTimeStep()

  grid = datadescription.GetInputDescriptionByName("input").GetGrid()
  pressure = grid.GetPointData().GetArray('Pressure')

#  print grid

  #grid.GetPointData().SetScalars(pressure)
  obj.SetOutput(grid)
#  print obj

  # get global range of Pressure
  di = trivialproducer.GetDataInformation(0)
  trivialproducer.UpdatePipeline()
  di.Update()
  pdi = di.GetPointDataInformation()
#  print pdi
  ai = pdi.GetArrayInformation('Pressure')
  pressurerange = ai.GetComponentRange(0)

  contour.Isosurfaces = .5*(pressurerange[0]+pressurerange[1])

  # now output the results to the screen as well as taking
  # a screen shot of the view
  #setup a window
  #rep = Show(contour)
  #ren = Render()

  #set the background color
  #ren.Background=[1,1,1]  #white

  #set image size
  #ren.ViewSize = [1000, 1000] #[width, height]

  #set representation
  #rep.Representation="Surface"

  #save screenshot
  #gridimagefilename = 'CPGrid'+str(timestep) + '.png'
  #WriteImage(gridimagefilename)

  rep = Show(trivialproducer)
  #rep.LookupTable = MakeBlueToRedLT(pressurerange[0], pressurerange[1])
  #rep.ColorArrayName = 'Pressure'
  #rep.ColorAttributeType = 'POINT_DATA'
  #set representation
  rep.Representation="Wireframe"
  #rep = Show(contour)
  #set the background color
  ren = Render()
  ren.Background=[0,0,0]  #white
  ren.ViewSize = [1000, 1000] #[width, height]

  pressureimagefilename = 'CPPressure'+str(timestep) + '.png'
  WriteImage(pressureimagefilename)
  return

def RequestDataDescription(datadescription):
  time = datadescription.GetTime()
  timestep = datadescription.GetTimeStep()
  print timestep
  if timestep % 20 == 0:
    # add in some fields
    #print 'added Pressure and wanting to do coprocessing'
    datadescription.GetInputDescriptionByName("input").AddPointField("Pressure")
    datadescription.GetInputDescriptionByName('input').GenerateMeshOn()
  return

# the code below is needed to import objects from paraview.simple
# plus the definition of vtkTrivialProducer into this python script.
try: paraview.simple
except: from paraview.simple import *

trivialproducer = TrivialProducer()
contour = Contour(Input=trivialproducer)

obj = trivialproducer.GetClientSideObject()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20111206/8508b60c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CPGrid0_mpirun1.png
Type: image/png
Size: 1538 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20111206/8508b60c/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CPPressure0_mpirun1.png
Type: image/png
Size: 3113 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20111206/8508b60c/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CPGrid0_mpirun2.png
Type: image/png
Size: 1677 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20111206/8508b60c/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CPPressure0_mpirun2.png
Type: image/png
Size: 3936 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20111206/8508b60c/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CPPressure0_changedscript_mpirun3.png
Type: image/png
Size: 6145 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20111206/8508b60c/attachment-0009.png>


More information about the ParaView mailing list