MPI“hello world”的编译失败

时间:2017-11-13 13:40:21

标签: c compiler-errors mpi

今天我尝试编译经典的MPI“hello world”程序

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

int main(int argc, char** argv)
{
    MPI_Init(&argc, &argv);

    int rank;
    int size;

    MPI_Comm_rank(MPI_COMM_WORLD,&rank);
    MPI_Comm_size(MPI_COMM_WORLD,&size);

    printf("I am rank %d of %d\n", rank, size);

    MPI_Finalize();

    return 0;
}

为此,我安装了openMPI,lam,lam-devel(用于mpicc)。我试着按照this old thread adressing this problem中给出的答案,这导致安装了automake,autoconf,libtool,并从here开始安装coreutils。不幸的是,在尝试编译上面的代码时,我仍然收到以下错误消息

mpicc hello.c   -o hello
gcc: error: libtool:: Datei oder Verzeichnis nicht gefunden
gcc: error: link:: Datei oder Verzeichnis nicht gefunden
mpicc: No such file or directory

请求编译器版本

mpicc --version
gcc (SUSE Linux) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1 个答案:

答案 0 :(得分:0)

你可以尝试使用mpic ++:

mpic++ hello.c   -o hello

它正在我的机器上工作

我用过openmpi:

sudo apt-get install openmpi-bin