代码之家  ›  专栏  ›  技术社区  ›  ptb

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

  •  5
  • ptb  · 技术社区  · 8 年前

    我有一个简单的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();
    }
    

    编译后,我可以使用 mpirun 从sbcl repl:

    * (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
    

    然而,当我在slime中运行相同的时,slime repl只是挂起。如果我直接运行可执行文件,而不是通过 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。有没有人有这个问题的解决方案,或者从哪里开始寻找?

    更新时间:

    问题源于emacs comint 模式,slime基于该模式。如果我启动 sbcl 通过 make-comint-in-buffer 然后使用 uiop:run-program

    更新2:

    读了一点之后 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
    

    对这意味着什么有什么想法吗?

    1 回复  |  直到 8 年前
        1
  •  2
  •   Svante    8 年前

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