# How to get the number of workers in a machine or cluster node?

**URL:** <https://discourse.julialang.org/t/how-to-get-the-number-of-workers-in-a-machine-or-cluster-node/88925>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 18, 2022, 6:50pm UTC](https://discourse.julialang.org/t/how-to-get-the-number-of-workers-in-a-machine-or-cluster-node/88925 "2022-10-18T18:50:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![decarvalhojuniorfh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/decarvalhojuniorfh/32/35453_2.png) [@decarvalhojuniorfh](https://discourse.julialang.org/u/decarvalhojuniorfh)\
**Post date:** [October 18, 2022, 6:50pm UTC](https://discourse.julialang.org/t/how-to-get-the-number-of-workers-in-a-machine-or-cluster-node/88925/1 "2022-10-18T18:50:33Z")

</div>

In a distributed program, how do you programmatically obtain the number of workers on the node of a cluster where a code is running?

For example, if there were 6 workers launched using `addprocs ([(“machine1", 4), (“machine2", 2)])`, a code on machine1 would receive 4 as a result, while a code on machine2 would receive 2.

---

<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:** [October 19, 2022, 3:54am UTC](https://discourse.julialang.org/t/how-to-get-the-number-of-workers-in-a-machine-or-cluster-node/88925/2 "2022-10-19T03:54:30Z")

</div>

try `length(procs(myid()))`
