# Parallel for loop in freefem

**URL:** https://community.freefem.org/t/parallel-for-loop-in-freefem/1204
**Category:** General Discussion
**Created:** [September 14, 2021, 8:20am UTC](https://community.freefem.org/t/parallel-for-loop-in-freefem/1204 "2021-09-14T08:20:08Z")
**Posts on this page:** 1
**Showing post:** 4

<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: [September 15, 2021, 8:27am UTC](https://community.freefem.org/t/parallel-for-loop-in-freefem/1204/4 "2021-09-15T08:27:38Z")

</div>

> [@Solving a lot of independent ODEs in parallel](https://community.freefem.org/t/solving-a-lot-of-independent-odes-in-parallel/518/2):
>
> Use MPI, it’s an embarrassingly parallel job, so trivial to parallelize. int ntask = 200; for(int i = (mpirank \* ntask) / mpisize; i \< ((mpirank + 1) \* ntask) / mpisize; ++i) { cout \<\< "process #" \<\< mpirank \<\< " dealing with task #" \<\< i \<\< endl; } mpiAllreduce(...); // for synchronization

---

_[View the full topic](https://community.freefem.org/t/parallel-for-loop-in-freefem/1204)._
