- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've been using intel c++ compiler from long ago.
I tested below code tocheck compiler performance than microsoft visual c++.
=====================================================================
int num_steps = 1000000000;
int _tmain(int argc, _TCHAR* argv[])
{
int i;
double x, step, sum;
DWORD start_time, end_time;
x = sum = 0.0;
step = 1.0 / (double)num_steps;
start_time = timeGetTime();
for(i = 0; i < num_steps; i++)
{
x = (i + 0.5) * step;
sum += 4.0 / (1.0 + x * x);
}
end_time = timeGetTime();
printf("PI = %.8f (Elapsed Time = %d)\\n", step * sum, end_time - start_time);
return 0;
}
the result is that elpsed time is 16, 562ms and microsoft visual c++ is 6910ms.
why this problem happend?
i saw that intel c++ compiler much faster than microsoft compiler in some case.
thanks a lot.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For Intel 32-bit compilers prior to 11.0, you would require the option /QxW to engage optimization for such code. The best you could do with 32-bit MSVC would be /arch:SSE2 /fp:fast .
If you want optimization with default options on ia32, it's time to upgrade.
Also, it would be helpful if you would provide source code which can be compiled and tested. I'm not making much progress guessing what you have omitted. Although I might be able to make a similar C program, do we know whether it will reflect your intentions?
With minimum changes I can think of to turn it into working C code:
cl:
PI = 3.14159265 (Elapsed Time = 14656)
icl:
PI = 3.14159265 (Elapsed Time = 7312)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please provide a test case that can help recreate the issue with the compiler version you're testing with? Also, I agree with Tim, an upgrade would make sense. In addition, if you can give more details on all of the options you've used, the arch details etc., that would be helpful too...
-regards,
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just a friendly reminder on providing the test case you may have with the options you used to compile. The recreation of the same with the sample snippet you have wasn't successful (forgot to mention that in my earlier post). Appreciate if you can do attach the code - or you can create a private thread and attach too if you want it that way?
-thanks,
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, just a friendly reminder. Could you please attach the reproducer if you can? Appreciate much.
-regards,
Kittur
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page