Yoni4949
Yoni4949

Reputation: 15

MPI bind ranks to specific nodes via Slurm

I use sbatch to allocate an MPI job with (let's say) 8 ranks. I use 4 nodes: node0[01-04]. I would like to bind rank 0 to the first node (node001) and the other ranks to the other nodes (node0[02-04]). How can it be done using sbatch?

Thank you!

Upvotes: 0

Views: 1118

Answers (1)

tomgalpin
tomgalpin

Reputation: 2099

See https://slurm.schedmd.com/sbatch.html environment variables

SLURM_NODEID will give you the ID of the node in the allocation

SLURM_NNODES will give you the total amount of nodes allocated.

If you want to specific about ensuring the order of the nodes matches the rank you will also need to parse.

SLURM_JOB_NODELIST

Upvotes: 2

Related Questions