Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Override gcc with icc/ifort when building source code

lianqing
Beginner
727 Views
I use Linux, on which gcc is installed by default. But I prefer Intel compilers (icc, icpc, ifort) and installed them. When I write my own code, I can specify CC/CFLAGS etc. to use Intel stuff. However, when I build third-party source code using the configure/make/make install method, gcc is selected as the default compiler. So how can I specify Intel compilers instead of gcc to build source code? Can you please give me a complete list of environment variables to define before building the code? What are the optimization flags for Intel Core2 and i7 processor? Thanks in advance.
0 Kudos
2 Replies
TimP
Honored Contributor III
727 Views
If a source code distribution is set up properly, it should have option variables to specify compilers other than gcc, like CC, CXX, FC, F90, as well as the option variables such as you mentioned. Those would be set prior to or in the configure step, or there may be special options to the configure command, like --with-fc etc. If not, you may have to edit the Makefile.
It's also possible to set the default options you want in the .cfg files in the Intel compiler installations, such as:
-fp-model source -ansi-alias (icc.cfg/icpc.cfg compatibility with gcc/g++)
-prec-div -prec-sqrt -assume protect_parens,buffered_io,byterecl,minus0 (ifort.cfg)
How could we make a complete list? You know which applications you are targeting and have access to their configure and Makefile scripts.
For 11.0 compilers on Core 2 I usually use -xSSE3 (-msse3 for AMD or gcc compatibility), for Core i7 -xSSE4.1 (-msse4 for gcc compatibility), but you'll never get unanimity on that.
0 Kudos
lianqing
Beginner
727 Views
Quoting - tim18
If a source code distribution is set up properly, it should have option variables to specify compilers other than gcc, like CC, CXX, FC, F90, as well as the option variables such as you mentioned. Those would be set prior to or in the configure step, or there may be special options to the configure command, like --with-fc etc. If not, you may have to edit the Makefile.
It's also possible to set the default options you want in the .cfg files in the Intel compiler installations, such as:
-fp-model source -ansi-alias (icc.cfg/icpc.cfg compatibility with gcc/g++)
-prec-div -prec-sqrt -assume protect_parens,buffered_io,byterecl,minus0 (ifort.cfg)
How could we make a complete list? You know which applications you are targeting and have access to their configure and Makefile scripts.
For 11.0 compilers on Core 2 I usually use -xSSE3 (-msse3 for AMD or gcc compatibility), for Core i7 -xSSE4.1 (-msse4 for gcc compatibility), but you'll never get unanimity on that.


Thanks for your reply, tim18.
From my Linux experience, nearly all the applications that use GNU autoconf to build the code choose gcc by default. There might be no such option as '--with-fc' for configure. So the only way to use non-gcc compilers (e.g. icc, visual age c) is to define environment variables CC, CXX, F77.

0 Kudos
Reply