Search code examples
mpiopenmpimpich

Bespoke affinity maps (process bindings) in mpich


I am implementing an application using MPICH (sudo apt get mpich) on Linux (Ubuntu).

My current solution looks like this:

HYDRA_TOPO_DEBUG=1 mpiexec.hydra -n 3 -bind-to core:1 MyApp
...
process 0 binding: 10001000
process 1 binding: 01000100
process 2 binding: 00100010

What I want, however, is assigning one process to 4 cores, while the other two are assigned to 2. I want an affinity map that looks like this:

process 0 binding: 11001100
process 1 binding: 00100010
process 2 binding: 00010001

Using SMPD on Windows, I was able to obtain the required result using sth like this:

mpiexec -n 1 -host localhost --bind-to core:2 MyApp : -n 2 -host localhost --bind-to core:1 MyApp

This however does not work with Hydra. I read every manual by now and would be happy regarding any help - even if its another hydra manual that I did not read yet. Cheers!


Solution

  • The "user" keyword can be used to assign logical cores manually. Hence, one can write:

    HYDRA_TOPO_DEBUG=1 mpiexec.hydra -n 3 -bind-to user:0+1+4+5,2+6,3+7 MyApp
    

    Then, I obtain:

    process 0 binding: 11001100
    process 1 binding: 00100010
    process 2 binding: 00010001