# Assembly parallelization

**URL:** <https://getfem.discourse.group/t/assembly-parallelization/114>\
**Category:** General\
**Created:** [February 10, 2026, 3:19pm UTC](https://getfem.discourse.group/t/assembly-parallelization/114 "2026-02-10T15:19:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricAComstock](https://yyz2.discourse-cdn.com/free1/user_avatar/getfem.discourse.group/ericacomstock/32/68_2.png) [@EricAComstock](https://getfem.discourse.group/u/EricAComstock)\
**Post date:** [February 10, 2026, 3:19pm UTC](https://getfem.discourse.group/t/assembly-parallelization/114/1 "2026-02-10T15:19:04Z")

</div>

Hello All,

Is it possible to parallelize matrix assembly in GetFEM? I have found that assembly has consistently been the bottleneck for large 6D problems, and am curious if that is possible.

Sincerely,

Eric A. Comstock

---

<div class="post-metadata">

**Author:** ![Konstantinos.Poulios](https://avatars.discourse-cdn.com/v4/letter/k/ac91a4/32.png) [@Konstantinos.Poulios](https://getfem.discourse.group/u/Konstantinos.Poulios)\
**Post date:** [February 11, 2026, 7:46am UTC](https://getfem.discourse.group/t/assembly-parallelization/114/2 "2026-02-11T07:46:08Z")

</div>

Hi, yes, assembly operations are in general trivial to parallelize and of course this option is already available in GetFEM. You just need to compile GetFEM with either the `--enable-paralevel=1` option in the configure command, for parallelizing the assembly only, or with `--enable-paralevel=2` for parallelization of assembly and linsolve with the parallel version of MUMPS.

you can compare the sequential and parallel build and runs scripts from

> **[GetFEM compilation on DTU main cluster ($52) · Snippets · GitLab](https://gitlab.gbar.dtu.dk/-/snippets/52)**
>
> Welcome to our gbar-gitlab

to see how exactly I use either sequential or para-level 2 version on our cluster.

Check also the official documentation at

> **[MPI Parallelization of GetFEM — GetFEM](https://getfem.org/userdoc/parallel.html)**

Parallelization relies on mesh partitioning with Metis. I don’t think that Metis can partition 6d meshes, so probably you will need to implement some workaround there. I can help with that if you know how you want to partition your mesh.

---

<div class="post-metadata">

**Author:** ![EricAComstock](https://yyz2.discourse-cdn.com/free1/user_avatar/getfem.discourse.group/ericacomstock/32/68_2.png) [@EricAComstock](https://getfem.discourse.group/u/EricAComstock)\
**Post date:** [February 11, 2026, 4:12pm UTC](https://getfem.discourse.group/t/assembly-parallelization/114/3 "2026-02-11T16:12:30Z")

</div>

Hello Kostas,

Thank you for the resources and help! I will look into them, and let you know if there are any issues.

Sincerely,  
Eric A. Comstock

---

<div class="post-metadata">

**Author:** ![EricAComstock](https://yyz2.discourse-cdn.com/free1/user_avatar/getfem.discourse.group/ericacomstock/32/68_2.png) [@EricAComstock](https://getfem.discourse.group/u/EricAComstock)\
**Post date:** [February 19, 2026, 6:58pm UTC](https://getfem.discourse.group/t/assembly-parallelization/114/4 "2026-02-19T18:58:50Z")

</div>

Hello Kostas,

Okay - I got a parallel build operational and working. What commands do I need to use in Python to ensure that the assembly is parallel? The reason why I am focused on assembly is because my solve is only ~0.1% of the processing. It turns out that 6D requires a huge number of quadrature points per simplex (heptapeton), and a huge number heptapetons per hypercube (hexarract) and DoF. That is why it takes so long compared to the solve in my problem.

Sincerely,

Eric A. Comstock

---

<div class="post-metadata">

**Author:** ![EricAComstock](https://yyz2.discourse-cdn.com/free1/user_avatar/getfem.discourse.group/ericacomstock/32/68_2.png) [@EricAComstock](https://getfem.discourse.group/u/EricAComstock)\
**Post date:** [February 19, 2026, 9:29pm UTC](https://getfem.discourse.group/t/assembly-parallelization/114/5 "2026-02-19T21:29:44Z")

</div>

Hello Kostas,

To clarify, I am trying to parallelize assembly, and then run my own code for the solver. So I am using right now:

```auto
md.assembly("build_all")

```

to make the rhs and the matrix, and then using my own code to solve them, before injecting back to GetFEM with

```auto
md.to_variables(solution) 

```

Right now I am running with

```auto
mpirun -n 4 python3

```

and it shows four programs running, and four sets of boundary conditions being added. The program then ends with the injection back to GetFEM failing due to “inconsistent shapes.”

Sincerely,

Eric A. Comstock

---

<div class="post-metadata">

**Author:** ![Konstantinos.Poulios](https://avatars.discourse-cdn.com/v4/letter/k/ac91a4/32.png) [@Konstantinos.Poulios](https://getfem.discourse.group/u/Konstantinos.Poulios)\
**Post date:** [February 23, 2026, 7:49am UTC](https://getfem.discourse.group/t/assembly-parallelization/114/6 "2026-02-23T07:49:03Z")

</div>

to begin with, try some sanity tests, do an assembly of some simple expression

`VEC = gf.asm_generic(mim, 1, "1*Test_a", -1, "a", 1, mf, np.zeros(mf.nbdof()))`

where `mf` is just some scalar `mesh_fem`, and save `VEC` in a file.

Repeat the test with `mpi run -n 1`, `mpi run -n 2`, `mpi run -n 4` and check that result doesn’t change.

---

<div class="post-metadata">

**Author:** ![EricAComstock](https://yyz2.discourse-cdn.com/free1/user_avatar/getfem.discourse.group/ericacomstock/32/68_2.png) [@EricAComstock](https://getfem.discourse.group/u/EricAComstock)\
**Post date:** [February 23, 2026, 5:14pm UTC](https://getfem.discourse.group/t/assembly-parallelization/114/7 "2026-02-23T17:14:31Z")

</div>

Hello Kostas,

I got it working - thank you so much for your help!

Sincerely,

Eric A. Comstock
