MPI "hello world"编译失败

标签 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.

最佳答案

你可以试试 mpic++ 吗:

mpic++ hello.c   -o hello

它正在我的机器上运行

我使用了openmpi:

sudo apt-get install openmpi-bin

关于MPI "hello world"编译失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47265688/

相关文章:

C、读取 .bmp 时遇到问题

oop - 没有 writeln 时找不到构造函数

c++ - 如何在不指定Unix 中所有C 编译器位置的情况下指定一个程序配置文件的位置?

scala - Scala JavaConverters似乎不适用于静态方法返回的集合

c - 并行演示程序

c - C 中的 LinkedList 元素交换问题

字符排序算法

c - 如何在C中正确操作字符串

linux - 打开 MPI 虚拟定时器已过期

c++ - MPI 中发送消息数量未知时,如何接收?