# Julia pmap how to write each worker into separate index using parallel computing

**URL:** <https://discourse.julialang.org/t/julia-pmap-how-to-write-each-worker-into-separate-index-using-parallel-computing/90961>\
**Category:** Performance\
**Tags:** question\
**Created:** [November 28, 2022, 4:55pm UTC](https://discourse.julialang.org/t/julia-pmap-how-to-write-each-worker-into-separate-index-using-parallel-computing/90961 "2022-11-28T16:55:00Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [November 29, 2022, 3:17pm UTC](https://discourse.julialang.org/t/julia-pmap-how-to-write-each-worker-into-separate-index-using-parallel-computing/90961/7 "2022-11-29T15:17:03Z")

</div>

Hi Pedro — please check out [Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757) for some guidance on how to format and present your posts in a more readable manner. Importantly, it can be very useful to use “code fences” (blocks of code surrounded by triple-backticks `````) to make your code more readable.

Your initial error —

```julia
ERROR: On worker 6:

ArgumentError: invalid index: 1.0 of type Float64
Stacktrace:
[1] to_index
@ ./indices.jl:300
[2] to_index
@ ./indices.jl:277
[3] to_indices

```

Is not that a worker is trying to write into a “wrong” index, but rather, that you’re doing some floating point computation for an index and haven’t converted it to an integer. Note that `N/nworkers()` will return a floating point number — I’m betting you want `N ÷ nworkers()` instead.

---

_[View the full topic](https://discourse.julialang.org/t/julia-pmap-how-to-write-each-worker-into-separate-index-using-parallel-computing/90961)._
