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

Error when linking with Intel MPI -- C++ Binding problem?

jackyjngwn
Beginner
793 Views

Hi,

I was trying to compile a c++ program using Intel compiler and Intel MPI 3.2. The compilation was successful, but during linking, I got the following error message:

: undefined reference to `MPI::INTEGER'

Is this a c++ binding problem, but isn't MPI 3.2 supposed to support C++ binding automatically? Could someone help me? Thanks!

Jacky

0 Kudos
5 Replies
Gergana_S_Intel
Employee
793 Views

Hi, Jacky

Thanks for posting.

Quoting - jackyjngwn

Is this a c++ binding problem, but isn't MPI 3.2 supposed to support C++ binding automatically?


Certainly, the Intel MPI Library 3.2 supports theC++ bindings by default.

It'll be interesting to know how you're doing your compilation. Could you provide your command line & flags?

In general, we recommend you use one of the provided compiler drivers for the Intel MPI Library: such as mpigxx for the GNU* C++ compiler, or mpiicpc for the Intel C++ Compiler. Is that what you're doing?

More info on usage and so forth is available from the Intel MPI Library Reference Manual located in the /doc directory, or online here.

Regards,
~Gergana

0 Kudos
jackyjngwn
Beginner
793 Views

Hi, Jacky

Thanks for posting.


Certainly, the Intel MPI Library 3.2 supports theC++ bindings by default.

It'll be interesting to know how you're doing your compilation. Could you provide your command line & flags?

In general, we recommend you use one of the provided compiler drivers for the Intel MPI Library: such as mpigxx for the GNU* C++ compiler, or mpiicpc for the Intel C++ Compiler. Is that what you're doing?

More info on usage and so forth is available from the Intel MPI Library Reference Manual located in the /doc directory, or online here.

Regards,
~Gergana


I am not using mpiicpc, but icpc to compile and link.

The command options include -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_NO_SI_RECURSION -D_USING_MPI -DMPICH_IGNORE_CXX_SEEK -DHAVE_FORTRAN_BINDING

The libraries are: -L $(MPI_ROOT)/lib64 -lmpi -lmpichcxx -lpmpich -lrt -ldl -lmpiic4 -lmpiif -lmpigi -lpthread

Thanks.
0 Kudos
Gergana_S_Intel
Employee
793 Views

Thanks, Jacky.

Are you including the correct header files when compiling? For example, this is what I would use to compile/link a simple Hello World C++ program:

icpc test.cpp -o testcpp -I/opt/intel/impi/3.2.1.009/include64 -L/opt/intel/impi/3.2.1.009/lib64 -lmpiic4 -lmpi -lmpiif -lmpigi -lrt -lpthread -ldl

Can you also make sure that MPI_ROOT is defined correctly in your environment? By default, if you source one of the mpivars.sh files in /bin64, the I_MPI_ROOT env variable would be defined for you to use.

Finally, it seems like you're actually linking with some of the MPICH-specific libraries; is this for a particular reason? (By the way, there's no -lpmpich library, perhaps you mean -lmpich).

Regards,
~Gergana

0 Kudos
jackyjngwn
Beginner
793 Views

Thanks, Jacky.

Are you including the correct header files when compiling? For example, this is what I would use to compile/link a simple Hello World C++ program:

icpc test.cpp -o testcpp -I/opt/intel/impi/3.2.1.009/include64 -L/opt/intel/impi/3.2.1.009/lib64 -lmpiic4 -lmpi -lmpiif -lmpigi -lrt -lpthread -ldl

Can you also make sure that MPI_ROOT is defined correctly in your environment? By default, if you source one of the mpivars.sh files in /bin64, the I_MPI_ROOT env variable would be defined for you to use.

Finally, it seems like you're actually linking with some of the MPICH-specific libraries; is this for a particular reason? (By the way, there's no -lpmpich library, perhaps you mean -lmpich).

Regards,
~Gergana


Yeah, right, I meant -lmpich and mispelled it.

I did make sure that all my paths are set correctly, and I did include correct header files when compiling. I could link successfully if I replace "MPI::INTEGER" with "MPI_INT", but I wonder why I could not get it work with "MPI::INTEGER".

This makefile used to use gcc and MPICH, and maybe that's why it seems that I am using MPICH specific libraries. Do you have any suggestions on what libraries I should use? Thanks.
0 Kudos
Gergana_S_Intel
Employee
793 Views

Jacky,

Would you be willing to send me your Makefile and/or the code you're trying to compile? It might be easier for me to try it locally. My e-mail address is in the signature below. Just replace the "_at_" with "@". Thanks!

Regards,
~Gergana

0 Kudos
Reply