OK, let's get take care of this right up front:
Warning: This page discusses the installation of free-as-in-beer, but not free-as-in-speech, software. If you want to keep such software off your system, then don't install this compiler. Also note that the license is pretty restrictive, i.e. Non-commercial means you are not getting compensated in any form for the products and services you develop using these Intel® Software Development Products.
However, the installation process should work for the commercial version of this compiler.
I first learned to program in Fortran. I still have my original WATFOR/WATFIV textbook, though I later graduated to Fortran 77 and occasionally write some Fortran 90. I still do a lot of things in Fortran 77, just because I'm comfortable writing code starting in column 7.
Now there is an open-source Fortran 77/90/95 compiler, gfortran. It's reasonably fast, portable, nice — did I mention free? But it has a few quirks. For example, one of my old codes has a subroutine second which measures elapsed time. gfortran assumes that I'm calling the intrinsic function second, and bombs the compile because I don't have a proper calling statement. So I have to go in and declare
external second
in every subroutine that calls my second.
But Intel makes its Linux Fortran compiler free-as-in-beer for non-commercial
development. And the 64-bit version of the code includes Intel's optimized Math Kernel Library (MKL). It's a fairly simple registration, and you don't sign over much of your soul. However, in Ubuntu it's a fairly difficult installation. What's more, it changes every time you install a new version of the compiler.
The installation steps for the current compiler and Ubuntu are straightforward, but there's a lot of fine print, and the 64 bit version has a couple of quirks in the install. So let's go over it step by step. Note that I'm only referring to the 64-bit install in all of this. If you're running in 32-bit mode, your mileage will vary.
- Register. It's easy. You'll get a link to the download page an a serial number. Save the email, you'll need it.
- Download the appropriate tar file. I used the Genuine Intel® 64 bit version. There's another one called IA64, but I didn't try that.
-
Now set up your machine to compile code. Run:
sudo apt-get install build-essential gcc g++ rpm ia32-libs
and either
sudo apt-get install sun-java6-jre
which requires you to accept Sun's Java license, or
sudo apt-get install openjdk-6-jre-headless. -
Now you need a package called libstdc++5 which isn't included in Ubuntu. Worse, if you're on a 64 bit machine, you need to install the 32-bit version as well. So click on these
the 64-bit code, libstdc++5_3.3.6-18_amd64.deb and the 32-bit code, libstdc++5_3.3.6-18_i386.deb
-
Install the 64-bit version:
$ sudo dpkg -i libstdc++5_3.3.6-18_amd64.deb -
DO NOT INSTALL THE 32-BIT VERSION. Instead:
$ dpkg --extract libstdc++5_3.3.6-18_i386.deb ./ $ cd usr/lib $ sudo -i # cp libstdc++.so.5.0.7 /usr/lib32 # cd /usr/lib32 # ln -s libstdc++.so.5.0.7 libstdc++.so.5 # exit
-
Now we can do the install. Go back and find your Fortran tarball
$ tar xvzf l_cprof_p_11.1.072_intel64.tgz $ cd l_cprof_p_11.1.072_intel64 $ sudo -i # ./install.sh
-
Take all the defaults, and enter your registration number when asked. Note that you'll get some error statements to the effect that you're running this on an unsupported system (Ubuntu) and the option
1. Skip missing optional pre-requisites [default]
take that. - Your compiler is now installed in /opt/intel/Compiler/11.1/072/ (the last number will vary), but you're not quite finished.
- If you use the bash shell, add the line
source /opt/intel/Compiler/11.1/072/bin/ifortvars.sh intel64
to your ~/.bashrc file. - If you use the tcsh shell, add the line
source /opt/intel/Compiler/11.1/072/bin/ifortvars.csh intel64 to your ~/.cshrc file. - Now you're done. Look at man ifort to see how to use the thing.
My preliminary test indicates that the Intel compiler is about 10% faster than gfortran for a fairly CPU intensive calculation, without the MKL. Not all that much faster, really. If you're not doing a lot of serious computations, installing the Intel compiler might not be worth the trouble.