Software Archive
Read-only legacy content
17061 Discussions

Unable to compile the code for Xeonphi

Krishna_P_1
Beginner
725 Views
I wrote a MPI Program for running on Xeon phi in native mode. When I tried to compile the code, the following errors are coming. $mpicc test.c -o test -mmic /usr/bin/ld: skipping incompatible /opt/intel//impi/5.0.3.048/mic/lib/libmpifort.so when searching for -lmpifort /usr/bin/ld: skipping incompatible /opt/intel//impi/5.0.3.048/mic/lib/libmpifort.a when searching for -lmpifort /usr/bin/ld: cannot find -lmpifort collect2: ld returned 1 exit status Please help me out.
0 Kudos
2 Replies
Artem_R_Intel1
Employee
725 Views

Hi Krishna,

You can find some details about MPI application building in the Intel® MPI Library User's Guide for Linux* OS / chapter "Building an MPI Application". There's the information about building with Intel® Compiler with mpiicc script.

If you want to build the MPI application for Intel® Xeon Phi™ Coprocessor with GNU* Compiler you should specify the compiler. For example (all the commands are supposed to be run from the host side):

# Set the environment for Intel® MPI Library
(host) $ . <impi_install_dir>/intel64/bin/mpivars.sh
# Compile the host side binary (it's run on the host)
(host) $ mpicc -o test ./test.c
# Compile the binary for 
Intel® Xeon Phi™ Coprocessor
(host) $ 
export I_MPI_CC="/usr/linux-k1om-4.7/bin/x86_64-k1om-linux-gcc"
(host) $ mpicc -mmic -o test.mic ./test.c
# Test the compiled MPI application (it's supposed that test/test.mic binaries are in the same folder on the host and the coprocessor)
(host) $ export I_MPI_MIC=1
(host) $ export I_MPI_MIC_POSTFIX=.mic
(host) $ mpirun -ppn 1 -n 2 -hosts node,node-mic0 ./test

You can find the additional information about Intel® MPI Library usage and environment variables in the Intel® MPI Library Reference Manual for Linux* OS.
 

 

0 Kudos
TimP
Honored Contributor III
725 Views

Normally, the wrapper mpiicc (invoking Intel compiler) would be used, as gcc isn't well supported for the Mic knc target.

The quoted error message seems to indicate that backwards order of operands may have produced the failing combination of a host targeted object file with attempting Mic native linkage. -v option might add clarifying detail.

As there aren't Mic native g++  nor gfortran, the interesting advice Artem gave wouldn't work for c++ nor Fortran, giving even more perplexing error messages.

0 Kudos
Reply