sponsored

The Several Faces of Intel Compilers

istock 932795150
istock/BentlyChang

Intel compilers are extremely popular with performance-minded developers who compile C, C++, or Fortran for the x86 architecture (32 or 64 bit). The quest for top performance is the key attribute that users single out. If you ask for a second reason for using the compilers, the response is generally either “flexibility” (which I, tongue-in-cheek, will call “several faces”) or “standards compliance/enforcement.” These are both worth understanding, whether you use just the Intel compilers or the entire Intel® Parallel Studio XE or Intel® System Studio suites (which include the compilers).

Several Faces

I love the quip “We love standards, that’s why we have so many.” C and C++ seem to live by this saying. Enabling features selectively for various standards has become common among compilers these days. C options include c89, c99, and c11. C++ standard support includes c++11 (also accepts c++0x), c++14, and c++17. On Linux and MacOS systems, Intel adds gnu89, gnu98, gnu99, gnu++98, and gnu++0x options to conform to gcc’s support for the standards including their extensions. On Linux and macOS, the Intel compiler defaults to the gnu options rather than the strict standard.

This makes switching between the Intel and gnu compilers much easier – because the Intel compiler is willing to be flexible and behave like the gnu compiler to make switching back and forth easy. On Windows, the Intel compiler imitates the quirks of the Microsoft compiler for the same reason. As it turns out, every compiler has its quirks. You might say that the key quirk in the Intel compiler is its desire to “fit in” to whatever system it runs upon.

An Intel engineer once told me that they strive to be “bug for bug compatible” with other compilers by default. The engineer wasn’t referring to compilation bugs per se, but rather to standard interpretation. While the Intel marketing department is unlikely to tout this phrase in their materials, it’s compelling in a technical sense because it makes the compilers flexible enough to compile whatever other compilers will accept. This flexibility is very useful when you just want to see “if it will run faster” by using the Intel compiler. If we didn’t write standards-compliant code for the non-Intel compiler, we might prefer a warning rather than an error message in our quest for performance.

Standards

Flexibility is why the Intel compiler also offers an option for strict standards compliance on Linux and macOS (-strict-ansi). On Windows, warnings about compliance are still given (depending on warning levels), and they can individually be elevated to errors as desired.

Flexibility is nice, but so is standard compliance across all platforms. Intel offers us the choice of flexibility or compliance, while providing a cross-platform, highly optimizing compiler.

Performance

I mentioned performance as the primary reason users choose Intel compilers, so let me say a few words about it. Intel compilers have earned the reputation of being the compilers to beat if you’re compiling x86 code. Many software developers depend upon that.

A recent study by Colfax International looked at the performance of compiled code as well as compile time across a number of C++ compilers. The Intel compiler was #1 in performance and, unsurprisingly, it took somewhat longer to compile when optimizing heavily. Polyhedron, in the UK, has published benchmarks comparing Fortran compilers for many years. Intel’s Fortran compiler has long ranked high on this list. The Intel C, C++, and Fortran compilers share a common optimizer and code generator, so this consistent performance across all three languages is to be expected.

Several Faces Are Good

The flexible nature of Intel compilers makes them easy to adopt, and the performance makes them hard to give up. On the flip side, their flexibility means we can go back to another compiler easily. This is because we didn’t need to change our code away from gcc-style, xcode-style, or visual-studio-style coding. Of course, the ability to write strictly standards-conforming code means we might purposefully recode for the standards and enjoy being hooked on the Intel compilers.

In any case, Intel compilers are well worth a try.  I’ve provided links below for where to find more information, including the downloads to get the compilers for your own needs.

Useful links for more information

·        Intel® Parallel Studio XE (evaluation copies available – “Try & Buy”)

·        Intel® System Studio (evaluation copies available – “Try & Buy”)

·        Intel Compilers (evaluation copies available – “Try & Buy”)

·        Intel® C++ Compiler options for Standards (online documentation)

·        Intel® C++ Compiler options for Strict Standard Checking (online documentation)

·        A Performance-Based Comparison of C/C++ Compilers (published by Colfax International)

·        Performance comparisons of Fortran Compilers (published by Polyhedron Solutions)

·        Students, Educators and Open Source Developers – way to get tools free

Related: