Installing and using Intel Fortran and C++ Compilers
At present, the GrISU simulation package includes only shower code compiled under g77. Developed by Glenn Sembroski and Mary Kertzman, the latest Kascade shower code in the VERITAS cvs repository uses F90 and C++ and compiles under the Absoft Fortran compiler and g++. The Absoft compiler is a commercial package. However, Intel provides a free non-commercial license for both the Intel Fortran and the Intel C++/C compilers. These compilers can be used together to compile and link Kascade or the Intel Fortran compiler can be used with g++ for the compilation and linkage. This memo reviews downloading and installing the compilers and describes an example Makefile for Kascade with these compilers.
II. Download and Installation
The Intel Fortran compiler version 8.1 and the Intel C++/C
compiler version 8.1 is available at the Intel web site, www.intel.com/software/products/compilers. The download instructions are straightforward with non-commercial license files sent separately via email. The Fortran documentation includes user's guides, an optimization tutorial, and a Fortran reference document. The compilers are packaged in rpm files. Installations for Red-Hat Linux to the "/opt" default directory follow the usual rpm installation procedures. For non-Red-Hat installations and/or installations to non-default directories, the following instructions from Intel worked fine, at least for Debian Linux on my laptop (I'm including these in this memo since they are difficult to find on the Intel website).
(taken from www.intel.com/support/performancetools/fortran/linux/sb/cs-017157.htm.
The parenthetical comments are mine)
The Intel® compilers have installation requirements that some users would like to bypass. The technique covered in this FAQ provides workarounds for the following default constraints:
* The rpm utility must be used
* Root access must be available
* Multiple minor versions cannot be installed
To install the compilers on Linux* systems and bypass one or more of the above requirements, please use the unsupported method described below.
The following example steps demonstrate the installation of the ia-32 Fortran compiler version 8.1.022, without root privileges, into a user's home directory. The $HOME directory can be substituted by whatever you desire. The steps can be repeated for multiple compilers, and can be generalized to also apply to the C++ compiler, and compilers for the Itanium architecture.
1. Move the compiler tar archive into the desired directory ($HOME for this example) and create an "opt" subdirectory. (you should always install into an "opt" directory, e.g. I used "/home/duke/opt")
# <download l_fc_pc_8.1.022.tar.gz to $HOME>
$ cd $HOME
$ mkdir opt
2. Extract the compiler archive which is sitting in your current working directory (e.g."/home/duke" in my case)
$tar xzvf l_fc_pc_8.1.022.tar.gz
3. Using rpm2cpio, convert the compiler rpm files to cpio format.
$ rpm2cpio l_fc_pc_8.1.022/intel-ifort8-8.1-022.i386.rpm |cpio -i
4. Rename the default directory to something more specific if you would like to install multiple version 8 compilers. (first "cd opt")
$ mv intel_fc_80 intel_fc_8.1.022
5. Fixup all text files under the cpio'd compiler's bin directory by substituting each replacement string "<INSTALLDIR>" with the new actual path of your liking. (nb: run this script in the directory beneath "bin")
$ cd intel_fc_8.1.022
$ for i in $(file bin/* |grep text |cut -f1 -d:)
> mv $i $i.orig
> sed "s:<INSTALLDIR>:$(pwd):g" $i.orig >$i
$ cd bin
$ cat ifort # visually inspect paths
$ chmod +x ifort uninstall.sh
$ rm *.orig
6. Copy your license file to the licenses directory.
$ cd ..
$ cp path-to-mylicense.lic licenses/
7. Enable the compiler and give it a try.
$ cd $HOME/src
$ source $HOME/opt/intel_fc_8.1.022/bin/ifortvars.sh (see following comment)
$ ifort test.f
This applies to:
Intel® Fortran Compiler for Linux*
Solution ID: CS-017157
Date Created: 19-Nov-2004
Last Modified: 05-Jan-2005
Rather than "source" the ".sh" files as suggested above, I just included the path names in my ".bashrc" file with the following lines:
# setup intel fortran compiler
# setup intel c++ compiler
III. Makefile for Kascade
This version (4.0.0) of the GrISU simulation package will include the latest version of kascade.for with I/O adapted for the kascade.pilot input file and for piping output to cherenkf7.c. The new kascade.for has a recently improved multiscatter routine and it also includes choices for heavy nuclei up to iron. The GrISU makefiles will contain optimized versions of the compiled code; however, this document only gives unoptimized examples.
Note that you may need to remove an extra "tab" in a single line in kascade.for. Just watch for compiler error messages. You will still get several warning messages which you can ignore.
The Makefile in the GrISU/Simulation/Shower/Kascade uses the Intel Fortran compiler. You may use either the g++ compiler or the Intel C++ compiler by setting the appropriate variables in this Makefile.