# Very simple MPI implementation question

**URL:** <https://discourse.julialang.org/t/very-simple-mpi-implementation-question/53641>\
**Category:** Julia at Scale\
**Created:** [January 19, 2021, 10:02pm UTC](https://discourse.julialang.org/t/very-simple-mpi-implementation-question/53641 "2021-01-19T22:02:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abader](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@abader](https://discourse.julialang.org/u/abader)\
**Post date:** [January 19, 2021, 10:02pm UTC](https://discourse.julialang.org/t/very-simple-mpi-implementation-question/53641/1 "2021-01-19T22:02:18Z")

</div>

I’m trying to do some simple MPI calculations but have had some difficulty finding good tutorials online. For this implementation we cannot use threading, because of some interface issues with other codes (most advice I see appears to be, just use threading for problems like this).

Ok, how exactly do I do a simple calculation with mpi, preferably using scatter, and gather.

I have an array of inputs, we’ll call A and an array of outputs which I’ll call B  
and a function f that takes an input A and provides an output B.

I want to parallelize over the input array A.

This is probably the easiest MPI implementation I can think of, yet I’ve had difficulty figuring out how to implement it. I couldn’t even find any simple example implementation of mpi\_scatter and mpi\_gather online.

Thanks for any advice.

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [January 19, 2021, 10:11pm UTC](https://discourse.julialang.org/t/very-simple-mpi-implementation-question/53641/2 "2021-01-19T22:11:03Z")

</div>

Have you looked at [MPI.jl](https://juliaparallel.github.io/MPI.jl/latest/)? It contains examples that might be helpful.

Also note that Julia has its own [multi-process parallelisation implementation](https://docs.julialang.org/en/v1/manual/distributed-computing/), i.e. as an alternative to MPI.

---

<div class="post-metadata">

**Author:** ![abader](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@abader](https://discourse.julialang.org/u/abader)\
**Post date:** [January 19, 2021, 10:16pm UTC](https://discourse.julialang.org/t/very-simple-mpi-implementation-question/53641/3 "2021-01-19T22:16:24Z")

</div>

Yes, I read the documentation on MPI.jl. I did not find any example usages for mpi\_gather or mpi\_scatter. TBH I didn’t find the given examples very enlightening.

And yes, i realize that Julia has it’s own implementation, but we cannot use it in this case b/c of the need to interface with codes in other languages.

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [February 7, 2021, 11:20am UTC](https://discourse.julialang.org/t/very-simple-mpi-implementation-question/53641/4 "2021-02-07T11:20:34Z")

</div>

Hello @abader Maybe you could join the Openmpi mailing list adn ask for advice? It is quite friendly over there
