Using GCC on Xeon Phi

痞子三分冷 提交于 2021-01-27 18:55:33

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/18141941/using-gcc-on-xeon-phi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!