PDA

View Full Version : How to Install Intel Fortran Compiler 9.0 on Ubuntu


gappy
March 24th, 2006, 07:37 AM
Debian is entirely built out of open source software. It covers almost all the needs of beginning and advanced users. One application that is still missing from the OSS universe (for the time being) is a robust, efficient Fortran 90/95 compiler. gFortran is not nearly as mature as the old f77 compiler, and g95 is a one-man operation. However, the Intel Fortran Compiler is a viable alternative, and is free for noncommercial purposes (e.g., scientific research, recreational). Unfortunately the compiler comes in .rpms, and is only tested on SUSE and RedHat (the horror! the horror!), although it is known to work on Debian distros. For those interested in installing the IFC 9.0 on Ubuntu, below are some steps to take. My experience is limited to an installation on a AMD64 Machine running Kubuntu 5.10, but I am quite confident that the procedure is indepedent of the desktop environment and the Ubuntu version (at least for the near past and future). However, it depends quite a bit on the CPU. I gathered the information from a variety of sources, notably from the following page: http://www.theochem.uwa.edu.au/fortran/intel_on_debian, which offers guidance for previous versions the compiler as well. Among other things, I am reproducing the information contained in that page, in case it is removed from the web.

We consider Intel-based systems first.


0. Before we begin: register on Intel's web site. You will receive an email with a license file, and instructions on how to download a gzipped tar file. Download the file, and extract it with tar -xvf <filename>. Do not erase the email.

1. Convert the rpm package to deb format.

alien -k intel-ifort9-9.0-031.i386.rpm

2. save the script as make9


#!/bin/csh
#************************************************* ******************************
# Copyright Daniel Grimwood, 2004, 2005
# The sed scripts are Copyright Intel Corporation, 1999-2005.
# Feel free to distribute and hack up my parts.
#************************************************* ******************************
setenv DEBFILE $1

if ( { test -z $DEBFILE } ) then
echo "Error: require a filename as an argument"
exit 1
endif
if (! -e $DEBFILE) then
echo "Error: file $DEBFILE does not exist"
exit 1
endif

mkdir tmp
dpkg-deb -e $DEBFILE tmp/DEBIAN
dpkg-deb -x $DEBFILE tmp

if (! -e tmp/DEBIAN/postinst) then
cat << \"EOF > tmp/DEBIAN/postinst
#!/bin/sh
\"EOF
chmod 0755 tmp/DEBIAN/postinst
endif

if (`echo $DEBFILE | grep -q ifort && echo 1`) then
echo DESTINATION='/opt/intel/fc/9.0' >> tmp/DEBIAN/postinst
endif
if (`echo $DEBFILE | grep -q icc && echo 1`) then
echo DESTINATION='/opt/intel/cc/9.0' >> tmp/DEBIAN/postinst
endif
if (`echo $DEBFILE | grep -q idb && echo 1`) then
echo DESTINATION='/opt/intel/idb/9.0' >> tmp/DEBIAN/postinst
endif

cat << \"EOF >> tmp/DEBIAN/postinst
{
for FILE in $(find $DESTINATION/bin/ -regex '.*[ei](cc|fort|fc|cpc)$\|.*cfg$\|.*pcl$\|.*vars[^/]*.c?sh$' 2> /dev/null) ; do
sed s@\<INSTALLDIR\>@$DESTINATION@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find $DESTINATION/bin/ -regex '.*[ei]cc' 2> /dev/null) ; do
sed s@\<INSTALLDIR\>@$DESTINATION@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find $DESTINATION/bin/ -regex '.*[ei]cpc' 2> /dev/null) ; do
sed s@\<INSTALLDIR\>@$DESTINATION@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find $DESTINATION/bin/ -regex '.*[ei]fort' 2> /dev/null) ; do
sed s@\<INSTALLDIR\>@$DESTINATION@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find $DESTINATION/bin/ -regex '.*[ei]fc' 2> /dev/null) ; do
sed s@\<INSTALLDIR\>@$DESTINATION@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find $DESTINATION/bin/ -type f -iname 'iccec' 2> /dev/null) ; do
sed s@\<CCBIN\>@"$DESTINATION/bin"@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find "$DESTINATION/bin" -type f -iname 'iccec' 2> /dev/null) ; do
sed s@\<NON_ROOT_USER_HOME_FOLDER\>@"$DEFAULT_INSTALL_DIR_PREFIX"@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
sed s@NON_ROOT_INSTALLATION=\"\"@NON_ROOT_INSTALLATION=\"1\"@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done
}
\"EOF
dpkg-deb -b tmp $DEBFILE
rm -rf tmp

and run ./make9 intel-ifort9-9.0-031.i386.deb

3. run dpkg -i intel-ifort9-9.0-031.i386.deb

4. add the following snippet to the files /etc/profile and ~/.bashrc


