How to get <rank, hostname> pairs in a specified host file in MPI

When starting the MPI program, we use the command
mpiexec -hostfile ./conf/machines <my_mpi_program>

My host file ./conf/machines

192.168.1.54
192.168.1.55
192.168.1.56
192.168.1.57

And when I ran the MPI program, I got a processor rating MPI_Comm_rank.
My question is: how to get a pair of <rank, hostname>each rank?
hostnameshould match the hostfile i spcecified and i just want to use ipaddress as the hostname in the host file.

I tried using MPI_Get_processor_name, but it returned my host name teaker-4, not the name in the specified host file.

And also teaker-4there 127.0.0.1, and I can’t change/etc/hosts

+4
source share

Source: https://habr.com/ru/post/1585069/


All Articles