# plotMPI, how to get plot display for parallelization hpddm

**URL:** <https://community.freefem.org/t/plotmpi-how-to-get-plot-display-for-parallelization-hpddm/162>\
**Category:** General Discussion\
**Created:** [October 30, 2019, 12:28pm UTC](https://community.freefem.org/t/plotmpi-how-to-get-plot-display-for-parallelization-hpddm/162 "2019-10-30T12:28:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lihao](https://avatars.discourse-cdn.com/v4/letter/l/ecd19e/32.png) [@Lihao](https://community.freefem.org/u/Lihao)\
**Post date:** [October 30, 2019, 12:28pm UTC](https://community.freefem.org/t/plotmpi-how-to-get-plot-display-for-parallelization-hpddm/162/1 "2019-10-30T12:28:36Z")

</div>

Dear developer,

I am a beginner in parallelization. I tried to run the example code “elasticity-3d.edp” in hpddm folder.  
Please see the link: [https://doc.freefem.org/documentation/parallelization.html#hpddm-solvers](https://doc.freefem.org/documentation/parallelization.html#hpddm-solvers)

I input the following command in the terminal:  
ff-mpirun -np 4 Elasticity3D.edp -glut ffglut

However, the program normally ends up without a plot display.  
I tried several other hpddm examples on both Mac OS and Ubuntu and met the same problem.  
Could you please give me some advice?

In addition, when doing parallelization with hpddm, how could I output the “.vtu” file for paraview visualization?

Sincerely yours,  
Hao

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [October 30, 2019, 1:37pm UTC](https://community.freefem.org/t/plotmpi-how-to-get-plot-display-for-parallelization-hpddm/162/2 "2019-10-30T13:37:59Z")

</div>

By default, visualisation is turned off when you use ff-mpirun. You need to add the flag “-wg” on your command line (we have very recently fixed a bug for plotting 3D solutions, so you may run into an issue if you don’t have a recent enough installation, cf. this [commit](https://github.com/FreeFem/FreeFem-sources/commit/33d41514a07ea4aefc220ec56f8dceb8b572936c), maybe try in 2D first).  
The best way is to use ParaView has you mentioned. Here are two examples:

- [time-dependent problem](https://github.com/FreeFem/FreeFem-sources/blob/master/examples/hpddm/heat-2d-io.edp#L93-L108), with exportBegin, exportTimeStep, and exportEnd
- [steady-state problem](https://github.com/FreeFem/FreeFem-sources/blob/master/examples/hpddm/stokes-3d-io.edp#L99-L101), with just export

Just open the resulting .pvd with ParaView and you’ll have access to your distributed solution.

---

<div class="post-metadata">

**Author:** ![Lihao](https://avatars.discourse-cdn.com/v4/letter/l/ecd19e/32.png) [@Lihao](https://community.freefem.org/u/Lihao)\
**Post date:** [October 31, 2019, 8:16am UTC](https://community.freefem.org/t/plotmpi-how-to-get-plot-display-for-parallelization-hpddm/162/3 "2019-10-31T08:16:04Z")

</div>

Thanks so much for your documents.  
I installed the recently released version, it does work for 3D plot!

On the other hand, I tried the Paraview exportation as you suggested. I found it works on Ubuntu, but failed on MacOS 10.15.1. The error message is shown in the attached figure.

Thanks very much.

Best regards,  
Hao

 ![Paraview-stokes3d](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/2e30567b014409244ad8967913bc53cdd6a67560.png)

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [October 31, 2019, 8:51am UTC](https://community.freefem.org/t/plotmpi-how-to-get-plot-display-for-parallelization-hpddm/162/4 "2019-10-31T08:51:58Z")

</div>

I’ve slightly updated the script, could you try the new version, please? If this is still not working, may I ask what exact command line are you using?

---

<div class="post-metadata">

**Author:** ![Lihao](https://avatars.discourse-cdn.com/v4/letter/l/ecd19e/32.png) [@Lihao](https://community.freefem.org/u/Lihao)\
**Post date:** [October 31, 2019, 9:30am UTC](https://community.freefem.org/t/plotmpi-how-to-get-plot-display-for-parallelization-hpddm/162/5 "2019-10-31T09:30:51Z")

</div>

Thanks for your timely reply.

The installation package I used is:

> **[FreeFem/FreeFem-sources](https://github.com/FreeFem/FreeFem-sources/tree/33d41514a07ea4aefc220ec56f8dceb8b572936c)**
>
> FreeFEM source code. Contribute to FreeFem/FreeFem-sources development by creating an account on GitHub.

The testing code I used is:  
[https://github.com/FreeFem/FreeFem-sources/blob/master/examples/hpddm/stokes-3d-io.edp#L99-L101](https://github.com/FreeFem/FreeFem-sources/blob/master/examples/hpddm/stokes-3d-io.edp#L99-L101)

The command line:  
ff-mpirun -np 4 stokes-3d-io.edp

And I noticed that besides a “.pvd” file, another 4 “.vtu” files have been also generated. Please check the attached .zip file.

In addition, I hope to know the extensibility of hpddm with regards to the adaptive mesh. Would it be possible to use hpddm if the mesh is updated based on level set function with the MMG3d tool. Please see the links: [https://www.mmgtools.org/mmg-remesher-try-mmg/mmg-remesher-tutorials/mmg-remesher-mmg3d/mmg-remesher-implicit-domain-meshing](https://www.mmgtools.org/mmg-remesher-try-mmg/mmg-remesher-tutorials/mmg-remesher-mmg3d/mmg-remesher-implicit-domain-meshing)  
I have realized this updating process without parallelization. But if the hpddm can be integrated into the solver, it will be very helpful to speed up our optimization.

[Archive.zip](https://community.freefem.org/uploads/short-url/lcOutywUV0ygemms75muqgHubYc.zip) (111.8 KB)  
Best regards,  
Hao

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [October 31, 2019, 9:38am UTC](https://community.freefem.org/t/plotmpi-how-to-get-plot-display-for-parallelization-hpddm/162/6 "2019-10-31T09:38:25Z")

</div>

Could you try with the latest .edp, available [there](https://github.com/FreeFem/FreeFem-sources/commit/ba61bcbfd00e10a44e750ba15ae3f8adf540889a)? PETSc and HPDDM solvers work with mesh adaptation, see one example [here](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/hpddm/Newton-adaptmesh-2d-PETSc.edp). It’s in 2D, so we use adaptmesh instead of MMG3D, but we have applications in 3D as well. You can reach me via email if you want a more detailed explanation or need help to adapt your script.

---

<div class="post-metadata">

**Author:** ![Lihao](https://avatars.discourse-cdn.com/v4/letter/l/ecd19e/32.png) [@Lihao](https://community.freefem.org/u/Lihao)\
**Post date:** [October 31, 2019, 9:45am UTC](https://community.freefem.org/t/plotmpi-how-to-get-plot-display-for-parallelization-hpddm/162/7 "2019-10-31T09:45:16Z")

</div>

I tried your latest version, and it works.

I very much appreciate your kind support. Sure, I will reach you via email.

Thanks again.

BR,  
Hao
