<div dir="ltr"><div>Glad to hear!<br><br></div>Also, thanks for replying to the list.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 17, 2017 at 4:50 AM, <span dir="ltr"><<a href="mailto:yvan.fournier@free.fr" target="_blank">yvan.fournier@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi Andy and Joachim,<br>
<br>
I adapted Andy's suggestions, and my script is now both slightly simpler (no mpi4py or numpy dependencies) and works on both machines.<br>
<br>
PS. I cc'd the ParaView mailing list, since I started this thread on it, and forgot "reply to all" in one of my own responses...<br>
<br>
Thanks again for the help, and best regards,<br>
<span class=""><br>
Yvan<br>
<br>
----- Mail original -----<br>
De: "Andy Bauer" <<a href="mailto:andy.bauer@kitware.com">andy.bauer@kitware.com</a>><br>
</span>À: "Yvan Fournier" <<a href="mailto:yvan.fournier@free.fr">yvan.fournier@free.fr</a>>, "Joachim Pouderoux" <<a href="mailto:joachim.pouderoux@kitware.com">joachim.pouderoux@kitware.com</a><wbr>><br>
Envoyé: Jeudi 16 Février 2017 16:15:03<br>
<div class="HOEnZb"><div class="h5">Objet: Re: [Paraview] Automating contour isosurface values in parallel Catalyst Python script<br>
<br>
<br>
<br>
Hi Yvan,<br>
<br>
I inlined some answers below...<br>
<br>
Best,<br>
Andy<br>
<br>
ps. I cc'ed Joachim since it looks like you meant to cc him but did not.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On Thu, Feb 16, 2017 at 6:25 AM, < <a href="mailto:yvan.fournier@free.fr">yvan.fournier@free.fr</a> > wrote:<br>
<br>
<br>
Hi Andy and Joachim,<br>
<br>
Thanks for your answers. I suspected I would need a solution of this sort.<br>
<br>
I prefer computing the min and max myself rather than adapting a Catalyst edition, as I often use full/default ParaView with OSMesa instead of Catalyst Editions (I only got a "standard" base + Python + extensions... edition working very recently; with older versions of the editions, some filter was always missing and I could not use Python scripts generated by the Coprocessing Generator plugin).<br>
<br>
<br>
<br>
I generally just use the full PV version also. It is only when I need to be very light on memory that I switch to the Catalyst editions. Others have noted that the Catalyst editions are easier to build on HPC systems though and prefer that route.<br>
<br>
<br>
<br>
<br>
I made good progress, and now have a solution which works with a 1 or 2-week-old build from the master branch, using numpy, but does not work on a build with ParaView 5.1.2 on an older machine due to missing features:<br>
<br>
- "from paraview.vtk.numpy_interface.<wbr>algorithms import *" fails, complaining it does not find numpy and tells me to check it was installed properly (it is installed, though might have been installed after the ParaView build)<br>
<br>
<br>
<br>
I do not know about this issue as I have not seen it before and was not involved with the integration. Maybe Joachim knows. Otherwise I would suggest going back to the PV mailing list.<br>
<br>
<br>
<br>
<br>
- using:<br>
controller = coprocessing.<wbr>vtkCompositeMultiProcessContro<wbr>ller.GetGlobalController()<br>
if controller and controller.IsA("<wbr>vtkMPIController") and controller.<wbr>GetNumberOfProcesses() > 1:<br>
from mpi4py import MPI<br>
comm = vtkMPI4PyCommunicator.<wbr>ConvertToPython(controller.<wbr>GetCommunicator())<br>
<br>
<br>
<br>
<br>
In cases like this I just use:<br>
<br>
import vtk<br>
<br>
controller = vtk.vtkMultiProcessController.<wbr>GetGlobalController()<br>
<br>
c.AllReduce(<in data>, <out data>, <length>, vtk.vtkCommunicator.MAX_OP)<br>
<br>
<br>
to get the max values. vtkCommunicator has the named constants for operations. The "global" communicator will be the one that Catalyst uses which may be a subcommunicator of MPI_COMM_WORLD. I'm not sure if mpi4py will be over the Catalyst MPI processes or all of them. Also, you may want to try "from paraview import vtk" instead of just "import vtk". Less VTK Python stuff should be imported then but it may be missing something you want. I don't use vtkMPI4PYCommunicator so I cannot say how well that should work for your needs.<br>
<br>
<br>
<br>
<br>
I have a "NameError: global name 'vtkMPI4PyCommunicator' is not defined" message<br>
<br>
In my earlier tests, I tried simply using the AllReduce() method from the controller, with vtkArrays, but I was stuck on finding the correct value for the last argument, which seems to be an integer describing the collective reduction operation (I need min and max). But I was unable to find any examples for this in Python, (whether Googling for examples or printing dict() and (help() of various Python objects).<br>
The documentation only specifies some methods may not be available in Python...<br>
<br>
Are there named constants describing those operations in the Python wrappers of vtkMPIController ?<br>
I assume I could find the integer values in the C++ documentation/sources, but I would rather have named constants for readability and in case of future changes.<br>
I guess using the vtkMPIController would slightly simplify the code and reduce dependancy to some external Python modules.<br>
<br>
Thanks for the help, and best regards,<br>
<br>
Yvan<br>
<br>
----- Mail original -----<br>
De: "Andy Bauer" < <a href="mailto:andy.bauer@kitware.com">andy.bauer@kitware.com</a> ><br>
À: "Joachim Pouderoux" < <a href="mailto:joachim.pouderoux@kitware.com">joachim.pouderoux@kitware.com</a> ><br>
Cc: "Yvan Fournier" < <a href="mailto:yvan.fournier@free.fr">yvan.fournier@free.fr</a> >, "ParaView" < <a href="mailto:paraview@paraview.org">paraview@paraview.org</a> ><br>
Envoyé: Mardi 14 Février 2017 21:27:06<br>
Objet: Re: [Paraview] Automating contour isosurface values in parallel Catalyst Python script<br>
<br>
<br>
<br>
<br>
<br>
<br>
Hi Yvan,<br>
<br>
Another option is just to compute it yourself. The reason that the global min and max aren't know in Catalyst is that it requires communication but many times the value isn't needed so in order to make Catalyst more efficient it doesn't compute that value for you automatically. In the Python scripts you can import mpi4py or import vtk and use the vtkMultiProcessController to do the global operation. Note that for my way you'll need to call UpdatePipeline(<wbr>datadescription.GetTime()) before getting the output and globally determining the value. Then you can set the isosurfaces values array with that information.<br>
<br>
If you try this out and have issues, please let us know and we can go from there.<br>
<br>
Cheers,<br>
Andy<br>
<br>
<br>
<br>
On Tue, Feb 14, 2017 at 3:02 PM, Joachim Pouderoux < <a href="mailto:joachim.pouderoux@kitware.com">joachim.pouderoux@kitware.com</a> > wrote:<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Hi Yvan,<br>
<br>
Regarding MinMax: this filter is indeed not exposed by any standard Catalyst edition but it is<br>
easy to add. See for instance in ParaView/Catalyst/Editions/<wbr>Extras/manifest.json how the<br>
PVExtractSelection filter is exposed (line 50 and 247).<br>
Just do the same with the MinMax filter (see proxy's declaration at filters.xml:~11725).<br>
<br>
Best,<br>
Joachim<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Joachim Pouderoux , PhD<br>
<br>
<br>
Technical Expert - Scientific Computing Team<br>
Kitware SAS<br>
<br>
<br>
<br>
<br>
2017-02-13 17:31 GMT-04:00 Yvan Fournier < <a href="mailto:yvan.fournier@free.fr">yvan.fournier@free.fr</a> > :<br>
<br>
<br>
Hello,<br>
<br>
I'm in the process of migrating some VTK scripts in the Code_Saturne (code-<br>
<a href="http://saturne.org" rel="noreferrer" target="_blank">saturne.org</a> ) test suite to Catalyst Python scripts, and am having some<br>
<br>
<br>
difficulty automating some cases using contour plots:<br>
<br>
For time-dependent data, I do not know the value ranges in advance, and would<br>
like to query them so as to build an Isosurface values array spanning that<br>
range.<br>
<br>
I can manage to access the point and cell data arrays and ther ranges, but<br>
printing the ranges in parallel, it seems I have local values only, while I need<br>
a global range.<br>
<br>
I searched for examples in the documentation, on the Wiki, ..., and found an<br>
example for MinMax, but don't seem to ba able to access the correct type of<br>
Proxy under Catalyst (the default servermanager is not connected in the usual<br>
way.<br>
<br>
For scalar bar color look-up tables, I can manage with<br>
"coprocessor.WriteImages(<wbr>datadescription, rescale_lookuptable=True)" in the<br>
coprocessing script, but for a more general case such as thar needed for contour<br>
plots, I've been running around in circles in the last hours trying to find and<br>
adapt a relevant example.<br>
<br>
Does anyone have a suggestion ? Thanks in advance,<br>
<br>
Yvan Fournier<br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/<wbr>ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/paraview</a><br>
<br>
<br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/<wbr>ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/paraview</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div>