gccintel-micxeon-phi

Using GCC on Xeon Phi


I was told one can run a program on MIC that was built with gcc.

Is that true?

If yes, how to proceed?

I'm using gcc version 4.4.7.


Solution

  • Intel Xeon Phi can indeed run programs that are compiled with the gcc cross compiler. However gcc is not suitable for compiling any applications for the coprocessor, since gcc does "not include support for Knights Corner vector instructions and related optimization improvements. GCC for Knights Corner is really only for building the kernel and related tools; it is not for building applications.", according to Intel.

    The problem you have with the gsl library is caused because the library was not cross-compiled for the Intel Xeon Phi, instead was compiled and configured for the host machine. In order to get gsl (or any other library) working on the Intel Xeon Phi, you have to cross compile it for the coprocessor and provide the necessary paths to the compiler and the linker when you compile a program that requires that library:

    gcc hellophi.c -L/path/to/cross/compiled/glslib -lgsl
    

    When using icc, you can transfer the cross compiled library to the coprocessor through the TCP/IP stack (e.g. using scp) and let icc do the environment variable and path handling.