3.31.2011

gcc vs. LLVM vs. icc (GNU C comp. vs. LLVM vs. Intel C++ comp.)

Similar to my last post, I decided to try these three compilers on my pwtracker project. This was performed on the same exact system as that last post, a single-core 1.7 GHz Pentium M laptop. Here are the results:

Run times (in seconds):
gcc (-O3): 0.86, 1.62
llvm (-O3): 0.72, 1.34 (using gcc front-end)
icc (-fast): 0.28, 0.48

As you can see, Intel wins again with its blazing fast compilers. The speedups over gcc are 3.0 and 3.3, respectively. The speedups for LLVM over gcc are 1.19 and 1.21, respectively.

For anyone reading this, I would like some feedback on these numbers or maybe links to your own personal comparisons, so please comment away.

3.26.2011

gfortran vs. ifort (GNU Fortran vs. Intel Fortran Compiler)

Recently I was given the job of cleaning up and modifying a CFD code for my undergrad research project. I thought this would be the perfect opportunity to compare compilers. As you can see from the previous post, I'm interested in how fast open-source software is compared to commercial software.

I obviously can't post the code as it is property of OSU, but I can say that it is more scientifically oriented than anything else. That is to say that it is all number-crunching and nothing really computer-sciency. The code is nothing but simple mathematical operations, logical statements, and file I/O. Plus, it's FORTRAN...so it has to be simple.

Anyway, I put GNU Fortran 4.4 (gfortran) and Intel Fortran Composer XE 2011 (ifort) on an old laptop running 32-bit Linux. The laptop has a single-core Intel Pentium M processor running at 1.7 GHz. I ran each version a few times and measured the times using the time command.

Here are the results (using the standard -O2 setting):

gfortran: 5m56s = 356 seconds
ifort: 4m17s = 257 seconds

It's no surprise that Intel's compiler would produce faster code for an Intel processor. The speedup is 356/257 = 1.39x. This lines up with the figures shown on Intel's site: http://software.intel.com/en-us/articles/intel-composer-xe/.

Update 3/27/11: I retried with gfortran 4.5 and it shaved off 27 seconds (5m39s), resulting in a modified speedup of 1.32.

Update 3/31/11: I retried using the -O3 flag for gfortran and the -fast flag for ifort (highest optimization settings for each compiler), resulting in times of 5m16 and 4m9, respectively. This gives a speedup of 1.27.

Conclusion: It's safe to say that for Fortran, the Intel compiler is approximately 20-40% faster.