# Crooked array saving to files

**URL:** <https://discourse.julialang.org/t/crooked-array-saving-to-files/99855>\
**Category:** General Usage\
**Created:** [June 4, 2023, 5:48pm UTC](https://discourse.julialang.org/t/crooked-array-saving-to-files/99855 "2023-06-04T17:48:10Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [June 4, 2023, 6:59pm UTC](https://discourse.julialang.org/t/crooked-array-saving-to-files/99855/3 "2023-06-04T18:59:05Z")

</div>

~~I think the issue is that you are calling `MPI.Init()` at the start of the script, and not inside the `multiply_matrices` function, like you did here [Help me pls with method error](https://discourse.julialang.org/t/help-me-pls-with-method-error/99763)  
Hence, multiple processors are trying to write to the same file at the same time.~~  
I think this happens regardless of whether you have called `MPI.Init()`.

~~Either move `MPI.Init()` inside the function or~~ Do something like this to only create the matrices once:

```julia
MPI.Init()
if rank == 0
   create_random_matrices()
end
MPI.Barrier()

```

---

_[View the full topic](https://discourse.julialang.org/t/crooked-array-saving-to-files/99855)._
