I am running my executable with OpenMPI on a cluster using the SLURM resource managing software. I would like to find a way to specify how many and which processes should be assigned to each of the nodes, where the number of processes might be different for each node.
An example to clarify what I am looking for: Suppose I want to run 7 processes on 3 nodes. Then I want to be able to say something like: node 1 should run the process with rank n, node 2 and 3 should each run 3 of the remaining processes.
I do not care which physical node is node 1, as all the nodes are equal on the cluster I am using. Also I do not know a priori which nodes I will get assigned by SLURM, so I cannot hard-code the nodes' names in a hostfile. An example in the OpenMPI documentation that I found would define the hostfile like this for my example:
aa slots=1
bb slots=3
cc slots=3
but I have two problems with this approach:
- I do not know a priori the names aa, bb, cc of the nodes.
- Even if I knew them, the process on node aa does not necessarily have the right rank.