# add Intel Compiler environment variables
#INSTALLDIR is /opt/intel/fce/9.0/
if [ -z "${PATH}" ]
then
PATH="/opt/intel/fce/9.0/bin"; export PATH
else
PATH="/opt/intel/fce/9.0/bin:$PATH"; export PATH
fi

if [ -z "${LD_LIBRARY_PATH}" ]
then
LD_LIBRARY_PATH="/opt/intel/fce/9.0/lib"; export LD_LIBRARY_PATH
else
LD_LIBRARY_PATH="/opt/intel/fce/9.0/lib:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH
fi

if [ -z "${MANPATH}" ]
then
MANPATH="/opt/intel/fce/9.0/man":$(manpath); export MANPATH
else
MANPATH="/opt/intel/fce/9.0/man:${MANPATH}"; export MANPATH
fi

if [ -z "${INTEL_LICENSE_FILE}" ]
then
INTEL_LICENSE_FILE="/opt/intel/fce/9.0/licenses:/opt/intel/licenses:${HOME}/intel/licenses"; export INTEL_LICENSE_FILE
else
INTEL_LICENSE_FILE="${INTEL_LICENSE_FILE}:/opt/intel/fce/9.0/licenses:/opt/intel/licenses:${HOME}/intel/licenses"; export INTEL_LICENSE_FILE
fi


notice that /opt/intel/fce/9.0 could differ for you machine, in which case you have to replace it with the correct IFC install directory.

5. copy the license file contained in the confirmation email you received to the directory /opt/intel/fce/9.0/licenses

And you are ready to go.

For AMD64-based machines, the procedure is slightly more involved:

0. Same as above. Also, make sure the ia32-libs package is installed (as of Breezy Badger, it is).

1. Extract the contents of the rpm. For the below package it puts them into the subdirectory intel-iforte9-9.0.

alien -gsk intel-iforte9-9.0-031.em64t.rpm

1a. Fix some broken directory access permissions from the above extraction. (This is because these parent directories are not listed separately in the rpm, so alien creates them but with root-only permissions).

chmod a+rx intel-iforte9-9.0/opt intel-iforte9-9.0/opt/intel intel-iforte9-9.0/opt/intel/fce intel-iforte9-9.0/opt/intel/fce/9.0

1b. edit intel-iforte9-9.0/debian/control, change the Architecture from em64t to amd64; namely the line

Architecture: amd64

1c. Build the package.

cd intel-iforte9-9.0
debian/rules binary

Ignore the libstdc++ dependency warnings. The package is now built and installable.

2. Run the make_deb_9e script to do the Intel post-installation modifications. This is different to the make_deb_9 script above only because Intel added an "e" to the directory names - icce, iforte, idbe.

#!/bin/csh
#************************************************* ******************************
# Copyright Daniel Grimwood, 2004-2006
# The sed scripts are Copyright Intel Corporation, 1999-2005.
# Feel free to distribute and hack up my parts.
#************************************************* ******************************
setenv DEBFILE $1

if ( { test -z $DEBFILE } ) then
echo "Error: require a filename as an argument"
exit 1
endif
if (! -e $DEBFILE) then
echo "Error: file $DEBFILE does not exist"
exit 1
endif

mkdir tmp
dpkg-deb -e $DEBFILE tmp/DEBIAN
dpkg-deb -x $DEBFILE tmp

if (! -e tmp/DEBIAN/postinst) then
cat << \"EOF > tmp/DEBIAN/postinst
#!/bin/sh
\"EOF
chmod 0755 tmp/DEBIAN/postinst
endif

if (`echo $DEBFILE | grep -q ifort && echo 1`) then
echo DESTINATION='/opt/intel/fce/9.0' >> tmp/DEBIAN/postinst
endif
if (`echo $DEBFILE | grep -q icce && echo 1`) then
echo DESTINATION='/opt/intel/cce/9.0' >> tmp/DEBIAN/postinst
endif
if (`echo $DEBFILE | grep -q idbe && echo 1`) then
echo DESTINATION='/opt/intel/idbe/9.0' >> tmp/DEBIAN/postinst
endif

cat << \"EOF >> tmp/DEBIAN/postinst
{
for FILE in $(find $DESTINATION/bin/ -regex '.*[ei](cc|fort|fc|cpc)$\|.*cfg$\|.*pcl$\|.*vars[^/]*.c?sh$' 2> /dev/null) ; do
sed s@\<INSTALLDIR\>@$DESTINATION@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find $DESTINATION/bin/ -regex '.*[ei]cc' 2> /dev/null) ; do
sed s@\<INSTALLDIR\>@$DESTINATION@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find $DESTINATION/bin/ -regex '.*[ei]cpc' 2> /dev/null) ; do
sed s@\<INSTALLDIR\>@$DESTINATION@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find $DESTINATION/bin/ -regex '.*[ei]fort' 2> /dev/null) ; do
sed s@\<INSTALLDIR\>@$DESTINATION@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find $DESTINATION/bin/ -regex '.*[ei]fc' 2> /dev/null) ; do
sed s@\<INSTALLDIR\>@$DESTINATION@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find $DESTINATION/bin/ -type f -iname 'iccec' 2> /dev/null) ; do
sed s@\<CCBIN\>@"$DESTINATION/bin"@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done

