【问题标题】:MPI programs hanging upMPI 程序挂起
【发布时间】:2015-05-18 06:28:47
【问题描述】:

我使用以下命令在我的 Ubuntu 14.04 笔记本电脑上安装了 mpich2:

sudo apt-get install libcr-dev mpich2 mpich2-doc

这是我要执行的代码:

#include <mpi.h>
#include <stdio.h>

int main()
{
    int myrank, size;
    MPI_Init(NULL, NULL);
    MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);

    printf("Hello world! I am %d of %d\n", myrank, size);

    MPI_Finalize();
    return 0;
}

将其编译为mpicc helloworld.c 不会出错。但是当我将程序执行为:mpirun -np 5 ./a.out 没有输出时,程序只是继续执行,就好像它处于无限循环中一样。按 Ctrl+C 时,我得到的是:

$ mpirun -np 5 ./a.out                                                                                                                                                        
^C[mpiexec@user] Sending Ctrl-C to processes as requested
[mpiexec@user] Press Ctrl-C again to force abort
[mpiexec@user] HYDU_sock_write (./utils/sock/sock.c:291): write error (Bad file descriptor)
[mpiexec@user] HYD_pmcd_pmiserv_send_signal (./pm/pmiserv/pmiserv_cb.c:170): unable to write data to proxy
[mpiexec@user] ui_cmd_cb (./pm/pmiserv/pmiserv_pmci.c:79): unable to send signal downstream
[mpiexec@user] HYDT_dmxu_poll_wait_for_event (./tools/demux/demux_poll.c:77): callback returned error status
[mpiexec@user] HYD_pmci_wait_for_completion (./pm/pmiserv/pmiserv_pmci.c:197): error waiting for event
[mpiexec@user] main (./ui/mpich/mpiexec.c:331): process manager error waiting for completion

我无法通过谷歌搜索找到任何解决方案。是什么导致了这个错误?

【问题讨论】:

  • 试试int main(int argc, char *argv[])MPI_Init(&amp;argc,&amp;argv); ...但是,正如documentation of MPICH2 中所述,MPI_Init() 将接受 NULL 作为输入参数...尝试which mpiccwhich mpirunmpirun -version 知道 mpirun 和 mpicc 是否都对应于 mpich。如果 mpicc 指 mpich 和 mpirun 指 openmpi,就会发生奇怪的事情。也可以试试mpirun -np 5 a.out
  • 感谢您的回复。我尝试添加 argc、argv、mpirun np 5 a.out 但得到了同样的错误。 which mpicc 给了/usr/bin/mpicc,而 mpirun 给了/usr/bin/mpirun。 mpirun -version 在多次出现 mpich 时给出了很多输出,所以我猜它一定是指 mpich。我还能尝试什么?
  • mpiexec 给出了同样的错误。
  • 其他 cmets 正在解决此问题的最常见原因:mpi 实现之间的不匹配。您是否安装了任何其他 MPI? OpenMPI,您构建的 MPICH 的旧版本?
  • 您可以尝试mpicc helloword.c -v 打印编译器调用的程序吗? openmpimpich 已链接,它将作为库的调用出现在 GCC_OPTIONS 中。

标签: c linux ubuntu mpi mpich


【解决方案1】:

我在两个计算节点上遇到了同样的问题:

$ mpirun -np 10 -ppn 5 --hosts c1,c2 ./a.out  
[mpiexec@c1] Press Ctrl-C again to force abort
[mpiexec@c1] HYDU_sock_write (utils/sock/sock.c:286): write error (Bad file descriptor)
[mpiexec@c1] HYD_pmcd_pmiserv_send_signal (pm/pmiserv/pmiserv_cb.c:169): unable to write data to proxy
[mpiexec@c1] ui_cmd_cb (pm/pmiserv/pmiserv_pmci.c:79): unable to send signal downstream
[mpiexec@c1] HYDT_dmxu_poll_wait_for_event (tools/demux/demux_poll.c:76): callback returned error status
[mpiexec@c1] HYD_pmci_wait_for_completion (pm/pmiserv/pmiserv_pmci.c:198): error waiting for event
[mpiexec@c1] main (ui/mpich/mpiexec.c:344): process manager error waiting for completion

原来 c1 节点无法 ssh c2

如果你只使用单机,你可以尝试使用fork作为启动器:

mpirun -launcher fork -np 5 ./a.out

【讨论】:

    猜你喜欢
    • 2019-01-03
    • 1970-01-01
    • 2015-12-30
    • 2016-01-23
    • 1970-01-01
    • 2013-03-27
    • 2015-12-01
    • 2013-05-18
    • 2013-02-20
    相关资源
    最近更新 更多