# Customizing SharedArray

**URL:** https://discourse.julialang.org/t/customizing-sharedarray/62933
**Category:** General Usage
**Tags:** parallel
**Created:** [June 15, 2021, 9:30am UTC](https://discourse.julialang.org/t/customizing-sharedarray/62933 "2021-06-15T09:30:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![FredericN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredericn/32/21170_2.png) [@FredericN](https://discourse.julialang.org/u/FredericN)
#### Post date: [June 15, 2021, 9:30am UTC](https://discourse.julialang.org/t/customizing-sharedarray/62933/1 "2021-06-15T09:30:52Z")

</div>

When creating a SharedArray as in  
using SharedArrays  
using Distributed

addprocs(4)

a = SharedArray{Float64}(40)

the partitioning of entries is made automatically. Does anyone knows if it is possible to set my own partitioning of the data ? Related question: where can I find a full documentation of the package SharedArrays?  
Many thanks.

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [June 15, 2021, 10:03am UTC](https://discourse.julialang.org/t/customizing-sharedarray/62933/2 "2021-06-15T10:03:34Z")

</div>

`SharedArrays` is a standard library, so the documentation is part of the documentation of the core language. Relevant entries:

[https://docs.julialang.org/en/v1/stdlib/SharedArrays/](https://docs.julialang.org/en/v1/stdlib/SharedArrays/)

and

[https://docs.julialang.org/en/v1/manual/distributed-computing/#man-shared-arrays](https://docs.julialang.org/en/v1/manual/distributed-computing/#man-shared-arrays)

---

<div class="post-metadata">

### Author: ![FredericN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredericn/32/21170_2.png) [@FredericN](https://discourse.julialang.org/u/FredericN)
#### Post date: [June 15, 2021, 12:14pm UTC](https://discourse.julialang.org/t/customizing-sharedarray/62933/3 "2021-06-15T12:14:35Z")

</div>

Thanks for the links but I am looking for a detailed documentation if it exists.

---

<div class="post-metadata">

### Author: ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)
#### Post date: [June 15, 2021, 12:33pm UTC](https://discourse.julialang.org/t/customizing-sharedarray/62933/4 "2021-06-15T12:33:54Z")

</div>

> [@FredericN](#):
>
> the partitioning of entries is made automatically

What do you mean by “partitioning” here? The SharedArray is accessible to all processes that it’s mapped on equally, i.e. it is not a chunked array. You can change which workers have the array mapped with the `pids` kwarg.

If you mean that you want to be able to initialize it differently, you can just do that after you create it.

> [@FredericN](#):
>
> Thanks for the links but I am looking for a detailed documentation if it exists.

I suppose it’s not super well documented since it’s a pretty simple mechanism; I found the code pretty enlightening, so maybe you will too. If you find anything that’s not documented that you think is important for using a SharedArray, you’re welcome to open a PR to improve the docs 🙂

---

<div class="post-metadata">

### Author: ![FredericN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredericn/32/21170_2.png) [@FredericN](https://discourse.julialang.org/u/FredericN)
#### Post date: [June 15, 2021, 1:44pm UTC](https://discourse.julialang.org/t/customizing-sharedarray/62933/5 "2021-06-15T13:44:07Z")

</div>

By partitioning, I mean I want to impose the number of local indices for each worker.
