今天我尝试编译经典的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/