Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
2167 Discussions

Mixed C++/Fortran MPI + OpenMp and ILP64

New Contributor I
I am writing a mixed c++/Fortran code that uses MPI, OpenMP, and 64 bit integers. I am having trouble determining which libraries to link.

1. The getting started guide says to

"Add impi.lib and impicxx.lib (Release) or impid.lib and impicxxd.lib (Debug) to your target link command for C++ applications. Link application with impimt.lib (Release) impidmt.lib (Debug) for multithreading."

It is not clear whether 'impimt.lib' replaces 'impi.lib' and/or 'impicxx.lib'. I am guessing that impimt.lib replaces impi.lib but not impicxx.lib. I am not sure though.

2. Concering ILP64, the reference manual states the following without mentioning which libraries are used.
Use the Fortran* compiler driver option -i8 for separate compilation and the ilp64 option for separate linkage. For example,
> mpiifort i8 c test.f
> mpiifort ilp64 o test test.o

Use the mpiexec ilp64 option to preload the ILP64 interface. For example,
> mpiexec ilp64 n 2 .\\myprog

There is currently no support for C and C++ applications.

I am linking libraries explicitly, so I am unsure which one to use. When I look in the MPI lib directory, I see a file 'libmpi_ilp64.lib', which I guess is the correct library to use. Do I use this file instead of 'impi.lib' or 'impimt.lib'? Note that I only call MPIInit and MPIFinalize from the c++ code, so I think the comment about not ILP64 support for C is not a problem.

Is this the right set of libraries for my problem? libmpi_ilp64.lib impicxx.lib

0 Kudos
1 Reply
Hi John,

impimt.lib is just a multi-treaded version of the impi.lib and you need to use MT version in case of openMP. Really mpiifort driver will use MT version instead of impi.lib if you use '-openmp' option.

impicxx.lib contains additional functions needed for C++.

>There is currently no support for C and C++ applications.
That's true. We could potentially provide support for C, but for C++ - no.

> I only call MPIInit and MPIFinalize from the c++ code
You can use 'call MPI_INIT' from fortran programs. Or might be you don't use any other MPI calls at all? In this case this is not an MPI application.

0 Kudos