- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm new to working with Xeon Phi.
I'm trying to build a certain library written in C , with Intel C compiler on Linux (CentOS),
and I intend to run it on the Phi.
The thing is, I usually build this library with 'configure' and 'make' commands
and with gcc, and now I have to build it with Intel C and with MIC support.
Now , I realize that the -mmic flag is available when compiling directly with icpc/ifort ,
but when I run 'configure' for my library :
"./configure --with-cc=icc ... "
I don't know where to add the "-mmic" flag, so that the library will be built for running on Phi.
Please let me know what you think,
Thanks
Chen
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Add -mmic to the CFLAGS (or similar) environment option or
./configure --with-cc='icc -mmic'
Library build options may need attention:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I usually have success with
[bash]
./configure CC=icc CXX=icpc CFLAGS="-mmic" CXXFLAGS="-mmic" --host=x86_64
[/bash]
The CC/CXX and CFLAGS/CXXFLAGS handle both C and C++ codes, and "--host=x86_64" indicates cross-compilation. Indicating cross-compilation is a trick: in fact, you are compiling for the MIC architecture and not for x86_64, but "--host=..." tells the configure script not to panic when the executable produced by the compiler cannot be run on the host.
The link that Tim has sent talks about using "xiar -qoffload-build" instead of "ar" for linking a static library. This is necessary for static libraries with offload. I believe that for native (i.e., non-offload) and dynamic libraries this is not necessary: you can link using the compiler or probably even with "ld".
If the library has dependencies, you need to compile and install them first, and then, typically, use "-with-OTHERLIBRARY=/path/to/other/library"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you've upgraded to MPSS 3.2 or later, you might consider this approach:
. /opt/mpss/3.2/environment-setup-k1om-mpss-linux gnu-configize # to update config.sub ./configure $CONFIGURE_FLAGS --prefix=/usr --libdir=/usr/lib64 \ LDFLAGS='' LD=k1om-mpss-linux-ld CPPFLAGS='' \ CC=icc CFLAGS='-mmic' CXX=icpc CXXFLAGS='-mmic'
The main difference is the --host=k1om-mpss-linux argument which referencing $CONFIGURE_FLAGS adds instead.
Using the GCC port to compile something can be done similarly:
. /opt/mpss/3.2/environment-setup-k1om-mpss-linux gnu-configize # to update config.sub ./configure $CONFIGURE_FLAGS --prefix=/usr --libdir=/usr/lib64
...although, of course, using GCC is generally ill-advised, since the port for Xeon Phi is unsophisticated and generates poor quality object code relative to ICC.
You may find this other thread interesting: https://software.intel.com/en-us/forums/topic/509026#comment-1785910

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page