Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c++ unknown calling convention

Tags:

c++

syntax

icc

mpi

A package I'm building (SPRNG, link is here but unnecessary for this question) uses a calling syntax in some places that I'm not familiar with. For my previous dependency stack (Intel 16.0 with OpenMPI 1.10.1), it worked. Unfortunately, my current stack (Intel 19 with OpenMPI 3.1.3) doesn't like it. I'm not a c++ person, nor do I want to substantially modify the package unless I have to.

The sample code is:

#include <mpi.h>

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

  MPI::Init(argc, argv);
  myid = MPI::COMM_WORLD.Get_rank();
}

On the previous stack, this appeared to be fine:

$ 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>

But with the new stack:

$ 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)

My questions are:

  1. Is there a name for this calling method? I had trouble searching because it's just. How strange/old/non-standard is it?

  2. Is there a compiler flag (Intel or others) to enable the legacy behavior?

  3. Any other recommendations for an easy way to get past without substantially modifying the package code?

like image 346
Ross Avatar asked Dec 30 '25 14:12

Ross


1 Answers

C++ bindings were removed from the standard many years ago, and they are no more built by default in Open MPI.

On the long run, you should modernize your code (use plain C bindings, or other abstraction layer such as Boost.MPI).

Meanwhile, you can simply rebuild Open MPI with configure --enable-mpi-cxx.

like image 135
Gilles Gouaillardet Avatar answered Jan 01 '26 03:01

Gilles Gouaillardet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!