for FILE in $(find "$DESTINATION/bin" -type f -iname 'iccec' 2> /dev/null) ; do
sed s@\<NON_ROOT_USER_HOME_FOLDER\>@"$DEFAULT_INSTALL_DIR_PREFIX"@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
sed s@NON_ROOT_INSTALLATION=\"\"@NON_ROOT_INSTALLATION=\"1\"@g $FILE > ${FILE}.abs
mv ${FILE}.abs $FILE
chmod 755 $FILE
done
}
\"EOF
dpkg-deb -b tmp $DEBFILE
rm -rf tmp


Run

./make_deb_9e intel-iforte9_9.0-031_amd64.deb

3. Install the package.

dpkg -i intel-iforte9_9.0-031_amd64.deb

4. repeat step 4 as for x86 architecture

5. repeat step 4 as for x86 architecture

I hope this helps.

pestilence4hr
April 6th, 2006, 02:08 PM
You no longer have to go through this process of converting to debs, you can just use the installer that comes with the compiler. Instructions are found here: http://ubuntuforums.org/showthread.php?t=89571

Lightmywifire
April 6th, 2006, 04:17 PM
Anyone know how to make a makefile with the intel compiler?

pestilence4hr
April 10th, 2006, 11:57 PM
Anyone know how to make a makefile with the intel compiler?

There's nothing special about it...you do it the same way you would with gcc, just compile with icc instead (or ifort for fortran).

LudoG
February 6th, 2007, 03:30 PM
When I run ./make9, I obtain the following message:
bash: ./make9 : /bin/csh : bad interpretor
I'm a new user of ubuntu (and linux), could you help me?
Thanks.

mazzanti
February 8th, 2007, 03:51 AM
Just download csh from the repositories. I did that from synaptic and was fairly easy.
Now once you have csh working, the recipe for installing fortran compiler didn't work in my case.
I use Edgy (Ubuntu 6.10) and tried to install fortran 9.1 compiler (not 9.0 as stated in the post).
Once I ran make9 on the file, it complained about trying to tarr something with an empty file name.
Mayve it's that the tree structure of the installation package once untarred is different from the tree structure of the 9.0 release and then it does not work.... I don't know.
So far it's been impossible for me to install the fortran compiler on my ubuntu box. I've tried all the recipes I've found on these forums and none of them worked on my Edgy 64bits :confused:
Cheers,
Ferran.

OvelhaNegra
February 25th, 2007, 01:06 PM
Just download csh from the repositories. I did that from synaptic and was fairly easy.
Now once you have csh working, the recipe for installing fortran compiler didn't work in my case.
I use Edgy (Ubuntu 6.10) and tried to install fortran 9.1 compiler (not 9.0 as stated in the post).
Once I ran make9 on the file, it complained about trying to tarr something with an empty file name.
Mayve it's that the tree structure of the installation package once untarred is different from the tree structure of the 9.0 release and then it does not work.... I don't know.
So far it's been impossible for me to install the fortran compiler on my ubuntu box. I've tried all the recipes I've found on these forums and none of them worked on my Edgy 64bits :confused:
Cheers,
Ferran.

The interesting thing is that it works fine with Ubuntu 6.06, and a lot of people is having problems like yours... I am one of them! :(
My solution was to keep the Ubuntu 6.06 and intel fortran 9.* pair, working happily by now...

dgrimreaper
April 10th, 2007, 11:25 PM
Hi all,

there's a new (simplified) script available at http://www.nicdan.id.au/computers/compiling/intel_on_debian.html. No more csh dependence (uses bash now).

gappy it might pay to rewrite the first post, or keep it as-is for historical purposes.

Daniel.

rajarshihri
August 29th, 2007, 03:59 AM
HI,
I was installing ifort 10.0.023 using above mensioned method...I got following error while executing dpkg...
can u help me understanding it?

rajarshi@ff12:~/Desktop/l_fc_p_10.0.023_ia32> sudo dpkg -i intel-ifort100023_10.0.023-1_i386.deb
(Reading database ... 192034 files and directories currently installed.)
Preparing to replace intel-ifort100023 10.0.023-1 (using intel-ifort100023_10.0.023-1_i386.deb) ...
Unpacking replacement intel-ifort100023 ...
Setting up intel-ifort100023 (10.0.023-1) ...
/var/lib/dpkg/info/intel-ifort100023.postinst: 10: Syntax error: newline unexpected
dpkg: error processing intel-ifort100023 (--install):
subprocess post-installation script returned error exit status 2
Errors were encountered while processing:
intel-ifort100023


:confused: