[Paraview] programmable filter, OK in serial, FAILS in mpi
A
andrealphus at gmail.com
Tue Oct 10 18:59:22 EDT 2017
I normally run Paraview on my workstation with mpi support (14 cores). It's
been working fine like this for a year.
For some reason however, the debug/output messages windows dont work when
running in mpi (e.g. print "hello", returns nothing). But they do work when
I turn mpi off.
I recently wrote a few new programmable filters, and while they work
perfectly with mpi off, the hand and dont do anything with mpi on.
Any idea?
-ashton
p.s. heres one of the filters for example;
from paraview.numpy_support import vtk_to_numpy
import vtkCommonDataModelPython
import numpy as np
from scipy.optimize import curve_fit
if type(self.GetInputDataObject(0,0)) is
vtkCommonDataModelPython.vtkUnstructuredGrid and
type(self.GetInputDataObject(0,1)) is
vtkCommonDataModelPython.vtkPolyData:
g = 0
p = 1
elif type(self.GetInputDataObject(0,1)) is
vtkCommonDataModelPython.vtkUnstructuredGrid and
type(self.GetInputDataObject(0,0)) is
vtkCommonDataModelPython.vtkPolyData:
g = 1
p = 0
else:
print('ERROR')
return
# import the grid
Vs = inputs[g].PointData['Vs']
depth = inputs[g].PointData['depth']
z = inputs[0].PointData['z']
# setup output
output.PointData.append(Vs, 'Vs')
output.PointData.append(depth, 'depth')
output.PointData.append(z, 'z')
# import the profile
Vs_profile = inputs[p].PointData['Vs']
depth_profile = inputs[p].PointData['depth']
def func(x, a, b, c, d,e):
return a + b*x + c*x**2 + d*x**3 + e*x**4
nanx = np.argwhere(np.isnan(depth_profile))
nany = np.argwhere(np.isnan(Vs_profile))
nani = np.unique(np.append(nanx,nany))
xdata = numpy.delete(depth_profile, nani)
ydata = numpy.delete(Vs_profile, nani)
popt, pcov1 = curve_fit(func, xdata, ydata)
Vs_theory = popt[0] + popt[1]*depth + popt[2]*depth**2 +
popt[3]*depth**3 + popt[4]*depth**4
diff = Vs - Vs_theory
per_diff=100*diff/Vs_theory
output.PointData.append(per_diff, 'perturbation')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20171010/d8746b90/attachment.html>
More information about the ParaView
mailing list