Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
VTK
VTK
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 581
    • Issues 581
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 163
    • Merge Requests 163
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #16924

Closed
Open
Opened Nov 30, 2016 by Arno Mayrhofer@arnom

Improve Documentation for vtkXMLP*Writers

I have a software that is using different types of vtkXMLPWriters and found that they would not work as the output in the parallel files was wrong. In fact it only showed the piece of processor 0. As it took me over 4 hours (incl. reading the VTK source code) to figure out how to get this to work I would like to suggest an improvement to the documentation such that users will in the future find the desired information much quicker. Now my software uses bulk standard MPI_Init() and then in the output sets up a vtkXMLPWriter (In my case * = {UnstructuredGrid, MultiBlockData, PolyData}) as follows:

vtkSmartPointer<vtkXMLPUnstructuredGridWriter> pwriter = vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New(); pwriter->SetFileName(filename); #if VTK_MAJOR_VERSION < 6 pwriter->SetInput(unstructuredGrid); #else pwriter->SetInputData(unstructuredGrid); #endif pwriter->SetNumberOfPieces(nprocs); pwriter->SetStartPiece(rank); pwriter->SetEndPiece(rank); pwriter->Write();

It was already not clear to me that the Set{Start,End}Piece function calls were required. But this information was rather easy to find. What was more difficult is the fact that vtk needs to be aware of your MPI settings. To ensure this the following code needs to be put in some sort of initializer:

vtkMPIController *vtkController = vtkMPIController::New(); vtkController->Initialize(); vtkMultiProcessController::SetGlobalController(vtkController);

The Initialize() without arguments tells VTK that it should use an existing MPI controller, i.e. the one that comes with the main software. The SetGlobalController basically tells the writers that they should use this MPI controller to do their communication. I think there are other ways to achieve the communication by using vtk functions to initialize MPI, but this might not always be feasible.

So it would be great if there is either a example that highlights this or if the documentation points towards the fact that a functioning vtkMPIController needs to be available.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: vtk/vtk#16924