visual-studio 英特尔 C++ 编译器作为微软的替代品?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1982178/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Intel C++ compiler as an alternative to Microsoft's?
提问by ROAR
Is anyone here using the Intel C++ compiler instead of Microsoft's Visual c++ compiler?
这里有人使用英特尔 C++ 编译器而不是微软的 Visual c++ 编译器吗?
I would be very interested to hear your experience about integration, performance and build times.
我很想听听您在集成、性能和构建时间方面的经验。
采纳答案by Tommy Andersen
The Intel compiler is one of the most advanced C++ compiler available, it has a number of advantages over for instance the Microsoft Visual C++ compiler, and one major drawback. The advantages include:
英特尔编译器是最先进的 C++ 编译器之一,与 Microsoft Visual C++ 编译器相比,它具有许多优点,但有一个主要缺点。优点包括:
Very good SIMD support, as far as I've been able to find out, it is the compiler that has the best support for SIMD instructions.
Supports both automatic parallelization (multi core optimzations), as well as manual (through OpenMP), and does both very well.
Support CPU dispatching, this is really important, since it allows the compiler to target the processor for optimized instructions when the program runs. As far as I can tell this is the only C++ compiler available that does this, unless G++ has introduced this in their yet.
It is often shipped with optimized libraries, such as math and image libraries.
非常好的 SIMD 支持,据我所知,它是对 SIMD 指令支持最好的编译器。
支持自动并行化(多核优化)和手动并行化(通过 OpenMP),并且两者都做得很好。
支持 CPU 调度,这一点非常重要,因为它允许编译器在程序运行时针对处理器优化指令。据我所知,这是唯一可以执行此操作的 C++ 编译器,除非 G++ 已在其中引入此功能。
它通常带有优化的库,例如数学和图像库。
However it has one major drawback, the dispatcher as mentioned above, only works on Intel CPU's, this means that advanced optimizations will be left out on AMD cpu's. There is a workaround for this, but it is still a major problem with the compiler.
然而,它有一个主要缺点,即上面提到的调度程序,仅适用于 Intel CPU,这意味着高级优化将被排除在 AMD CPU 上。对此有一个解决方法,但它仍然是编译器的一个主要问题。
To work around the dispatcher problem, it is possible to replace the dispatcher code produced with a version working on AMD processors, one can for instance use Agner Fog'sasmlib librarywhich replaces the compiler generated dispatcher function. Much more information about the dispatching problem, and more detailed technical explanations of some of the topics can be found in the Optimizing software in C++paper - also from Anger (which is really worth reading).
要解决调度程序问题,可以使用在 AMD 处理器上运行的版本替换生成的调度程序代码,例如可以使用Agner Fog 的asmlib 库替换编译器生成的调度程序函数。关于调度问题的更多信息,以及一些主题的更详细的技术解释可以在优化软件 C++论文中找到 - 也来自 Anger(这真的很值得一读)。
On a personal note I have used the Intel c++ Compiler with Visual Studio 2005 where it worked flawlessly, I didn't experience any problems with microsoft specific language extensions, it seemed to understand those I used, but perhaps the ones mentioned by John Knoellerwere different from the ones I had in my projects.
就个人而言,我在 Visual Studio 2005 中使用了英特尔 c++ 编译器,在那里它可以完美运行,我没有遇到任何微软特定语言扩展的问题,它似乎理解我使用的那些,但也许John Knoeller提到的那些是与我在项目中使用的不同。
While I like the Intel compiler, I'm currently working with the microsoft C++ compiler, simply because of the financial extra investment the Intel compiler requires. I would only use the Intel compiler as an alternative to Microsofts or the GNU compiler, if performance were critical to my project and I had a the financial part in order ;)
虽然我喜欢 Intel 编译器,但我目前正在使用 microsoft C++ 编译器,这仅仅是因为 Intel 编译器需要额外的财务投资。如果性能对我的项目至关重要并且我有财务部分,我只会使用英特尔编译器作为 Microsoft 或 GNU 编译器的替代品;)
回答by Nikola Smiljani?
I've had only one experience with this compiler, compiling STLPort. It took MSVC around 5 minutes to compile it and ICC was compiling for more than an hour. It seems that their template compilation is very slow. Other than this I've heard only good things about it.
我只有一次使用此编译器的经验,即编译 STLPort。MSVC 花了大约 5 分钟来编译它,而 ICC 编译了一个多小时。看来他们的模板编译很慢。除此之外,我只听说过关于它的好消息。
Here's something interesting:
这里有一些有趣的事情:
Intel's compiler can produce different versions of pieces of code, with each version being optimised for a specific processor and/or instruction set (SSE2, SSE3, etc.). The system detects which CPU it's running on and chooses the optimal code path accordingly; the CPU dispatcher, as it's called.
"However, the Intel CPU dispatcher does not only check which instruction set is supported by the CPU, it also checks the vendor ID string," Fog details, "If the vendor string says 'GenuineIntel' then it uses the optimal code path. If the CPU is not from Intel then, in most cases, it will run the slowest possible version of the code, even if the CPU is fully compatible with a better version."
英特尔的编译器可以生成不同版本的代码段,每个版本都针对特定的处理器和/或指令集(SSE2、SSE3 等)进行了优化。系统会检测它在哪个 CPU 上运行,并相应地选择最佳代码路径;所谓的 CPU 调度程序。
“然而,英特尔 CPU 调度程序不仅会检查 CPU 支持哪个指令集,还会检查供应商 ID 字符串,”Fog 详细说明,“如果供应商字符串显示 'GenuineIntel',则它使用最佳代码路径。如果CPU 不是来自 Intel,那么在大多数情况下,它会运行最慢的代码版本,即使 CPU 与更好的版本完全兼容。”
OSnews article here
OSnews 文章在这里
回答by Cristian Adam
I'm not using Intel C++ compiler at work / personal (I wish I would).
我没有在工作/个人中使用英特尔 C++ 编译器(我希望我会)。
I would use it because it has:
我会使用它,因为它具有:
Excellent inline assembler support. Intel C++ supports both Intel and AT&T (GCC) assembler syntaxes, for x86 and x64 platforms. Visual C++ can handle only Intel assembly syntax and only for x86.
Support for SSE3, SSSE3, and SSE4 instruction sets. Visual C++ has support for SSE and SSE2.
Is based on EDG C++, which has a completeISO/IEC 14882:2003 standard implementation. That means you can use / learn every C++ feature.
出色的内联汇编器支持。英特尔 C++ 支持英特尔和 AT&T (GCC) 汇编器语法,适用于 x86 和 x64 平台。Visual C++ 只能处理 Intel 程序集语法且仅适用于 x86。
支持 SSE3、SSSE3 和 SSE4 指令集。Visual C++ 支持 SSE 和 SSE2。
基于EDG C++,它具有完整的ISO/IEC 14882:2003 标准实现。这意味着您可以使用/学习每个 C++ 功能。
回答by Drew Hoskins
Anecdotally, I've found that the Intel compiler crashes more frequently than Visual C++. Its diagnostics are a bit more thorough and clearly written than VC's. Thus, it's possible that the compiler will give diagnostics that weren't given with VC, or will crash where VC didn't, making your conversion more expensive.
有趣的是,我发现英特尔编译器比 Visual C++ 更频繁地崩溃。它的诊断比 VC 的更彻底和更清晰。因此,编译器可能会提供 VC 没有提供的诊断信息,或者会在 VC 没有提供的地方崩溃,从而使您的转换成本更高。
However, I do believe that Intel's compiler allows you to link with Microsoft runtimes like the CRT, easing the transition cost.
但是,我确实相信英特尔的编译器允许您与 CRT 等 Microsoft 运行时链接,从而降低转换成本。
If you are interoperating with managed code you should probably stick with Microsoft's compiler.
如果您要与托管代码进行互操作,您可能应该坚持使用 Microsoft 的编译器。
Recent Intel compilers achieve significantly better performance on floating-point heavy benchmarks, and are similar to Visual C++ on integer heavy benchmarks. However, it varies dramatically based on the program and whether or not you are using link-time code generation or profile-guided optimization. If performance is critical for you, you'll need to benchmark your application before making a choice. I'd only say that if you are doing scientific computing, it's probably worth the time to investigate.
最近的英特尔编译器在浮点重度基准测试中取得了明显更好的性能,并且在整数重度基准测试中与 Visual C++ 类似。但是,它会因程序以及您是否使用链接时代码生成或配置文件引导优化而有很大差异。如果性能对您很重要,那么您需要在做出选择之前对应用程序进行基准测试。我只想说,如果您从事科学计算,那么花时间进行调查可能是值得的。
Intel allows you a month-long free trial of its compiler, so you can try these things out for yourself.
英特尔允许您对其编译器进行为期一个月的免费试用,因此您可以亲自尝试这些东西。
回答by JesperE
I tried using Intel C++ at my previous job. IIRC, it did indeed generate more efficient code at the expense of compilation time. We didn't put it to production use though, for reasons I can't remember.
我在之前的工作中尝试使用英特尔 C++。IIRC,它确实以编译时间为代价生成了更高效的代码。我们没有将它投入生产使用,原因我记不清了。
One important difference compared to MSVC is that the Intel compiler supports C99.
与 MSVC 相比的一个重要区别是英特尔编译器支持 C99。
回答by Dmitri Nesteruk
I've been using the Intel C++ compiler since the first Release of Intel Parallel Studio, and so far I haven't felt the temptation to go back. Here's an outline of dis/advantages as well as (some obvious) observations.
从英特尔 Parallel Studio 的第一个版本开始,我就一直在使用英特尔 C++ 编译器,到目前为止我还没有回到过去的诱惑。这是缺点/优点的概述以及(一些明显的)观察结果。
Advantages
好处
- Parallelization (vectorization, OpenMP, SSE) is unmatched in other compilers.
- Toolset is simply awesome. I'm talking about the profiling, of course.
- Inclusion of optimized libraries such as Threading Building Blocks (okay, so Microsoft replicated TBB with PPL), Math Kernel Library (standard routines, and some implementations have MPI (!!!) support), Integrated Performance Primitives, etc. What's great also is that these libraries are constantly evolving.
- 并行化(矢量化、OpenMP、SSE)在其他编译器中是无与伦比的。
- 工具集简直太棒了。当然,我说的是分析。
- 包含优化的库,例如线程构建块(好吧,所以 Microsoft 使用 PPL 复制了 TBB)、数学内核库(标准例程,并且某些实现具有 MPI (!!!) 支持)、集成性能基元等。还有什么很棒的这些库在不断发展。
Disadvantages
缺点
- Speed-up is Intel-only. Well duh! It doesn't worry me, however, because on the server side all I have to do is choose Intel machines. I have no problem with that, some people might.
- You can't really do OSS or anything like that on this, because the project file format is different. Yes, you can have both VS and IPS file formats, but that's just weird. You'll get lost in synchronising project options whenever you make a change. Intel's compiler has twice the number of options, by the way.
- The compiler is a lot more finicky. It is far too easy to set incompatible project settings that will give you a cryptic compilation error instead of a nice meaningful explanation.
- It costs additional money on top of Visual Studio.
- 加速仅适用于英特尔。嗯嗯!然而,我并不担心,因为在服务器端,我所要做的就是选择 Intel 机器。我没有问题,有些人可能会。
- 你不能真正做 OSS 或类似的事情,因为项目文件格式不同。是的,您可以同时拥有 VS 和 IPS 文件格式,但这很奇怪。每当您进行更改时,您都会迷失在同步项目选项中。顺便说一下,英特尔的编译器的选项数量是原来的两倍。
- 编译器要挑剔得多。设置不兼容的项目设置太容易了,这会给你一个神秘的编译错误而不是一个很好的有意义的解释。
- 它需要在 Visual Studio 之上额外花钱。
Neutrals
中性
- I think that the performance argument is not a strong one anymore, because plenty of libraries such as Thrust or Microsoft AMP let you use GPGPU which will outgun your cpu anyway.
- I recommend anyone interested to get a trial and try out some code, including the libraries. (And yes, the libraries are nice, but C-style interfaces can drive you insane.)
- 我认为性能论点不再是一个强有力的论点,因为诸如 Thrust 或 Microsoft AMP 之类的大量库让您使用 GPGPU,无论如何它都会超过您的 CPU 。
- 我建议任何有兴趣的人进行试用并尝试一些代码,包括库。(是的,这些库很不错,但是 C 风格的接口会让你发疯。)
回答by Hamish Grubijan
Intel C++ Compiler has AMAZING (human) support. Talking to Microsoft can literally take days. My non-trivial issue was solved through chat in under 10 minutes (including membership verification time).
英特尔 C++ 编译器具有惊人的(人工)支持。与 Microsoft 交谈可能需要数天时间。通过聊天在 10 分钟内(包括会员验证时间)解决了我的重要问题。
EDIT:I have talked to Microsoft about problems in their products such as Office 2007, even got a bug reported. While I eventually succeeded, the overall size and complexity of their products and organization hierarchy is daunting.
编辑:我已经与 Microsoft 讨论过他们产品(如 Office 2007)中的问题,甚至报告了一个错误。虽然我最终成功了,但他们产品和组织层次结构的整体规模和复杂性令人生畏。
回答by John Knoeller
The last time the company I work for compared the two was about a year ago, (maybe 2). The Intel compiler generated faster code, usually only a bit faster, but in some cases quite a bit.
我工作的公司上一次比较这两者是大约一年前(可能是 2 年)。英特尔编译器生成更快的代码,通常只是快一点,但在某些情况下会快很多。
But it couldn't handle some of the MS language extensions that we depended on, so we ended up sticking with MS. It was VS 2005 that we were comparing it to. And I'm wracking my brain to remember exactly what MS extension the Intel compiler couldn't handle. I'll come back and edit this post if I can remember.
但是它无法处理我们依赖的一些 MS 语言扩展,所以我们最终坚持使用 MS。我们将它与 VS 2005 进行比较。我正在绞尽脑汁想清楚英特尔编译器无法处理的 MS 扩展。如果我能记得,我会回来编辑这篇文章。

