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

Andy Bauer andy.bauer at kitware.com
Thu Feb 22 14:46:54 EST 2018


Hi Joan,

If you could write a self-contained piece of code that verifies the error
I'd be happy to take a look at fixing it.

Best,
Andy

On Thu, Feb 22, 2018 at 10:11 AM, Joan Baiges <joan.baiges at upc.edu> wrote:

> Hello Andy, thank you for your answer,
>
> I have checked that the fname is different in each controller (it differs
> only in the folder where the files are written, the name of the file is the
> same),
>
> Joan
>
>
>
> *Joan Baiges*Ph.D. Civil Engineer
> T.(+34) 93 401 1048 <+34%20934%2001%2010%2048>
> C/ Gran Capità, s/n, Campus Nord UPC, Ed. C1, Despatx 109
> 08034 – Barcelona – Spain
>
>
>
>
>
>
> 2018-02-21 17:21 GMT+01:00 Andy Bauer <andy.bauer at kitware.com>:
>
>> 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/20180222/44abf719/attachment.html>


More information about the vtkusers mailing list