【问题标题】:Compilation of MPI "hello world" failsMPI“hello world”的编译失败
【发布时间】: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 呢?请注意,您不能使用 LAM mpicc 并期望使用 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


【解决方案1】:

你可以试试 mpic++:

mpic++ hello.c   -o hello

它正在我的机器上运行

我用过openmpi:

sudo apt-get install openmpi-bin

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-16
    • 2015-12-20
    • 2012-01-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多