HP-MPI supports C++ bindings as described in the MPI-2 Standard.
(See “Documentation
resources ”.) If compiling
and linking with the mpiCC command, no additional work is needed to include and
use the bindings. You can include either mpi.h or mpiCC.h in your C++ source files.
The bindings provided by HP-MPI are an interface class, calling
the equivalent C bindings. To profile your application, users should
profile the equivalent C bindings.
If the user builds without the mpiCC command, they will need to include -lmpiCC to
resolve C++ references.
If you want to use an alternate libmpiCC.a with mpiCC, use the -mpiCClib <LIBRARY> option. A 'default' g++ ABI compatible
library is provided for each architecture except Alpha.
Non-g++
ABI compatible C++ compilers |
 |
The C++ library provided by HP-MPI, libmpiCC.a, was built with g++.If you are using a C++ compiler
which is not g++ ABI compatible (e.g. Portland Group Compiler),
you must build your own libmpiCC.a and include this in your build command. The sources
and Makefiles to build an appropriate library are located in /opt/hpmpi/lib/ARCH/mpiCCsrc.
To build your private version of libmpiCC.a and include it in the builds using mpiCC, do the following:
 |
 |  |
 |
 | NOTE: This example assumes your
HP-MPI install directory is /opt/hpmpi. It also assumes that the pgCC compiler is in your path
and working properly. |
 |
 |  |
 |
Copy the file needed to build libmpiCC.a into a working location.
% setenv MPI_ROOT /opt/hpmpi
% cp -r $MPI_ROOT/lib/linux_amd64/mpiCCsrc ~
% cd ~/mpiCCsrc
Compile and create the
libmpiCC.a library.
% make CXX=pgCC MPI_ROOT=$MPI_ROOT
pgCC -c intercepts.cc -I/opt/hpmpi/include -DHPMP_BUILD_CXXBINDING PGCC-W-0155-Nova_start() seen (intercepts.cc:33)
PGCC/x86 Linux/x86-64 6.2-3: compilation completed with warnings pgCC -c mpicxx.cc - I/opt/hpmpi/include -DHPMP_BUILD_CXXBINDING ar rcs libmpiCC.a intercepts.o mpicxx.o
Using a testcase, test that
the library works as expected.
% mkdir test ; cd test
% cp $MPI_ROOT/help/sort.C .
% $MPI_ROOT/bin/mpiCC HPMPI_CC=pgCC sortC -mpiCClib \ ../libmpiCC.a
% $MPI_ROOT/bin/mpirun -np 2 ./a.out
Rank 0 -980 -980 . . . 965 965 |