Exercise 2: Installing Compilers on Linux Box
EXERCISE DESCRIPTION:
In this exercise you are supposed to work individually to install a FORTRAN and C compilers on the Linux machine you are assigned to. These compilers include gnu, PGI and INTEL suites. For all the three suites we will provide detailed information how to get them from official websites. However, just to avoid downloading from the net the same packages several times, we just placed what you need for each suite on our lab-server. See later for details.
EXERCISE GUIDE
1. log in as root
$ su -l passwd: xxxxxxx
2. make a scratch directory for the compilers
# mkdir -p /scratch/compilers # cd /scratch/compilers
Task 1: Check the gnu compiler version
Gnu project provides an excellent and well known suite of compilers for many different programming languages: GNU/gcc collection; recently a F95 compiler, gfortran, is also available http://gcc.gnu.org/wiki/GFortran. Gcc suite is generally bundled with many newer Linux distributions (like for instance Centos5.2 the one we are using here. We want here just to check if gcc and gfortran are in and which version we are working on.
Log in your user account and check the compiler version:
# su - username
$ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable- threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj- multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with- java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)
The Version should be 4.1.2.42
$ gfortran -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable- threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj- multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with- java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)
The Version should be 4.1.2.42
Task 2: Install Intel Compilers
Install Intel Fortran Compiler (ifort)
This compiler requires running an installation script and also requires a license. Note this compiler may be freely downloaded from the web and the license is given out when you download. For the purposes of the workshop you can get your own license (for personal use only, i.e. anything you do not get paid to do).
1. Log in again as root
2. Go to https://registrationcenter.intel.com/RegCenter/AutoGen.aspx?ProductID=1096&AccountID=&ProgramID=&RequestDt=&rm=NCOM&lang=, the official webpage of the Intel(R) Compiler Suite Professional Edition. Read and follow the instructions on the page to obtain the evaluation license valid for all the Intel software needed for the school.
The license will be mailed to the address you used to register on the Intel website and will be in the form of a file like this
NCOM_L_CMP__xxxx-xxxxxxxx.lic
Save it on your pc and take note of the location you are saving it in, you will need it soon.
For now we will share a common license file, which can be downloaded, together with the compiler, from
our local server using the rsync
command:
# cd /scratch/compilers # rsync -av root@192.168.15.202:/root/Intel intel
3. Unpack the tar archive for ifort installation files
# cd Intel/fortran/10.1.021 # tar -xzvf l_fc_p_10.1.021.tar.gz
4. Go to the installation directory
# cd l_fc_p_10.1.021
5. Install the rpm
utility, needed for the installation:
# apt-get install rpm
6. Start the installation script.
# ./install.sh
7. Select option 1 to install Fortran compiler
Please type a selection: 1 <ENTER>
8. Select option 2 and give the full path to the license file you downloaded before
Please type a selection: 2 <ENTER> License file path: /scratch/compilers/your license file name.lic <ENTER>
You will see following procedure:
Installation package for Intel(R) 64. Checking Dependencies ... Checking operating system requirements ................................ Unable to determine specific operating system / distribution Checking RPM version ... Checking Kernel and glibc dependencies ... Your platform : architecture = x86_64 kernel = 2.6.18-92 glibc = glibc-2.5-24 operating system = unknown This product is supported for use with the following combinations : Machine Type Kernel glibc Intel(R) 64 2.4.21 2.3.2 Intel(R) 64 2.6.x. 2.3.x Intel(R) 64 2.6.x. 2.4.x Intel(R) 64 2.6.x. 2.5.x Intel(R) 64 2.6.x. 2.6.x Would you like to perform an unsupported install of this product [yes/no] (no) ? :
9. Please type yes<ENTER>
10. Select option 1 to install all components
Please type a selection: 1 <ENTER>
11. Press enter to accept to read the license. <ENTER>
12. Go to the end of the licence file and accept the conditions.
accept <ENTER>
13. Press <ENTER> to accept the default installation directory which is in /opt
14. After "Installation successful" message press <ENTER>
15. Press <ENTER> to accept the default Debugger installation directory
16. After "Installation is complete" message press <ENTER>
17. Update the profile settings in order to include ifort's path in the shell's $PATH environment variable.
Edit your .bashrc file and add the line.
# source /opt/intel/fc/10.1.021/bin/ifortvars.sh
To changhe the shell to bash.
# chsh -s /bin/bash username
after reload your setings with
# source .bashrc
18. Log in your user account in order to be able to check if ifort is working
# su - username
19. Now check to make sure compiler is in your PATH
$ echo $PATH $ ifort --help
20. Go back to root and go out of the installation directory
$ exit # cd ..
Install Intel C/C++ Compiler (icc)
1. You should already be logged as root (from the previous task), if not, log in again as root
2. The license file you downloaded before works also with the Intel C/C++ Compiler
3. Unpack the tar archive for icc installation files
# cd Intel/c++/10.1.021 # tar -xzvf l_cc_p_10.1.021.tar.gz
4. Enter the installation directory
# cd l_cc_p_10.1.021
5. Start the installation script.
# ./install.sh
6. Select option 1 to install C++ compiler
Please type a selection: 1 <ENTER>
7. Select option 1 to let the installation use the same license file as before
Please type a selection: 1 <ENTER>
You will see following procedure:
Installation package for Intel(R) 64. Checking Dependencies ... Checking operating system requirements ................................ Unable to determine specific operating system / distribution Checking RPM version ... Checking Kernel and glibc dependencies ... Your platform : architecture = x86_64 kernel = 2.6.18-92 glibc = glibc-2.5-24 operating system = unknown This product is supported for use with the following combinations : Machine Type Kernel glibc Intel(R) 64 2.4.21 2.3.2 Intel(R) 64 2.6.x. 2.3.x Intel(R) 64 2.6.x. 2.4.x Intel(R) 64 2.6.x. 2.5.x Intel(R) 64 2.6.x. 2.6.x
9. Would you like to perform an unsupported install of this product [yes/no] (no) ? :
Please type a selection: yes <ENTER>
10. Select option 1 to install all components
Please type a selection: 1 <ENTER>
11. Press enter to accept to read the license. <ENTER>
12. Go to the end of the licence file and accept the conditions.
accept <ENTER>
13. Press <ENTER> to continue
14. Go to the end of the licence file and accept the conditions.
accept <ENTER>
15. Press <ENTER> to accept the default installation directory which is in /opt
16. After "Installation successful message" Press <ENTER> to continue
17. Press <ENTER> to accept the default Debugger installation directory
18. After "Installation is complete" message press <ENTER> to continue
19. Update the profile settings in order to include icc's path in the shell's $PATH environment variable.
Edit your .bashrc file and add the line.
# source /opt/intel/icc/10.1.021/bin/iccvars.sh
ensure that you have the correct shell.
# chsh -s /bin/bash username
after reload your setings with
# source .bashrc
20. Log in your user account in order to be able to check if icc is working
# su - username
21. Now check to make sure compiler is in your PATH
$ echo $PATH $ icc --help
22. Go back to root and go out of the installation directory
$ exit # cd ..
To learn more about Intel compilers check out: http://www3.intel.com/cd/software/products/asmo-na/eng/compilers/284132.htm
Optional Exercise: install g95 compiler
The g95 compiler comes as a precompiled binary file. Installation is trivial as it involves unpacking the tar file and moving the binary into the appropriate place. We will store all compilers in /opt which is a directory for optional software.
1. Log on to a shell prompt as root and use the wget command to download the g95 compiler from our lab server in the following way:'''
# cd /scratch/compilers # wget http://ftp.g95.org/g95-x86.deb
2. Install the package using Debian's dpkg
command:
# dpkg -i g95-x86.deb
3. Check if the compiler can be found
# which g95
should return:
/usr/bin/g95
4. Logout from root
# exit
5. Check if g95 is working
$ g95 --help
To learn more about G95, check out http://www.g95.org/
You now have installed several different compilers on your work station and are ready to do some scientific computing.