[vtkusers] unable to write multiple .pvtu files with split vtkMPIController

Andy Bauer andy.bauer at kitware.com
Wed Feb 21 11:21:04 EST 2018


Hi Joan,

Is fname different between the different MPI controllers? Other than that
everything looks correct to me. If that's not the issue could you share
some sample code that demonstrates the problem? I know I've done this sort
of thing in the past and it worked properly but it's possible that this
became broken somewhere along the way.

Best,
Andy

On Tue, Feb 20, 2018 at 1:07 PM, Joan Baiges <joan.baiges at upc.edu> wrote:

> Hello,
> I am trying to write several .vtu and .pvtu files by using several
> MPI_Communicators. For this, I Splitinitialize a vtkMPIController object,
> and then set this controller as the controller for a
> vtkXMLPUnstructuredGridWriter.
>
> However, when I ask the vtkXMLPUnstructuredGridWriter->Write(), only one
> .pvtu file is written, while I would expect that one .pvtu file is written
> for each of the communicators the MPI_COMM_WORLD has been subdivided into.
> On the other hand, the .vtu files are written properly for all the
> processors in all the split mpi controllers.
>
> The code I am writing looks approximately like this:
>
> vtkMPIController* controller;
> vtkMPICommunicator* communicator;
> vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid;
> vtkSmartPointer<vtkXMLPUnstructuredGridWriter> parallelwriter;
>
> //New communicator and spliting of the communicator
> communicator = vtkMPICommunicator::New();
> communicator = vtkMPICommunicator::GetWorldCommunicator();
> communicator->SplitInitialize(communicator,MulticommColor,MPIrank);
>
> //Setting the split communicator as the communicator for the controller
>  controller = vtkMPIController::New();
>  controller->SetCommunicator(communicator);
>  controller->Initialize();
>  controller->SetGlobalController(controller);
>
> //Initializing the parallelwriter with the controller
> parallelwriter = vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New();
>    parallelwriter->SetController(controller);
>    parallelwriter->SetNumberOfPieces(MPIsize);
>    parallelwriter->SetGhostLevel(1);
>    parallelwriter->SetStartPiece(MPIrank);
>    parallelwriter->SetEndPiece(MPIrank);
>
> //setting file name
> fname = std::string(filename);
> fname.append(".pvtu");
> parallelwriter->SetFileName(fname.c_str());
>
>
> //Setting the grid
> unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
> parallelwriter->SetInputData(unstructuredGrid);
>
>
> //After writing the grid info, we call the parallelwriter to write
> parallelwriter->Write();
>
> This final line causes all the processors to write the .vtu files, however
> only one processor writes the .pvtu file, while I would expect/like one
> .pvtu file per split mpi communicator.
>
> Thank you in advance for your help,
>
> Joan
>
>
> _______________________________________________
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180221/cc725fad/attachment.html>


More information about the vtkusers mailing list