This is a short tutorial on how to use the Intel Fortran Compiler (IFC) 10 on Ubuntu 6.06 LTS. The compiler can be downloaded here. Click on free non-commercial download and following the steps, you will be sent an email with a download link, a serial number and a license key attached. Follow the link and download the .tar.gz file.
Note: The version I downloaded was l_fc_p_10.0.023.tar.gz. For most purposes this should be fine, but read the Installation Guide on the list of downloads to pick the one most suitable for you.
Note: Everything starting with
> means that the following code is to be entered in the command prompt.
Before you continue with the installation of IFC, install the following packages:
> sudo aptitude install rpm build-essential libstdc++5
aptitude with your package manager of choice
To continue with the installation, extract the compiler archive and excute the following command inside the newly created directory
> sudo ./install.sh
Follow the instructions given, do a default install Intel Fortran and enter the serial number (it is emailed to you). You may recieve a warning that your version of Linux is not supported, ignore this warning and contiune, everything should work fine.
Note: If the installation has trouble verifying the license key you can use the license key file sent to you in the email. Place this file in
/opt/intel/licenses (default install location) and when prompted, select the option to specify the location of the license key.
We are almost done. We need to run the following script before we can use the compiler.
> source /opt/intel/fc/10.0.023/bin/ifortvars.sh
(where 10.0.023 is your version number. /opt/intel/... is the default install location)IFC should be working now.
That script needs to be run each time you enter the terminal. To do this automatically, simply add the following lines to your .bashrc file (if you are using the bash shell)
The command to invoke your newly installed compiler is
sudo aptitude install rpm build-essential libstdc++5
If for some reason it does not work, and you have followed the directions, probably the first place to look is in the installation guide provided by Intel. This should be of some help.
If you have read through that and it doesn't provide the needed information, I have found the following guide (from which I followed, with a few modifications) very helpful. (it is for IFC version 9, but much of the process is the same)
The documentation that Intel provides is very good. If you are getting an error while compiling and you think you have an idea of what is wrong, search the documentation to see if you can fix it easily.
Using IFC in a makefile:
One of the first things to do is make sure that your makefile knows what the command is for your Fortran compiler, typcially there will be
FC= somewhere in the makefile.
FC=ifort and it should work.
Undefined reference error: One common error is, when trying to compile you recieve errors that look liked:
undefined reference to 'nf_close_'('nf_close_' will of course be different depending on what IFC couldn't find)
'nf_close_' is inside a certian library. The first thing to check that the compiler knows where to look for this library. This is indicated by the
-L tag (for example
-L/usr/include). If you still recieve the error after making sure the locations are correct, there are still other things to check
This particular case, it turned out that in the library file everything had two underscores after it (ie, 'nf_close__' instead of 'nf_close_'). It can be found in the documentation that adding
will tell the compiler to add another underscore when it looks inside the library.
Everything else: There are many different compiler options and ways things can go wrong, so many that it is pointless to try and list any of them here.
If you are having trouble, your best bet is to either search online, or check the documentation.Author: Jonathan Nehring. Updated: Thursday, 06-Mar-2008 14:00:19 PST. Valid CSS, HTML. This work is licensed under a Creative Commons Attribution-Noncommercial-ShareAlike 3.0 License.