开发者社区> 问答> 正文

MPI程序给MPI通道初始化失败,我怎么解决这个错误?

我运行简单的MPI程序破解加密的密码,程序完全编译,但如果我运行mpirun -n 3 ./密码破解。py ./ | grep时间在我的命令行,我无法运行MPI程序 程序说明: MPID_Init ....... (162):通道初始化失败 当我以前写python的时候。/密码破解。py 另一个错误程序显示: HYDU_create_process (utils/launch/launch.c:74):文件python上的execvp错误(没有这样的文件或目录) 问题来源StackOverflow 地址:/questions/59467016/mpi-program-gives-mpi-channel-initialization-failed-how-can-i-solve-this-error

展开
收起
kun坤 2019-12-25 10:12:05 2096 0
1 条回答
写回答
取消 提交回答
  • 估计是因为安装了open-mpi and mpich2

    When I compile my program using mpicc, it will be linked to open-mpi not mpich2. To fix this problem, you can use "mpicc.mpich2" to compile your program and then use "mpiexe.mpich2" to execute your code.

    测试脚本

    include <stdio.h>

    include <mpi.h>

    int main(int argc, char** argv) {
        int myrank, nprocs;
     
        MPI_Init(&argc, &argv);
        MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
        MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
     
        printf("Hello from processor %d of %d\n", myrank, nprocs);
       
        MPI_Finalize();
        return 0;
    }
    

    mpicc MPI_Hello.c -o MPI_Hello

    编译成功

    mpiexec -n 5 ./MPI_Hello 运行报错

    [[INVALID],INVALID] ORTE_ERROR_LOG: A system-required executable either could not be found or was not executable by this user in file ../../../../../../orte/mca/ess/singleton/ess_singleton_module.c at line 357 [[INVALID],INVALID] ORTE_ERROR_LOG: A system-required executable either could not be found or was not executable by this user in file ../../../../../../orte/mca/ess/singleton/ess_singleton_module.c at line 230

    解决步骤

    1、dpkg --listfiles mpich2

    ......

    /usr/bin/mpirun.mpich2 /usr/bin/mpiexec.mpich2

    从什么可以看出

    2、mpicc.mpich2 MPI_Hello.c -o MPI_Hello

    3、mpiexec.mpich2 -n 5 ./MPI_Hello

    Hello from processor 0 of 5 Hello from processor 1 of 5 Hello from processor 3 of 5 Hello from processor 2 of 5 Hello from processor 4 of 5

    2019-12-25 11:03:03
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
面向失败设计 立即下载
fibjs 模块重构从回调到协程--陈垒 立即下载
fibjs 模块重构从回调到协程 立即下载