CSCI 3366 (Introduction to Parallel and Distributed Processing), Spring 2005:
Installing and Using OpenMP on the Linux Lab Machines

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.

Installing Intel's Compiler

(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.

  1. cd to $HOME/TEMP and issue the command

    tar xzf l_cc_pu_8.1.024.tar.gz

    You should get a directory l_cc_pu_8.1.024.

  2. cd to $HOME/Programs and issue the commands

    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.

  3. Save the license you received from Intel into directory $HOME/Programs/intel_cc_80/licenses.

  4. cd to $HOME/TEMP/l_cc_pu_8.1.024 and issue the following commands:

    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:

  5. Test the installation by compiling and running a ``hello world'' program, and then delete the files in $HOME/TEMP. (Or you could move them somewhere else, if you want to install the compiler on your own machine also.)

Setting Up Your Account

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.

Compiling OpenMP programs

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.

Running OpenMP programs

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



Berna Massingill
2005-02-22