# How to launch workers on specific allocation node?

**URL:** <https://discourse.julialang.org/t/how-to-launch-workers-on-specific-allocation-node/24336>\
**Category:** Julia at Scale\
**Created:** [May 17, 2019, 8:54pm UTC](https://discourse.julialang.org/t/how-to-launch-workers-on-specific-allocation-node/24336 "2019-05-17T20:54:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [May 17, 2019, 8:54pm UTC](https://discourse.julialang.org/t/how-to-launch-workers-on-specific-allocation-node/24336/1 "2019-05-17T20:54:27Z")

</div>

Hi!

I am doing some process that uses a ton of memory.  
The way I thought of doing it is to request 2 nodes via slurm and then send the memory-intensive part to a second node.

My process looks like:

`salloc --nodes 2 -C haswell -q interactive -t 00:05:00`

Now, I want to launch workers in the second node specifically, but if I do

```julia
using Distributed, ClusterManagers

addprocs(SlurmManager(6))

```

I have no control over where are the workers launched.

Is there a way to control where the workers are going to be launched?

Thanks!

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [May 17, 2019, 11:02pm UTC](https://discourse.julialang.org/t/how-to-launch-workers-on-specific-allocation-node/24336/2 "2019-05-17T23:02:01Z")

</div>

A hacky solution that I found is:

If I need to launch 6 workers on the second node, and I have only two nodes, I can launch them via:

```julia
addprocs(SlurmManager(12),m="cyclic")

```

The distribution option `"cyclic"`, tells slurm to assign the workers in a round-robin way, so we know that:

workers 3, 5, 7, 9, 11 and 13 are on the second machine.

This allows me to launch 6 parallel tasks via `@spawnat`

```julia
@spawnat 3 task1
@spawnat 5 task2
@spawnat 7 task3
...

```

and so on.
