# How to concatenate output when parallelizing

**URL:** <https://fenicsproject.discourse.group/t/how-to-concatenate-output-when-parallelizing/5960>\
**Category:** Uncategorized\
**Created:** [June 4, 2021, 5:25pm UTC](https://fenicsproject.discourse.group/t/how-to-concatenate-output-when-parallelizing/5960 "2021-06-04T17:25:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TherealSova](https://avatars.discourse-cdn.com/v4/letter/t/74df32/32.png) [@TherealSova](https://fenicsproject.discourse.group/u/TherealSova)\
**Post date:** [June 4, 2021, 5:25pm UTC](https://fenicsproject.discourse.group/t/how-to-concatenate-output-when-parallelizing/5960/1 "2021-06-04T17:25:20Z")

</div>

This code will calculate the maximum element for each processor and display several lines.

```auto
max_f = np.abs(np.array(f_n.vector())).max()
print('t = %.4f: max_f = %.6f' % (t, max_f))

```

I want to count the maximum element out of these and output only that. How should I do it?

---

<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 4, 2021, 5:56pm UTC](https://fenicsproject.discourse.group/t/how-to-concatenate-output-when-parallelizing/5960/2 "2021-06-04T17:56:03Z")

</div>

Use `MPI.allreduce`, as shown in [Attempt to find max value on mesh in parallel - #2 by dokken](https://fenicsproject.discourse.group/t/attempt-to-find-max-value-on-mesh-in-parallel/4314/2)
