Difference between revisions of "Intel C++"

From ArchWiki
Jump to navigation Jump to search
m (<pre> -> Bc)
(Using icc with makepkg)
(One intermediate revision by the same user not shown)
Line 7: Line 7:
 
{{Article summary wiki|Makepkg}}
 
{{Article summary wiki|Makepkg}}
 
{{Article summary end}}
 
{{Article summary end}}
 +
 +
==Before You Begin==
 +
{{Warning|Packages that have been compiled by icc will depend on the associated libs contained the '''intel-openmp''' package in order to run.  Since '''intel-openmp''' depends on '''intel-compiler-base''', users MUST have both packages installed at all times!}}
  
 
==Setup and Installation==
 
==Setup and Installation==
Line 22: Line 25:
  
 
==Using icc with makepkg==
 
==Using icc with makepkg==
 +
{{Warning| Not every package will successfully compile with icc without heavy modifications to the underlying source!}}
 +
 
There is currently no official guide to using icc with makepkg.  This section is meant to capture various methods suggested by users.  Please make a new sub-section with your suggested method titled as such.
 
There is currently no official guide to using icc with makepkg.  This section is meant to capture various methods suggested by users.  Please make a new sub-section with your suggested method titled as such.
  

Revision as of 13:33, 4 December 2011

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

Before You Begin

Warning: Packages that have been compiled by icc will depend on the associated libs contained the intel-openmp package in order to run. Since intel-openmp depends on intel-compiler-base, users MUST have both packages installed at all times!

Setup and Installation

intel-composer-compiler-suiteAUR is available in the AUR. To build the package, one needs a license file which is free for personal and for non-commercial use. The requisite license file is emailed to users upon [registration] and should be copied into the $startdir prior to running makepkg. The current PKGBUILD assembles 7 packages:

  • intel-compiler-base - Intel C/C++ compiler and base libs
  • intel-openmp - Intel OpenMP Library
  • intel-idb- Intel C/C++ debugger
  • intel-ipp - Intel Integrated Performance Primitives
  • intel-mkl - Intel Math Kernel Library (Intel® MKL)
  • intel-sourcechecker - Intel Source Checker
  • intel-tbb - Intel Threading Building Blocks (TBB)
Note: A minimal working environment requires the two bolded packages.

Using icc with makepkg

Warning: Not every package will successfully compile with icc without heavy modifications to the underlying source!

There is currently no official guide to using icc with makepkg. This section is meant to capture various methods suggested by users. Please make a new sub-section with your suggested method titled as such.

Method 1

Modify /etc/makepkg.conf inserting the following code under the existing line defining CXXFLAGS to enable makepkg to use icc. No special switches are needed when calling makepkg to build.

_CC=icc
if [ $_CC = "icc" ]; then
  export CFLAGS="-O3 -xHost"
  export CXXFLAGS="${CFLAGS}"
  export CC="icc"
  export CXX="icpc"
  export HOSTCC="icc"
fi
Note: To toggle between the native gcc and icc, simple comment or uncomment the newly created _CC variable.

icc CFLAGS

In general, icc supports many of the same CFLAGS gcc supports and is also pretty tolerant to gcc flags it cannot use. In most cases it will happily ignore the flag warning the user and moving on. For an exhaustive list and explanation of available compiler flags, consult the icc manpage or better yet by invoking the compiler with the help flag:

icc --help

-xX

Use to generate specialized code to run exclusively on processors supporting it. If unsure which option to use, simply inspect the flags section of /proc/cpuinfo. In the example below, SSE4.1 would be the correct selection:

$ cat /proc/cpuinfo  | grep -m 1 flags
flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush 
dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs 
bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr
pdcm sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
  • -xHost
  • -xSSE2
  • -xSSE3
  • -xSSSE3
  • -xSSE4.1
  • -xSSE4.2
  • -xAVX
  • -xCORE-AVX-I
  • -xSSSE3_ATOM
Tip: Use the -xHost flag if unsure what your specific processor supports.

-Ox

Same behavior as gcc. x is one of the following options:

  • 0 - disables optimizations
  • 1 - optimize for maximum speed, but disable some optimizations which increase code size for a small speed benefit
  • 2 - optimize for maximum speed (DEFAULT)
  • 3 - optimize for maximum speed and enable more aggressive optimizations that may not improve performance on some programs (recommended for math intensive looping programs)

-w

Similar to the gcc:

  • -w - disable all warnings (recommended for the package compilation)
  • -Wbrief - print brief one-line diagnostics
  • -Wall - enable all warnings
  • -Werror - force warnings to be reported as errors