gcc on Opteron: 64bit-mode slower than 32bit-mode!!!?
I recently tried a 'numerical hello world' on our new Opteron-system but got somewhat confused when it turned out that the 32-bit mode ran twice as fast as the 64-bit mode!
The test-code was essentially: for (i=0; i<i_stop; i++) { for (j=0; j<j_stop; j++) sum+=sin(double(i))+cos(double(i)); } compile 64-bit g++ test.cpp -O2 compile 32-bit g++ test.cpp -O2 -m32 It does not matter if I add more optimization switches, the 32-bit version still runs on half the time... The system: Dual Opteron 244, 8GB Ram SuSE 9.0-64bit for AMD64, kernel 2.4.21-209-smp, gcc-3.3.1-23 Do anyone have a clue where the problem is? Hopefully Anders |
Hi duckie!
A pragmatic answer: use the -ffast-math compiler-option for better results. Maybe the sin-function is not optimized by default for 64-bit. Hope this helps some, bluie |
Thank you,
now I got the exspected performance :) Anders |
All times are GMT -5. The time now is 06:44 AM. |