Slime\Emacs comint 在启动 mpi 进程时挂起



我有一个简单的 mpi 程序来演示我的问题:

#include <stdio.h>
#include <mpi.h>
int main(int argc, char *argv[])
{
int rank, csize;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &csize);
printf("Hello from rank[%d/%d]n", rank, csize);
MPI_Finalize();
}

编译后,我可以使用 sbcl repl 中的mpirun成功启动可执行文件:

* (uiop:run-program '("mpirun" "-np" "10" "./hello_world") :output :string)
"Hello from rank[7/10]
Hello from rank[9/10]
Hello from rank[5/10]
Hello from rank[8/10]
Hello from rank[0/10]
Hello from rank[1/10]
Hello from rank[2/10]
Hello from rank[3/10]
Hello from rank[4/10]
Hello from rank[6/10]
"
NIL
0

但是,当我从粘液内部运行相同的内容时,粘液回复只是挂起。 如果我直接运行可执行文件,而不是通过mpirun启动器,那么一切运行正常:

CL-USER> (uiop:run-program '("./hello_world")
:output :string)
"Hello from rank[0/1]
"
NIL
0

我在 linux 工作站上使用 sbcl-1.4.5 和 slime 2.20。 有没有人有解决这个问题的方法或寻找的起点?

更新:

问题源于 emacscomint模式,而 slimee 就是基于这种模式的。 如果我通过make-comint-in-buffer启动sbcl然后使用uiop:run-program,我会观察到相同的挂起行为。

UPDATE2:

在阅读了comint模式后,我能够捕获挂起过程中的一些输出。 这个 emacs lisp 代码:

(make-comint "foo" "mpirun" nil "-np" "1" "/home/ptb/programming/c/hello_world")

在挂起的进程中产生以下错误:

[warn] Epoll MOD(1) on fd 14 failed.  Old events were 6; read change was 0 (none); write change was 2 (del): Bad file descriptor
[warn] Epoll MOD(4) on fd 14 failed.  Old events were 6; read change was 2 (del); write change was 0 (none): Bad file descriptor

关于这意味着什么的任何想法?

我想这是openmpi或libevent中重定向stdin/stdout的问题(过去有这样的问题,例如 bugzilla.redhat.com/show_bug.cgi?id=1235044(。您使用哪个版本?

最新更新