Skip to content

Instantly share code, notes, and snippets.

@nanoant
Created June 29, 2012 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nanoant/3019369 to your computer and use it in GitHub Desktop.
Save nanoant/3019369 to your computer and use it in GitHub Desktop.
Parallels for Mac 7 having problem with ICC AVX optimized code
/*
Now let's try compile and benchmark it:
$ icc -v
icc version 13.0.0 (gcc version 4.6.0 compatibility)
Let's try without AVX set (just up to SSE4.2):
$ icc -march=corei7 test.c -lm && time ./a.out
r=171828183.102
real 0m1.031s
user 0m1.024s
sys 0m0.004s
Now let's try with AVX... ooops exp is 7x slower!
$ icc -march=corei7-avx test.c -lm && time ./a.out
r=171828183.102
real 0m7.019s
user 0m7.012s
sys 0m0.000s
Now let's try with older Intel compiler, so we are sure it isn't new:
$ /opt/intel/composer_xe_2011_sp1/bin/icc -v
icc version 12.1.3 (gcc version 4.6.0 compatibility)
$ /opt/intel/composer_xe_2011_sp1/bin/icc -march=corei7 test.c -lm && time ./a.out
r=171828183.102
real 0m1.050s
user 0m1.048s
sys 0m0.000s
$ /opt/intel/composer_xe_2011_sp1/bin/icc -march=corei7-avx test.c -lm && time ./a.out
r=171828183.102
real 0m7.067s
user 0m7.064s
sys 0m0.000s
*/
#include <math.h>
#include <stdio.h>
int main (int argc, char const *argv[])
{
double c;
double r = 1.0;
for(c = 0.0; c < 1.0; c += 0.00000001) {
r += exp(c);
}
printf("r=%.12g\n", r);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment