HELLO
The Hello World Program, OpenMP version


HELLO is a simple program that says "Hello", but also demonstrates a few simple things about OpenMP programs, including

To use the program, you will also need to figure out the appropriate compiler switches to use, and how to set the enviroment variable OMP_NUM_THREADS to the number of threads you want.

Assignment:

Take this program to the machine you are studying. Compile it with the appropriate compiler switch.

If you are actually running on a multiprocessor machine, you may notice that the output does not always come out in a nice order. It can be somewhat scrambled. The output from a particular thread will be ordered, but output from different threads can be interleaved in somewhat arbitrary ways - this is similar to the way that the program instructions, when carried out by multiple threads, can be interleaved in ways you would not imagine.

Source Code:

To run the HELLO program, you first need to copy one of these source code files, compile it using the appropriate compiler switches, and be sure to name the executable hello.

Batch Script:

Once you have made a hello executable, you need to copy this script file to the same directory that contains the executable, and issue the command qsub hello.sh. That submits a request to have the executable program run on 4 processors. You can type showq to see if the request has started yet.


You can go up one level to the HPPC 2008 web page.

Last revised on 29 July 2008.