Questions tagged [icc]

ICC is Intel's C++ compiler, actually a group of C/C++ compilers that are available for Windows, Linux, and MacOS. This tag should be for questions about using ICC, and you should consider including the [C++] and possibly an Operating System specific tag as well.

The Intel C++ Compiler (ICC) compiles code for 64-bit applications for Windows, Linux, and MacOS. 32-bit applications are only supported on MacOS prior to compiler version 19.0. It can be used with Microsoft Visual Studio (on Windows), Eclipse/CDE (on Linux), or XCode (on MacOS).

The generated code is optimized to run specifically on Intel CPUs. This can sometimes be non-optimal on CPUs from other companies.

Intel's ICC documentation.

743 questions
305
votes
3 answers

Why does NaN - NaN == 0.0 with the Intel C++ Compiler?

It is well-known that NaNs propagate in arithmetic, but I couldn't find any demonstrations, so I wrote a small test: #include #include int main(int argc, char* argv[]) { float qNaN = std::numeric_limits::quiet_NaN(); …
geometrian
  • 14,775
  • 10
  • 56
  • 132
65
votes
2 answers

Performance difference between Windows and Linux using Intel compiler: looking at the assembly

I am running a program on both Windows and Linux (x86-64). It has been compiled with the same compiler (Intel Parallel Studio XE 2017) with the same options, and the Windows version is 3 times faster than the Linux one. The culprit is a call to…
InsideLoop
  • 6,063
  • 2
  • 28
  • 55
46
votes
1 answer

Why does Intel's compiler prefer NEG+ADD over SUB?

In examining the output of various compilers for a variety of code snippets, I've noticed that Intel's C compiler (ICC) has a strong tendency to prefer emitting a pair of NEG+ADD instructions where other compilers would use a single SUB…
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
40
votes
4 answers

Why vectorizing the loop over 64-bit elements does not have performance improvement over large buffers?

I am investigating the effect of vectorization on the performance of the program. In this regard, I have written following code: #include #include #include #define LEN 10000000 int main(){ struct timeval…
Pouya
  • 1,871
  • 3
  • 20
  • 25
32
votes
8 answers

Benchmarks for Intel C++ compiler and GCC

I have an AMD Opteron server running CentOS 5. I want to have a compiler for a fairly large C++ Boost based program. Which compiler I should choose?
James Bond
  • 7,533
  • 19
  • 50
  • 64
31
votes
1 answer

Crash with icc: can the compiler invent writes where none existed in the abstract machine?

Consider the following simple program: #include #include #include void replace(char *str, size_t len) { for (size_t i = 0; i < len; i++) { if (str[i] == '/') { str[i] = '_'; } …
BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
26
votes
1 answer

GCC optimizes fixed range-based for loop as if it had longer, variable length

I have an array of POD structs and am trying to sum across one field. Here's a minimal example: struct Item { int x = 0; int y = 0; }; typedef Item Items[2]; struct ItemArray { Items items; int sum_x1() const; int sum_x2()…
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
26
votes
1 answer

Why is malloc 7x slower than new for Intel's icc?

I benchmarked malloc vs. new for allocating an array of floats. My understanding was that the operations performed by malloc are a subset of the operations performed by new -- that malloc just allocates but new allocates and constructs, although I'm…
Praxeolitic
  • 22,455
  • 16
  • 75
  • 126
24
votes
2 answers

How can I see which compilation options are enabled on Intel ICC compiler?

Is there an equivalent of the following g++ command on icc/icpc intel compiler ? ?> g++ -march=native -m32 ... -Q --help=target Which gave me the following output: The following options are target specific: -m128bit-long-double …
Axel Borja
  • 3,718
  • 7
  • 36
  • 50
23
votes
1 answer

Risks of different GCC versions at link / run time?

I'm using Intel's C++ compiler, which on Linux relies on the GNU-supplied libc.so and libstdc++.so. Here's my problem. To have access to some of the newest C++11 features, I need to use the libstdc++ which ships with GCC 4.7 or higher. But I'm…
Christian Convey
  • 1,202
  • 11
  • 19
22
votes
5 answers

Pass lambda expression to lambda argument c++11

I would like to do something like this: int main() { auto f = [/*some variables*/](/*take lambda function*/) {/*something with lambda function*/}; f([/*other variables*/](/*variables to be decided by f()*/) {/*something with…
Couchy
  • 753
  • 1
  • 5
  • 25
22
votes
4 answers

Simplest TBB example

Can someone give me a TBB example how to: set the maximum count of active threads. execute tasks that are independent from each others and presented in the form of class, not static functions.
Nelson Tatius
  • 7,693
  • 8
  • 47
  • 70
21
votes
3 answers

Using std::map should be deterministic or not?

I'm facing a strange behaviour using Intel C++ compiler 2019 update 5. When I fill a std::map it seems to lead to a non deterministic (?) result. The stl is from VS2019 16.1.6 in which ICC is embedded. I am on Windows 10.0.17134.286. My…
dom_beau
  • 2,437
  • 3
  • 30
  • 59
19
votes
5 answers

Detect ICC vs GCC at compile time

How to detect at compile time if I'm using gcc or icc? (I was quite puzzled to find out that icc defines __GNUC__ -- and even __GNUC_MINOR__ and __GNUC_PATCHLEVEL__ ! why?)
Znorg
  • 681
  • 1
  • 7
  • 19
19
votes
1 answer

Running Haskell on Xeon-Phi

Is there a way to compile Haskell to run on the Xeon Phi coprocessor? Some researchers at Intel have recently reported on the Haskell Research Compiler (that is not publicly available, which makes their results essentially irreproducible) and…
jev
  • 2,023
  • 1
  • 17
  • 26
1
2 3
49 50