Skip to content

Conversation

bd713
Copy link
Contributor

@bd713 bd713 commented Sep 12, 2025

This PR introduces a workaround for a regression in vtkRedistributeDataSetFilter observed in VTK versions 9.4.2 and newer.

Since VTK v9.4.2, vtkRedistributeDataSetFilter fails to correctly redistribute hybrid meshes containing tetrahedra or pyramids, resulting in silent cell loss. This issue does not seem to happen in VTK v9.3.1, but has been reproduced in both v9.4.2 and v9.5.1 (on large hybrid meshes >1M cells and at high rank counts >48), even in minimal standalones independent of GEOS.

For context, our parallel workflow relies on vtkRedistributeDataSetFilter's kd-tree capability to perform an initial, balanced distribution of any VTK mesh that is first read only by rank 0. This step is a prerequisite for parallel partitioners like ParMetis, which assume all ranks already hold a portion of the mesh.

In practice, this PR implements a "detect-and-fallback" mechanism:

  • After applying vtkRedistributeDataSetFilter, the code checks whether any cells were lost.
  • If cell loss is detected, it falls back to a basic scatterByBlock method, which redistributes the mesh from rank 0 using contiguous cell blocks.

As opposed to a kd-tree, this fallback approach does not rely on any geometric information, so using a partitioning tool such as ParMetis or PTScotch in post-processing is highly recommended to optimize the resulting partitions.

@bd713 bd713 self-assigned this Sep 12, 2025
@bd713 bd713 added the type: bug Something isn't working label Sep 12, 2025
@MelReyCG
Copy link
Contributor

We will test this one on our side.
Is there an issue on KitWare side for the kdTree issue?

@bd713 bd713 added the ci: run integrated tests Allows to run the integrated tests in GEOS CI label Sep 12, 2025
bd713 and others added 2 commits September 12, 2025 08:40
Co-authored-by: MelReyCG <122801580+MelReyCG@users.noreply.github.com>
@bd713
Copy link
Contributor Author

bd713 commented Sep 12, 2025

Is there an issue on KitWare side for the kdTree issue?

Not yet, I need to coordinate with @margauxraguenel for that.

Copy link
Contributor

@jhuang2601 jhuang2601 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this hidden issue.
With it, missing tet elements can be detected and recovered.

@bd713 bd713 requested a review from OmarDuran as a code owner September 15, 2025 17:40
@paveltomin paveltomin added the ci: run CUDA builds Allows to triggers (costly) CUDA jobs label Sep 16, 2025
@paveltomin paveltomin merged commit d5fccb5 into develop Sep 17, 2025
25 of 26 checks passed
@paveltomin paveltomin deleted the bugfix/bd713/fixVTKkdtree branch September 17, 2025 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants