#include #include #include #include #include #include "mpi.h" int main(int argc, char *argv[]) { char port_name[MPI_MAX_PORT_NAME]; char port_name2[MPI_MAX_PORT_NAME]; char servername[128]; memset(port_name,'\0',MPI_MAX_PORT_NAME); memset(port_name2,'\0',MPI_MAX_PORT_NAME); memset(servername,'\0',128); sprintf(servername,"%s",argv[1]); MPI_Init(&argc, &argv); MPI_Open_port(MPI_INFO_NULL, port_name); printf("At server, name_size=%d, port_name is %s\n\n", strlen(port_name), port_name);fflush(stdout); MPI_Publish_name(servername, MPI_INFO_NULL, port_name); MPI_Lookup_name(servername, MPI_INFO_NULL, port_name2); printf("At server, name_size=%d, port_name is %s\n\n", strlen(port_name2), port_name2);fflush(stdout); MPI_Unpublish_name(servername, MPI_INFO_NULL, port_name2); MPI_Finalize(); return 0; }