# Parallel computing

**URL:** <https://community.freefem.org/t/parallel-computing/926>\
**Category:** General Discussion\
**Created:** [April 16, 2021, 8:34pm UTC](https://community.freefem.org/t/parallel-computing/926 "2021-04-16T20:34:06Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![niaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@niaa](https://community.freefem.org/u/niaa)\
**Post date:** [April 16, 2021, 8:34pm UTC](https://community.freefem.org/t/parallel-computing/926/1 "2021-04-16T20:34:06Z")

</div>

Dear all,

I heve few questions on the example [Maxwell-3d-simple.edp](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/ffddm/Maxwell-3d-simple.edp) from ffddm examples. I need to solve my own maxwell code in parallel and I am new in parallel computing and need to understand this code in detail, I will be thankful if you help me on this.

1. what are the roles of two preconditioers VarfEprec and VarfOpt ? while in them also the values of the epsilonEprec is equal to 0 in the code. so the VarfEprec is practically equal to Varf.

2. in the second preconditioned VarfOpt the fourth line ( int2d(meshName,10)(1i_k_CrossN(vx,vy,vz)’\*CrossN(Ex,Ey,Ez)) ) is defined based on what? and this 10 boundry condition is also from where? because all labels in the mesh were defines 1 and 2.

// for the preconditioner  
macro VarfEprec(varfName, meshName, PhName)  
varf varfName([Ex,Ey,Ez],[vx,vy,vz]) =  
int3d(meshName)(Curl(vx,vy,vz)‘_Curl(Ex,Ey,Ez))  
+ int3d(meshName)(-(k^2-1i_epsilonEprec)_[vx,vy,vz]’_[Ex,Ey,Ez])  
+ int2d(meshName,Robin)(1i_k_CrossN(vx,vy,vz)’\*CrossN(Ex,Ey,Ez))  
+ on(Dirichlet,Ex=0,Ey=0,Ez=0); // EOM

// for the preconditioner  
macro VarfOpt(varfName, meshName, PhName)  
varf varfName([Ex,Ey,Ez],[vx,vy,vz]) =  
int3d(meshName)(Curl(vx,vy,vz)'_Curl(Ex,Ey,Ez))  
+ int3d(meshName)(-(k^2-1i_epsilonEprec)_[vx,vy,vz]’_[Ex,Ey,Ez])  
+ int2d(meshName,Robin)(1i_k_CrossN(vx,vy,vz)‘_CrossN(Ex,Ey,Ez))  
+ int2d(meshName,10)(1i_k\*CrossN(vx,vy,vz)’\*CrossN(Ex,Ey,Ez))  
+ on(Dirichlet,Ex=0,Ey=0,Ez=0); // EOM

1. Defining a coarse mesh setup Thc is obligatory for solving maxwell equation? if yes, what is optimum for mysplit value?

2. in the ffddmplot(M,sqrt(real(u)^2+real(uy)^2+real(uz)^2), “Global solution”); u is equal with ux? because when I change it to ux I get an error.

Thanks for your guidance in advance.

---

<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:** [April 16, 2021, 8:52pm UTC](https://community.freefem.org/t/parallel-computing/926/2 "2021-04-16T20:52:01Z")

</div>

ffddm is useful to prototype domain decomposition preconditioners. If you simply want to exploit parallel computing easily, your best bet would be to use PETSc. You can simply assemble your `varf` using the same notation as in a sequential FreeFEM script, see [FreeFem-sources/maxwell-3d-PETSc.edp at master · FreeFem/FreeFem-sources · GitHub](https://github.com/FreeFem/FreeFem-sources/blob/master/examples/hpddm/maxwell-3d-PETSc.edp#L42), and then call a distributed _LU_ solver, with `set(A, sparams = "-pc_type lu")`. For Maxwell equation, you’ll be able to use the auxiliary-space Maxwell solver through _hypre_, see [AMS — hypre 2.20.0 documentation](https://hypre.readthedocs.io/en/latest/solvers-ams.html).

---

<div class="post-metadata">

**Author:** ![niaa](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@niaa](https://community.freefem.org/u/niaa)\
**Post date:** [April 18, 2021, 7:58am UTC](https://community.freefem.org/t/parallel-computing/926/3 "2021-04-18T07:58:16Z")

</div>

thanks for your reply, Actually, I need to learn how to use ffddm, it will also be necessary and helpful for my other problems, so is it possibe that you explain alittle bit about how to define preconditioers in maxwel equation, and my other questions I asked above?

---

<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:** [April 18, 2021, 8:26am UTC](https://community.freefem.org/t/parallel-computing/926/4 "2021-04-18T08:26:00Z")

</div>

Sorry, I don’t know that interface. I use PETSc/HPDDM instead.

---

<div class="post-metadata">

**Author:** ![zetaoma7](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zetaoma7/32/1407_2.png) [@zetaoma7](https://community.freefem.org/u/zetaoma7)\
**Post date:** [November 5, 2022, 3:36pm UTC](https://community.freefem.org/t/parallel-computing/926/5 "2022-11-05T15:36:26Z")

</div>

I have a question. I’ve installed hypre on ubuntu sucessfully and load “hypre\_FreeFem” , but it said that can not find hypre.so, how can i solve this problem?

Your reply would be greatly appreciated.

---

<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:** [November 5, 2022, 3:42pm UTC](https://community.freefem.org/t/parallel-computing/926/6 "2022-11-05T15:42:30Z")

</div>

Use `load "PETSc"` instead.

---

<div class="post-metadata">

**Author:** ![zetaoma7](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zetaoma7/32/1407_2.png) [@zetaoma7](https://community.freefem.org/u/zetaoma7)\
**Post date:** [November 6, 2022, 12:17am UTC](https://community.freefem.org/t/parallel-computing/926/7 "2022-11-06T00:17:15Z")

</div>

Thank you very much!

---

<div class="post-metadata">

**Author:** ![zetaoma7](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zetaoma7/32/1407_2.png) [@zetaoma7](https://community.freefem.org/u/zetaoma7)\
**Post date:** [November 7, 2022, 6:44am UTC](https://community.freefem.org/t/parallel-computing/926/8 "2022-11-07T06:44:54Z")

</div>

Dear sir,

Is the website [http://jolivet.perso.enseeiht.fr/](http://jolivet.perso.enseeiht.fr/) open for all ? Since i don’t have access to it in these days.

Your reply would be greatly appreciated.

---

<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:** [November 7, 2022, 6:51am UTC](https://community.freefem.org/t/parallel-computing/926/9 "2022-11-07T06:51:58Z")

</div>

It has moved to [http://joliv.et](http://joliv.et), and I’m guessing you are looking for [FreeFem-tutorial](http://joliv.et/FreeFem-tutorial) in particular?

---

<div class="post-metadata">

**Author:** ![zetaoma7](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zetaoma7/32/1407_2.png) [@zetaoma7](https://community.freefem.org/u/zetaoma7)\
**Post date:** [November 7, 2022, 7:05am UTC](https://community.freefem.org/t/parallel-computing/926/10 "2022-11-07T07:05:26Z")

</div>

I am looking for some examples to check if the parallel computing package is installed successfully, as the last question i have asked, load “hypre\_FreeFem” has been changed to load “PETSc”. Is the set of the parameters need to be changed as well ?

I am not sure about the compilation on ubuntu is compiled successfully?

Thank you !

---

<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:** [November 7, 2022, 7:07am UTC](https://community.freefem.org/t/parallel-computing/926/11 "2022-11-07T07:07:56Z")

</div>

Go in `examples/hpddm` and type `make check`. You’ll see either failures or success. Yes, you need to change your script when you use `load "PETSc"`. You can look at the tutorial.

---

<div class="post-metadata">

**Author:** ![zetaoma7](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zetaoma7/32/1407_2.png) [@zetaoma7](https://community.freefem.org/u/zetaoma7)\
**Post date:** [November 7, 2022, 7:23am UTC](https://community.freefem.org/t/parallel-computing/926/12 "2022-11-07T07:23:57Z")

</div>

Thanks for your guidance and great efforts in FreeFem++.
