【发布时间】:2018-04-26 05:10:17
【问题描述】:
今天尝试编译经典的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.
【问题讨论】:
-
which mpicc说什么?mpicc -showme hello_c.c呢?请注意,您不能使用LAMmpicc并期望使用Open MPI。你需要安装openmpi-devel吗? -
@GillesGouaillardet
which mpicc给出/usr/bin/mpicc,而mpicc -showme hello.c给出gcc -pthread hello.c libtool: link: -pthread -L/usr/lib64 -llammpio -llamf77mpi -lmpi -llam -lutil -ldl -
所以您正在使用
mpicc用于 LAM-MPI(现已过时)。您宁愿(安装和)使用mpicc来进行 Open MPI。但是如果你想使用 LAM-MPI,只需安装libtool包就可以了。 -
@GillesGouaillardet 你是我的英雄,非常感谢你!只需安装 openmpi-devel 包,一切正常。
-
如果您没有任何 infinipath 硬件,那么您可以忽略
libpsm_infinipath.so.1消息。如果你export LANG=C,那么错误信息将以简单的英文显示,我将能够理解它。rpm -ql openmpi-devel | grep mpicc将向您显示mpicc的完整路径,如果/usr/bin/mpicc是由alternatives创建的符号链接,您可能需要进行一些更新
标签: c compiler-errors mpi