# Shared Memory with MPI.jl

**URL:** <https://discourse.julialang.org/t/shared-memory-with-mpi-jl/41747>\
**Category:** General Usage\
**Tags:** parallel\
**Created:** [June 19, 2020, 7:39pm UTC](https://discourse.julialang.org/t/shared-memory-with-mpi-jl/41747 "2020-06-19T19:39:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aditya\_314](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@aditya\_314](https://discourse.julialang.org/u/aditya_314)\
**Post date:** [June 19, 2020, 7:39pm UTC](https://discourse.julialang.org/t/shared-memory-with-mpi-jl/41747/1 "2020-06-19T19:39:11Z")

</div>

Sorry if this question is silly, I am new to parallel programming, I am using MPI.jl for writing distributed code. I want the processes to share an array. Is is possible to do this ? I know one way is to let one process store the array and other processes can access it by send/receive, but I think that might be slow.

---

<div class="post-metadata">

**Author:** ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Post date:** [June 20, 2020, 1:46am UTC](https://discourse.julialang.org/t/shared-memory-with-mpi-jl/41747/2 "2020-06-20T01:46:48Z")

</div>

On a single computer, yes, on multiple computers, I don’t think so. If all the processes are on a single computer then using [Memory-mapped I/O · The Julia Language](https://docs.julialang.org/en/v1/stdlib/Mmap/#Mmap.mmap) to map a file into memory for each process should allow all them all to see the same memory.

However with a single computer it would probably be better to just use threads so there isn’t any process communication.

I’m not sure if there is a network file system that would allow you to mmap a file, which is why this probably won’t work across multiple computers.
