C ++未知调用约定

Ros*_*oss 3 c++ syntax mpi icc

我正在构建的程序包(SPRNG,链接在这里,但对于该问题不是必需的)在我不熟悉的某些地方使用了调用语法。对于我以前的依赖项堆栈(具有OpenMPI 1.10.1的Intel 16.0),它可以工作。不幸的是,我当前的堆栈(带有OpenMPI 3.1.3的Intel 19)不喜欢它。我不是一个c++人,除非有必要,否则我也不想大幅修改软件包。

示例代码是:

#include <mpi.h>

int main(int argc, char *argv[]) {
  int myid;

  MPI::Init(argc, argv);
  myid = MPI::COMM_WORLD.Get_rank();
}
Run Code Online (Sandbox Code Playgroud)

在以前的堆栈中,这似乎很好:

$ mpic++ --version
icpc (ICC) 16.0.0 20150815
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

$ mpirun --version
mpirun (Open MPI) 1.10.1

Report bugs to http://www.open-mpi.org/community/help/
$ mpic++ sprng_issue.cpp
<no errors>
Run Code Online (Sandbox Code Playgroud)

但是有了新的堆栈:

$ mpic++ --version
icpc (ICC) 19.0.1.144 20181018
Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.

$ mpirun --version
mpirun (Open MPI) 3.1.3

Report bugs to http://www.open-mpi.org/community/help/
$ mpic++ sprng_issue.cpp 
sprng_issue.cpp(6): error: name followed by "::" must be a class or namespace name
    MPI::Init(argc, argv);
    ^

sprng_issue.cpp(7): error: name followed by "::" must be a class or namespace name
    myid = MPI::COMM_WORLD.Get_rank();
           ^

compilation aborted for sprng_issue.cpp (code 2)
Run Code Online (Sandbox Code Playgroud)

我的问题是:

  1. 此调用方法有名称吗?我只是在搜索时遇到了麻烦。它有多奇怪/旧/非标准?

  2. 是否有用于启用旧版行为的编译器标志(Intel或其他)?

  3. 是否有其他建议,可以在不大幅修改软件包代码的情况下轻松通过?

Gil*_*det 6

C++ 绑定是从多年前从标准中删除的,并且默认情况下在Open MPI中不再构建它们。

从长远来看,您应该对代码进行现代化处理(使用普通C绑定或其他抽象层,例如Boost.MPI)。

同时,您只需使用即可重建Open MPI configure --enable-mpi-cxx