【问题标题】:How to debug MPI program before bad termination?如何在错误终止之前调试 MPI 程序?
【发布时间】:2019-03-23 08:21:40
【问题描述】:

我目前正在开发一个使用 MPI+pthread 范例的 C++ 编写的程序。

我在我的程序中添加了一些功能,但是我收到了来自一个 MPI 进程的错误终止消息,如下所示:

===================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 37805 RUNNING AT node165
=   EXIT CODE: 11
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
[proxy:0:0@node162] HYD_pmcd_pmip_control_cmd_cb (pm/pmiserv/pmip_cb.c:887): assert (!closed) failed
[proxy:0:0@node162] HYDT_dmxu_poll_wait_for_event (tools/demux/demux_poll.c:76): callback returned error status
[proxy:0:2@node166] HYD_pmcd_pmip_control_cmd_cb (pm/pmiserv/pmip_cb.c:887): assert (!closed) failed
[proxy:0:2@node166] HYDT_dmxu_poll_wait_for_event (tools/demux/demux_poll.c:76): callback returned error status
[proxy:0:2@node166] main (pm/pmiserv/pmip.c:202): demux engine error waiting for event
srun: error: node162: task 0: Exited with exit code 7
[proxy:0:0@node162] main (pm/pmiserv/pmip.c:202): demux engine error waiting for event
srun: error: node166: task 2: Exited with exit code 7
[mpiexec@node162] HYDT_bscu_wait_for_completion (tools/bootstrap/utils/bscu_wait.c:76): one of the processes terminated badly; aborting
[mpiexec@node162] HYDT_bsci_wait_for_completion (tools/bootstrap/src/bsci_wait.c:23): launcher returned error waiting for completion
[mpiexec@node162] HYD_pmci_wait_for_completion (pm/pmiserv/pmiserv_pmci.c:218): launcher returned error waiting for completion
[mpiexec@node162] main (ui/mpich/mpiexec.c:340): process manager error waiting for completion

我的问题是,我不知道为什么我会收到这种消息,以及如何更正它。

我只使用了 MPI 的一些基本函数,并确保没有使用 MPI 调用的线程(只允许我的“主进程”调用这些函数)。

我还检查了一个进程没有向自己发送消息,并且在发送消息之前进程目标存在。

我的问题很简单:如何知道问题出在哪里然后调试我的应用程序?

非常感谢。

【问题讨论】:

    标签: debugging mpi


    【解决方案1】:

    您的某个进程出现分段错误。这意味着读取或写入不允许的内存区域。

    这就是原因,而且 MPI 函数通常很难在第一次就正确处理 - 例如,可能是 MPI 发送和接收函数的大小或位置不正确。

    最好的解决方案是启动并行调试器,以便您可以观察所有进程。看起来您正在使用正确的 HPC 系统,因此系统上可能安装了一个 - ddt 或 totalview 是最受欢迎的。

    看看How to debug an MPI program

    【讨论】:

    • 首先,您可以强制生成一个核心ulimit -c unlimited; mpirun ... 并使用gdb 进行事后调试(例如,不需要并行调试器)。如果错误根本没有任何意义,请尝试ulimit -s unlimited; mpirun ... 看看是否有帮助。
    • ulimit 不会那么容易工作:该示例在两个节点上(node162 是 mpirun,但 node165 是它崩溃的地方)并且 ulimit 不会跟随到 node165。您可以(对于大多数 MPI)让 mpirun 改为执行脚本,设置 ulimit -c 然后执行应用程序。注意:ulimit -c 对 HPC 来说不是一个好习惯,因为当你去到更高的规模时,每个进程可能会同时崩溃,并生成一个 Gb 的核心转储文件 - 这些文件都同时写入文件系统。
    • 在配置良好的集群上,ulimits 从mpirun 传播。显然ulimit -c unlimited 不应该是默认值。除非您有无限的预算,否则(商业)并行调试器也无法扩展。
    猜你喜欢
    • 2019-11-26
    • 1970-01-01
    • 1970-01-01
    • 2013-06-04
    • 1970-01-01
    • 2017-08-31
    • 1970-01-01
    • 2017-08-13
    • 1970-01-01
    相关资源
    最近更新 更多