# What is the best practice for parallel dictionary comprehensions?

**URL:** <https://discourse.julialang.org/t/what-is-the-best-practice-for-parallel-dictionary-comprehensions/108786>\
**Category:** General Usage\
**Tags:** question, distributed\
**Created:** [January 14, 2024, 8:48am UTC](https://discourse.julialang.org/t/what-is-the-best-practice-for-parallel-dictionary-comprehensions/108786 "2024-01-14T08:48:13Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![cdawg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cdawg/32/9811_2.png) [@cdawg](https://discourse.julialang.org/u/cdawg)\
**Post date:** [January 14, 2024, 11:29am UTC](https://discourse.julialang.org/t/what-is-the-best-practice-for-parallel-dictionary-comprehensions/108786/3 "2024-01-14T11:29:18Z")

</div>

> Is there a particular reason in your application why you need dictionaries already during the parallel stage?

Not here 😅. Indeed for this project I’m using pmap and rolling everything up at the end.

But I wanted to understand spawn and sync better so I can balance the load better in deeper loops, and work out how to write this reduction “properly”. All I can rely on right now is pmap and I’m looking to up my || game, since it’s leaving a lot of CPU on the table because of imbalances.

Update: re 4.) I’m using vs code parameter to set-threads for running a script block by block. Im trying to check if concurrency of pmap is limited by nthreads or not.  
I found the pattern from [`this post`](https://discourse.julialang.org/t/distributed-nested-in-pmap/21081/2) helpful

```julia
np = addprocs(4)
…
rmprocs(np)

```

for controlling and freeing ram at the end of a distributed thing.

---

_[View the full topic](https://discourse.julialang.org/t/what-is-the-best-practice-for-parallel-dictionary-comprehensions/108786)._
