# Parallel Processing\_error

**URL:** <https://fenicsproject.discourse.group/t/parallel-processing-error/8576>\
**Category:** Uncategorized\
**Created:** [June 18, 2022, 11:44am UTC](https://fenicsproject.discourse.group/t/parallel-processing-error/8576 "2022-06-18T11:44:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Habib-ur\_Rehmaan](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Habib-ur\_Rehmaan](https://fenicsproject.discourse.group/u/Habib-ur_Rehmaan)\
**Post date:** [June 18, 2022, 11:44am UTC](https://fenicsproject.discourse.group/t/parallel-processing-error/8576/1 "2022-06-18T11:44:38Z")

</div>

Hello  
I am using Fenics on Docker Windows

when i run a code with simple command python3 it runs properly, but issue is my system use only 1 or 2 logical processors and simulation is very slow but code run properly

when i try to use multi processor it produce errors  
mpirun -n \<no. of processors \> python3

My Question is when code is running properly on single processor, than how i can run a code by using multiprocessors .???

Regards

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [June 18, 2022, 12:18pm UTC](https://fenicsproject.discourse.group/t/parallel-processing-error/8576/2 "2022-06-18T12:18:21Z")

</div>

You would need to provide a minimal code example that produces this error for anyone to give you any guidance.

---

<div class="post-metadata">

**Author:** ![Habib-ur\_Rehmaan](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Habib-ur\_Rehmaan](https://fenicsproject.discourse.group/u/Habib-ur_Rehmaan)\
**Post date:** [June 18, 2022, 1:57pm UTC](https://fenicsproject.discourse.group/t/parallel-processing-error/8576/3 "2022-06-18T13:57:19Z")

</div>

‘’’  
def g(v,n):  
return (1.0 - (1.0 - exp(-Re)) \* n ) / (1.0 - exp(-Re)) \*   
conditional(ge(v,vn),1.0,0.0)   
- (1.0 - conditional(ge(v,vn),1.0,0.0))\*n

def f(v,n):  
return (-v+(vstar-pow(n,M))\*(1.0-ufl.tanh(v-vh))\*pow(v,2)\*0.5)

def hr(xi,n):  
return K1 \* xi\*xi / (1 + n) - K2 \* n

## Magnetic field

def mg(v,mf):  
return Km1\*v - Km2 \* mf +mfe

def In(v,mf):  
return Km0_pow(alp,mf_bet)_lam_ln(alp)\* v

def varAngle(s):  
return ((thetaEpi - thetaEndo) \* s + thetaEndo)/ 180.0 \* pi

def normalizeAndProj\_vec(u):  
return project(u/sqrt(dot(u,u)),FiberSpace)

def normalize\_vec(u):  
return u/sqrt(dot(u,u))

def comptauv(T,Ta,beta,tauv):  
return tauv/(1+beta\*(T-Ta))

def comptaun(T,Q10,Ta,taun):  
return taun\*pow(Q10,(Ta-T)/10.0)

def comptauxi(T,Q10,Ta,tauxi):  
return tauxi\*pow(Q10,(Ta-T)/10.0)

def comptaumf(T,Q10,Ta,taumf):  
return taumf\*pow(Q10,(Ta-T)/10.0)

t = 0.0; dt = 0.1; Tfinal=750;

freqSave = 1; inc = 0

stim\_t0 = dt; stim\_t2 = 350; stim\_dur = 2.0; stim\_amp = 2.0

# \*\*\*\*\*\*\* Create mesh and define function spaces \*\*\*\*\*\*\*\*\*\*

mesh = Mesh(“square.xml”)  
bdry = MeshFunction(“size\_t”, mesh, “square\_facet\_region.xml”)  
ds = Measure(“ds”, subdomain\_data=bdry)  
nn = FacetNormal(mesh)  
‘’’

---

<div class="post-metadata">

**Author:** ![Habib-ur\_Rehmaan](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Habib-ur\_Rehmaan](https://fenicsproject.discourse.group/u/Habib-ur_Rehmaan)\
**Post date:** [June 18, 2022, 1:57pm UTC](https://fenicsproject.discourse.group/t/parallel-processing-error/8576/4 "2022-06-18T13:57:49Z")

</div>

![image](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/4/413a769439620be749b922cf6f7f2ddf18973328.png)  
its the error

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [June 18, 2022, 2:15pm UTC](https://fenicsproject.discourse.group/t/parallel-processing-error/8576/5 "2022-06-18T14:15:11Z")

</div>

First of all, you need to make sure the code is reproducable for others, i.e. avoid having external meshes as import.  
Secondly, make sure you format the code in markdown syntax, i.e.

````python
```python

def f(x):
    return x[0]
```

````

Thirdly, it is not adviced to use `xml` files when running in parallel. You should use `xdmf` files.

---

<div class="post-metadata">

**Author:** ![Habib-ur\_Rehmaan](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Habib-ur\_Rehmaan](https://fenicsproject.discourse.group/u/Habib-ur_Rehmaan)\
**Post date:** [June 18, 2022, 2:28pm UTC](https://fenicsproject.discourse.group/t/parallel-processing-error/8576/6 "2022-06-18T14:28:11Z")

</div>

thank you, i try with xdmf, and i will take care next time regarding your instructions
