Skip to content

Add parallel plotting in single window - #338

Merged
jorgensd merged 5 commits into
mainfrom
dokken/parallel_plots
Sep 22, 2026
Merged

jorgensd merged 5 commits into
mainfrom
dokken/parallel_plots

Conversation

@jorgensd

Copy link
Copy Markdown
Owner

Idea by @SalzmanA showing me how to do the gather for cases using ipyparallel.
Extended to general programs by me using MPI.Comm.Gather(..., root)
Implemented by CLAUDE (Opus 5)

Comment thread chapter3/component_bc.py
merged_grid = pyvista.merge(pieces)
p = pyvista.Plotter()
actor_0 = p.add_mesh(merged_grid, style="wireframe", color="k")
actor_1 = p.add_mesh(merged_grid.warp_by_vector("u", factor=1.5), opacity=0.8)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hello Jorgen,
Would it make sense to parallelise this task (i.e. warp_by_vector) as well?
I ran a quick, dirty test:
.
.
grid["u"] = vals
wgrid=grid.warp_by_vector("u", factor=1.5)
.
.
pieces = mesh.comm.gather(grid, root=root)
wgrids = mesh.comm.gather(wgrid, root=root)
.
.
merged_grid = pyvista.merge(pieces)
merged_wgrid = pyvista.merge(wgrids)
.
.
actor_1 = p.add_mesh(merged_wgrid, opacity=0.8)
It gives me apparently correct visual results.
I do understand that it is a tradeof inbetween comunication and load balancing. Maybe memory could have an impact as well?
But for some sets of model size and number of processes, it might reduce Pyvista's heavy task consumption (if any !?). Here, warp_by_vector task is not so heavy, but for a threshold of a huge 3D model with moderate number of processes, it might help.
Perhaps, in the spirit of this tutorial, it would be enough to simply point out that this is possible in this example or in another one.
Or maybe I do miss something important that makes this irrelevant?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I agree that there is always a tradeoff between making the warp by vector locally, then pass the grid or pass the grid then warp.
In this demo one would have to do two gathers as we want both actor 0 and 1 to render, and therefore I think it is best to keep it this way. However, in general this is up to the user and the amount of data.

@edvardak edvardak left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks correct to me, it ran fine in jupyter-lab and worked nicely when adapted to a small script that reimplemented the tutorial's code.

@jorgensd
jorgensd merged commit ad7ff05 into main Sep 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants