Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Created February 4, 2020 06:11
Show Gist options
  • Save kaityo256/0ccb5f0218ff86827e635488ec020942 to your computer and use it in GitHub Desktop.
Save kaityo256/0ccb5f0218ff86827e635488ec020942 to your computer and use it in GitHub Desktop.
Intel Compiler vs. GCC
#include <random>
int main() {
std::mt19937 mt;
std::uniform_real_distribution<> ud(0.0, 1.0);
for (int j = 0; j <10000; j++) {
for (int i = 0; i < 10000; i++) {
if (i%2) ud(mt);
}
}
}
@kaityo256
Copy link
Author

Environment

  • CPU: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
  • OS: SUSE Linux Enterprise Server 11 (x86_64)
  • g++ (GCC) 5.4.0
  • icpc (ICC) 18.0.5 20180823
$ g++ -O3 -march=native -Wall -Wextra -std=c++11  main.cpp -o gcc.out
$ icpc -O3 -xHOST -Wall -Wextra -std=c++11  main.cpp -o icpc.out
$ time ./gcc.out
./gcc.out  0.25s user 0.00s system 96% cpu 0.265 total

$ time ./icpc.out
./icpc.out  4.56s user 0.00s system 99% cpu 4.572 total

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment