# Solving a lot of independent ODEs in parallel

**URL:** https://community.freefem.org/t/solving-a-lot-of-independent-odes-in-parallel/518
**Category:** General Discussion
**Created:** [July 23, 2020, 11:54am UTC](https://community.freefem.org/t/solving-a-lot-of-independent-odes-in-parallel/518 "2020-07-23T11:54:35Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [July 23, 2020, 12:08pm UTC](https://community.freefem.org/t/solving-a-lot-of-independent-odes-in-parallel/518/2 "2020-07-23T12:08:59Z")

</div>

Use MPI, it’s an embarrassingly parallel job, so trivial to parallelize.

```auto
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/solving-a-lot-of-independent-odes-in-parallel/518)._
