Saturday, January 29, 2005

Compiler and Language Parity

The only real way to test how well a program, compiler, language, or computer hardware performs for your given task is to test it yourself on something you'd like to run.

I made a simple program that represents what my programs typcially entail, mainly large arrays of data and many computations. I wrote the program in both FORTRAN and C and compiled each version with the free GNU compiler and the free Intel Linux compiler. The run time results are below:
Compiler/Time (sec)
g77 / 37
gcc / 37
ifort / 9
icc / 9
ifort -tune=pn4 /8
icc -march=pentium4 /8

Clearly the Intel compiler was superior on my Prescott 3.4Ghz system even without optimizations. I was surprised that for each analgous compiler, the FORTRAN and C matched each other exactly. I still prefer FORTRAN for its ability to handle large arrays though I do like I/O in C better.

As a follow up to the Apples to Oranges post I did a while ago, I also ran this code with gcc on my iBook and it took 200 seconds. If you divide that 200 seconds by the 37 seconds for the gcc run on the Mattern PC, you get a ratio of 5.4. This is exactly the ratio I got for the computation portions of the benchmark tool in Matlab R14. It is good my programs correlate very well with Matlab. Thus I can look at the Matlab benchmarks for any system I might buy in the future and know it will likely be similar for my programs.


Post a Comment

<< Home