mpirun on CPUs with specified IDs

616 views Asked by At

Does anyone know how to execute mpirun on specified CPUs? Though "mpirun -np 4 " specifies the number of CPUs used, what I here want to do is to specify CPU IDs.

The OS is CentOS 5.6 and MVAPICH2 is used on a single node with 6x2 cores.

Thank you for your cooperation.

1

There are 1 answers

0
Jonathan Dursi On

Yes; new versions of mvapich2 use the hwloc library to enable CPU affinity and binding.

From the User Guide:

For example, if you want to run 4 processes per node and utilize cores 0, 1, 4, 5 on each node, you can specify:

$ mpirun_rsh -np 64 -hostfile hosts MV2_CPU_MAPPING=0:1:4:5 ./a.out

or

$ mpiexec -n 64 -f hosts -env MV2_CPU_MAPPING 0:1:4:5 ./a.out

In this way, process 0 on each node will be mapped to core 0, process 1 will be mapped to core 1, process 2 will be mapped to core 4, and process 3 will be mapped to core 5. For each process, the mapping is separated by a single “:”.