[Paraview] [Catalyst] Setting the MPI Comm in Python
Andy Bauer
andy.bauer at kitware.com
Thu Mar 10 10:48:54 EST 2016
Hi Yohann,
Thanks for the info!
If you get some interesting results it would be great if you could share
it. We've recently created some highlighted applications that use Catalyst
at http://www.paraview.org/catalyst-adaptors/. If you'd like to have a
section there on elsA, I'd be more than happy to add it in.
Best,
Andy
On Thu, Mar 10, 2016 at 5:37 AM, VAUTRIN Yohann (SAFRAN) <
yohann.vautrin at safran.fr> wrote:
> Hi Andy,
>
>
>
> I’m using elsA, a CFD package developed by ONERA in France. I was given a
> few links by the project manager if you want more information about the
> software:
>
> • An Overview of the Multi-Purpose elsA Flow Solver (
> http://www.aerospacelab-journal.org/sites/www.aerospacelab-journal.org/files/AL2-10.pdf
> )
>
> • Advanced Aerodynamic Applications with the elsA Software (
> http://www.aerospacelab-journal.org/sites/www.aerospacelab-journal.org/files/AL2-12.pdf
> )
>
> • The Onera elsA CFD software : input from research and
> feedback from industry - L. Cambier, S. Heib, S. Plot - Mechanics &
> Industry, 2013
>
>
>
> elsA is written in C++ (plus some Fortran routines) but possesses a user
> interface in Python. I’m using a mechanism in the code that calls a Python
> script when the internal finish state machine changes state (e.g.: at each
> increment, before the computation, at the end, …).
>
>
>
> Hope that answers your question. Let me know if you want more information
> ;).
>
>
>
>
>
> Yohann
>
>
>
> *From:* Andy Bauer [mailto:andy.bauer at kitware.com]
> *Sent:* Wednesday, March 09, 2016 4:41 PM
>
> *To:* VAUTRIN Yohann (SAFRAN)
> *Cc:* paraview at paraview.org
> *Subject:* Re: [Paraview] [Catalyst] Setting the MPI Comm in Python
>
>
>
> Hi Yohann,
>
> Glad to hear that you were able to get it working! By the way, what
> simulation code are you instrumenting to use Catalyst if you don't mind
> saying? I'd be interested to know how it works for you.
>
> Best,
>
> Andy
>
>
>
> On Wed, Mar 9, 2016 at 5:34 AM, VAUTRIN Yohann (SAFRAN) <
> yohann.vautrin at safran.fr> wrote:
>
> Hi Andy,
>
>
>
> Thank you for your feedback, it helped me solve my problem.
>
>
>
> If anyone is having a similar problem, what I ended up doing is:
>
> *import mpi4py.MPI as MPI*
>
> *import vtk*
>
> *comm = MPI.COMM_WORLD*
>
> *rank = comm.Get_rank()*
>
> *size = comm.Get_size()*
>
> *in_subcomm = [0,3,6,9] # list of ranks to include in the VTK communicator*
>
> *subcomm = comm.Split(1 if rank in in_subcomm else 0,rank)*
>
> *#--- In another part of the program called only by the procs in
> in_subcomm*
>
> *vtkComm = vtk.vtkMPI4PyCommunicator.ConvertToVTK(subcomm)*
>
> *vtkCont = vtk.vtkMPIController()*
>
> *vtkCont.SetCommunicator(vtkComm)*
>
> *vtk.vtkMPIController.SetGlobalController(vtkCont)*
>
>
>
> Due to the way my application works, I had to split the communicator
> myself, i.e. without using CreateSubController() or PartitionController()
> because vtk is loaded only by some procs and not every single one (a
> Mpi_Comm_split operation would therefore be impossible to do).
>
>
>
>
>
> --
>
> Yohann
>
>
>
> *From:* Andy Bauer [mailto:andy.bauer at kitware.com]
> *Sent:* Sunday, March 06, 2016 12:55 PM
> *To:* VAUTRIN Yohann (SAFRAN)
> *Cc:* paraview at paraview.org
> *Subject:* Re: [Paraview] [Catalyst] Setting the MPI Comm in Python
>
>
>
> Hi,
>
> Can you use a different controller that has the same MPI processes
> assigned to it? If that works for you, you should be able to just create a
> vtkMPIController and use either CreateSubController() or
> PartitionController() to create one similar to what you want. Note that you
> may need to create two vtkMPIControllers, one that corresponds to
> MPI_COMM_WORLD and one for your partitioning. After you've done that you
> can use the vtkMPIController::SetGlobalController() to have VTK and
> ParaView use that for interprocess communication.
>
> Best,
>
> Andy
>
>
>
> On Fri, Feb 26, 2016 at 10:09 AM, VAUTRIN Yohann (SAFRAN) <
> yohann.vautrin at safran.fr> wrote:
>
> Hi,
>
>
>
> I’m working on a Catalyst adaptor written in Python for one of the CFD
> codes I use at work and I’m having trouble setting the MPI communicator I
> want the vtkCPProcessor object to use (in order to use a subset of
> MPI_COMM_WORLD). The MPI communicator I create is a mpi4py.MPI_Comm object,
> which I convert to a vtkMPICommunicator object using
> vtk.vtkMPI4PyCommunicator.ConvertToVTK. However
> vtk.vtkPVCatalystPython.vtkCPProcessor.Initialize is expecting a
> vtkMPICommunicatorOpaqueComm object and there does not seem to be a way for
> me to create such an object from the Python interface. Am I missing
> something here or is something not wrapped correctly or wrong?
>
>
>
> For the moment I use mpi4py.MPI.COMM_WORLD to test everything. The
> following minimal example replicates my problem:
>
> *import mpi4py.MPI*
>
> *import vtk*
>
> *comm = mpi4py.MPI.COMM_WORLD*
>
> *coprocessor = vtk.vtkPVCatalystPython.vtkCPProcessor()*
>
> *coprocessor.Initialize(vtk.vtkMPI4PyCommunicator.ConvertToVTK(comm))*
>
> The last line fails with this message:
>
> *TypeError: Initialize argument 1: method requires a
> vtkMPICommunicatorOpaqueComm, a vtkMPICommunicator was provided.*
>
>
>
> I hope I post on the right mailing list as this could actually be a
> problem in VTK.
>
>
>
> Thank you for your help.
>
>
>
> Best,
>
> Yohann V.
>
> #
> " Ce courriel et les documents qui lui sont joints peuvent contenir des
> informations confidentielles, être soumis aux règlementations relatives au
> contrôle des exportations ou ayant un caractère privé. S'ils ne vous sont
> pas destinés, nous vous signalons qu'il est strictement interdit de les
> divulguer, de les reproduire ou d'en utiliser de quelque manière que ce
> soit le contenu. Toute exportation ou réexportation non autorisée est
> interdite.Si ce message vous a été transmis par erreur, merci d'en informer
> l'expéditeur et de supprimer immédiatement de votre système informatique ce
> courriel ainsi que tous les documents qui y sont attachés."
> ******
> " This e-mail and any attached documents may contain confidential or
> proprietary information and may be subject to export control laws and
> regulations. If you are not the intended recipient, you are notified that
> any dissemination, copying of this e-mail and any attachments thereto or
> use of their contents by any means whatsoever is strictly prohibited.
> Unauthorized export or re-export is prohibited. If you have received this
> e-mail in error, please advise the sender immediately and delete this
> e-mail and all attached documents from your computer system."
> #
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
>
>
>
> #
> " Ce courriel et les documents qui lui sont joints peuvent contenir des
> informations confidentielles, être soumis aux règlementations relatives au
> contrôle des exportations ou ayant un caractère privé. S'ils ne vous sont
> pas destinés, nous vous signalons qu'il est strictement interdit de les
> divulguer, de les reproduire ou d'en utiliser de quelque manière que ce
> soit le contenu. Toute exportation ou réexportation non autorisée est
> interdite Si ce message vous a été transmis par erreur, merci d'en informer
> l'expéditeur et de supprimer immédiatement de votre système informatique ce
> courriel ainsi que tous les documents qui y sont attachés."
> ******
> " This e-mail and any attached documents may contain confidential or
> proprietary information and may be subject to export control laws and
> regulations. If you are not the intended recipient, you are notified that
> any dissemination, copying of this e-mail and any attachments thereto or
> use of their contents by any means whatsoever is strictly prohibited.
> Unauthorized export or re-export is prohibited. If you have received this
> e-mail in error, please advise the sender immediately and delete this
> e-mail and all attached documents from your computer system."
> #
>
>
>
> #
> " Ce courriel et les documents qui lui sont joints peuvent contenir des
> informations confidentielles, être soumis aux règlementations relatives au
> contrôle des exportations ou ayant un caractère privé. S'ils ne vous sont
> pas destinés, nous vous signalons qu'il est strictement interdit de les
> divulguer, de les reproduire ou d'en utiliser de quelque manière que ce
> soit le contenu. Toute exportation ou réexportation non autorisée est
> interdite Si ce message vous a été transmis par erreur, merci d'en informer
> l'expéditeur et de supprimer immédiatement de votre système informatique ce
> courriel ainsi que tous les documents qui y sont attachés."
> ******
> " This e-mail and any attached documents may contain confidential or
> proprietary information and may be subject to export control laws and
> regulations. If you are not the intended recipient, you are notified that
> any dissemination, copying of this e-mail and any attachments thereto or
> use of their contents by any means whatsoever is strictly prohibited.
> Unauthorized export or re-export is prohibited. If you have received this
> e-mail in error, please advise the sender immediately and delete this
> e-mail and all attached documents from your computer system."
> #
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160310/6e9193b7/attachment.html>
More information about the ParaView
mailing list