简体   繁体   中英

The -bind-to command in Microsoft MPI

On Ubuntu with Open MPI installed, I can use -bind-to command to bind each of the processes to a physical core like mpiexec -np 4 -bind-to core python mycode.py . Now I have to work on Windows with MS-MPI installed, I don't know if there is a similar function.

I have tried to use -affinity and -affinity_layout according to this page like

mpiexec -np 4 -affinity -affinity_layout spread:P python mycode.py

which is supposed to raising error on my 2 physical cores laptop. But it works fine. Do you have any ideas?

Affinity with Microsoft MPI does work; Microsoft MPI just does not complain when multiple ranks land at a single core (ie when you oversubscribe).

One can find the affinities of running processes in "Task Manager > Details > (right click on process) > Set affinity".

So, on my 10-core machine, running

mpiexec -n 2 -affinity -affinity_layout spread:P notepad.exe

produces affinities

rank | 0 | 1 |
CPU  | 0 | 5 |

while running

mpiexec -n 11 -affinity -affinity_layout spread:P notepad.exe

results in

rank | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
CPU  | 0 | 5 | 1 | 6 | 2 | 7 | 3 | 8 | 4 | 9 | 0  |

ie, the mapping silently wraps around when all cores are exhausted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM