0

虽然,我找到了I_MPI_HYDRA_NAMESERVER环境变量,但我无法成功使用它。我需要启动服务器守护进程吗?

char port_name[] = "exmplport",
    service_name[] = "exmplservice";
  if (world_p==0) 
 {
    MPI_Comm intercomm;
    MPI_Publish_name( service_name, MPI_INFO_NULL, port_name );
    printf("Published Name\n");
    MPI_Unpublish_name( service_name, MPI_INFO_NULL, port_name );
  } else
 {
    MPI_Lookup_name( service_name,MPI_INFO_NULL,port_name );
  }

错误:

[c210-008 c:3] export I_MPI_HYDRA_NAMESERVER=`hostname`:8000
[c210-008 c:4] make publishbug && mpiexec.hydra -n 2 publishbug
make: `publishbug' is up to date.
[mpiexec@c210-008.frontera.tacc.utexas.edu] HYD_sock_connect (../../../../../src/pm/i_hydra/libhydra/sock/hydra_sock_intel.c:228): Retrying connection, retry_count=1, retries=0
[mpiexec@c210-008.frontera.tacc.utexas.edu] HYD_sock_connect (../../../../../src/pm/i_hydra/libhydra/sock/hydra_sock_intel.c:243): unable to connect from "c210-008.frontera.tacc.utexas.edu" to "c210-008.frontera.tacc.utexas.edu" (Connection refused)
[mpiexec@c210-008.frontera.tacc.utexas.edu] mpiexec_connect_to_nameserver (../../../../../src/pm/i_hydra/mpiexec/mpiexec_utils.c:425): unable to connect to nameserver
[mpiexec@c210-008.frontera.tacc.utexas.edu] mpiexec_publish_name (../../../../../src/pm/i_hydra/mpiexec/mpiexec_utils.c:499): unable to connect to nameserver
[mpiexec@c210-008.frontera.tacc.utexas.edu] control_cb (../../../../../src/pm/i_hydra/mpiexec/mpiexec.c:1484): error publishing service
[mpiexec@c210-008.frontera.tacc.utexas.edu] HYDI_dmx_poll_wait_for_event (../../../../../src/pm/i_hydra/libhydra/demux/hydra_demux_poll.c:80): callback returned error status
[mpiexec@c210-008.frontera.tacc.utexas.edu] main (../../../../../src/pm/i_hydra/mpiexec/mpiexec.c:2019): error waiting for event
 
4

1 回答 1

0

我尝试了命令 ~$ hydra_nameserver 来启动 hydra 名称服务器,然后我没有直接给出端口号,而是使用 MPI_Open_port() 来获取端口号并在 MPI_Publish_name() 中使用它。

后来我试了

~$ make publishbug && I_MPI_HYDRA_NAMESERVER= hostnamempiexec.hydra -n 2 publishbug

我按照以下链接获取示例代码(client.cpp 和 server.cpp) https://github.com/SteffenSeckler/MPI_Connect_Test

于 2021-08-10T11:29:34.053 回答