# Pmap but with control over which workers do the tasks?

**URL:** <https://discourse.julialang.org/t/pmap-but-with-control-over-which-workers-do-the-tasks/33270>\
**Category:** Julia at Scale\
**Tags:** question\
**Created:** [January 12, 2020, 5:51pm UTC](https://discourse.julialang.org/t/pmap-but-with-control-over-which-workers-do-the-tasks/33270 "2020-01-12T17:51:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alan\_Crawford](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alan_crawford/32/4213_2.png) [@Alan\_Crawford](https://discourse.julialang.org/u/Alan_Crawford)\
**Post date:** [January 12, 2020, 5:51pm UTC](https://discourse.julialang.org/t/pmap-but-with-control-over-which-workers-do-the-tasks/33270/1 "2020-01-12T17:51:08Z")

</div>

I am wondering how to parallelize an expensive computation _but_ where I  
specify which workers do the work?

By way of background, in my use case each worker does a large computation on worker-specific objects (i.e. stored in `Main` on each worker - I realise this is clunky, but other considerations have dictated this approach) and returns a vector. I want then take a sum over this vector of vectors from each worker. If i didn’t care which workers did the tasks, summing over the output of `pmap` would be perfect. However, I need to be sure each worker does exactly one task.

It seems like i should be able to do this with a @distributed for loop and @spawnat, but I am not making progress. In particular, I am not sure how to move the output vector resulting from the @spawnat from the worker to the master process .

Any help greatly appreciated!

**Update** : Solved by [this post](https://stackoverflow.com/questions/37287020/how-and-when-to-use-async-and-sync-in-julia)
