Add parallel plotting in single window - #338
Conversation
| 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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
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)