How to launch workers on specific allocation node?


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

using Distributed, ClusterManagers


I have no control over where are the workers launched.

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


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:


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

@spawnat 3 task1
@spawnat 5 task2
@spawnat 7 task3

and so on.