# Pmap that uses workers() AND the master process for computation?

**URL:** <https://discourse.julialang.org/t/pmap-that-uses-workers-and-the-master-process-for-computation/408>\
**Category:** General Usage\
**Tags:** question\
**Created:** [November 18, 2016, 11:04am UTC](https://discourse.julialang.org/t/pmap-that-uses-workers-and-the-master-process-for-computation/408 "2016-11-18T11:04:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![floswald](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/floswald/32/195_2.png) [@floswald](https://discourse.julialang.org/u/floswald)\
**Post date:** [November 18, 2016, 11:04am UTC](https://discourse.julialang.org/t/pmap-that-uses-workers-and-the-master-process-for-computation/408/1 "2016-11-18T11:04:58Z")

</div>

i understand that `pmap` distributes tasks among `workers()` by default. in particular, `?pmap` say`

> If a worker pool is not specified, all available workers, i.e., the default worker pool is used.

Is it possible to define a worker pool that inlcudes the master process? How? If not, what is the best way to use all available compute resources (workers + master) in a `pmap` kind of way? thanks.

---

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [November 20, 2016, 7:23am UTC](https://discourse.julialang.org/t/pmap-that-uses-workers-and-the-master-process-for-computation/408/2 "2016-11-20T07:23:31Z")

</div>

Do you specifically want the master process to be in the worker pool?  
If you just want to match the number of workers with compute cores, then simply add another worker.  
(Note that any number of workers can be added, regardless of actual compute cores).

Intuitively, it makes sense to add the same number of workers as physical cores, and this is probably a good starting point.  
In practice, finding the optimal number of workers may require some experimenting.

Interesting read here: [http://www.stochasticlifestyle.com/236-2/](http://www.stochasticlifestyle.com/236-2/)

---

<div class="post-metadata">

**Author:** ![floswald](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/floswald/32/195_2.png) [@floswald](https://discourse.julialang.org/u/floswald)\
**Post date:** [November 20, 2016, 7:54pm UTC](https://discourse.julialang.org/t/pmap-that-uses-workers-and-the-master-process-for-computation/408/3 "2016-11-20T19:54:01Z")

</div>

thanks, that is helpful!
