As mentioned in class, there are (to the best of my knowledge) no free OpenMP compilers, but Intel has a C++ compiler for Linux that supports OpenMP and is free for noncommercial use. To comply with the terms of the license, each user must download and install his or her own copy. Directions for doing so appear below. If you install the compiler in your home directory (on Sol), you should be able to use it on any of the department Linux machines. The most interesting ones for this purpose are probably the Dwarf machines (Dwarf1 through Dwarf7), which have two processors each, and SnowWhite, which has four processors.
(This is somewhat involved, but it's the simplest procedure I could come up with that allows each user to install his/her own copy, which appears to be necessary to comply with Intel's license restrictions.) The first step is to obtain a copy of the compiler and a license. Go to http://www.intel.com/software/products/compilers/clin/noncom.htm and follow the directions for downloading the compiler and obtaining a license. The compiler comes packaged as a gzipped tar file (l_cc_pu_8.1.024.tar.gz), which you should put somewhere in your home directory. The license will be sent to you by e-mail. Once you have the license, proceed as follows. In the following, I'll assume that you have put the tar file in $HOME/TEMP and plan to install the compiler in $HOME/Programs, where $HOME is your home directory on Sol. Make the appropriate substitutions if you want to use other directories.
tar xzf l_cc_pu_8.1.024.tar.gz
You should get a directory l_cc_pu_8.1.024.
rpm2cpio $HOME/TEMP/l_cc_pu_8.1.024/intel-icc8-8.1-023.i386.rpm | cpio -ivd
mv opt/intel_cc_80 .
rmdir opt
You should now have a directory intel_cc_80 with subdirectories bin, etc.
cp /users/bmassing/Local/HTML-Documents/local-only/CS3366_2005spring/install-blm.sh .
chmod u+x install-blm.sh
./install-blm.sh
The last command runs a modified version of Intel's installation script. As this script runs, it will ask you some questions:
Before running the compiler and/or the compiled programs, you need to set some environment variables, which you can do with a script that comes with the compiler. Because this script sets environment variables, it must be ``sourced'' rather than being executed. Use the command
source $HOME/Programs/intel_cc_80/bin/iccvars.sh
or for csh users
source $HOME/Programs/intel_cc_80/bin/iccvars.csh
You could put this line in your .bash_profile file in your home directory (or the csh equivalent) to avoid having to type it every time you log in.
Use the command icc to compile C programs with OpenMP extensions. Typical usage:
icc -openmp -o foo foo.c
See the sample programs page for a Makefile.
To execute the compiled program, just type the name of the executable. Recall from class that you can temporarily set an environment variable for a program on the command line. Example usages:
foo
foo arg1 arg2
OMP_NUM_THREADS=10 foo