| Optimization Topics Exercise |
Make sure that you are logged into your assigned SP node with your assigned userid for this exercise. Ask the instructor if you have any questions.
The $WORKSHOP variable defines the root location for the workshop files, and may vary from workshop to workshop. Find out if this has already been setup for your workshop:
echo $WORKSHOP
If this environment variable is not set, check with the instructor for the correct location. Then, depending upon your shell, set $WORKSHOP:
| csh/tcsh | setenv WORKSHOP instructor/specified/path |
|---|
In your SP home directory, create a subdirectory for the Optimization Topics test codes and cd to it.
mkdir ~/optimization
cd ~/optimization
Then, copy the exercise files to your optimization subdirectory:
| C: | cp $WORKSHOP/optimization/samples/C/* ~/optimization |
You should notice a number of files, depending on whether you copied the C, Fortran or both versions. The complete set is shown in the table below.
| C Files | Fortran Files | Description
|
arit01.c
|
arit01.f
| Strength reduction: Horner's rule
|
|
arit02.f
| Right shift replacement for integer division by a power
of 2
|
|
arit03.f
| Factorization
|
|
arit04.f
| Common Subexpression Elimination
|
|
arit05.f
| Real*16 vs. Real*8
|
arraypad.c
|
arraypad.f
| Array padding
|
|
iotest.f
| I/O
|
loop01.c
|
loop01.f
| Loop fusion
|
loop02.c
|
loop02.f
| Loop fusion
|
loop03.c
|
loop03.f
| Loop interchange
|
loop05.c
|
loop05.f
| Invarient IF code floating
|
loop06.c
|
| Invarient IF code floating
|
loop08.c
|
loop08.f
| Loop Defactorizing
|
loop10.c
|
loop10.f
| Loop collapse
|
loop11.c
|
loop11.f
| Loop unrolling
|
loop12.c
|
| Loop unrolling and sum reductions
|
loop13.c
|
loop13.f
| Outer loop unrolling
|
mem01.c
|
mem01.f
| Stride effects
|
opt01.c
|
| Small errors: non-associative floating point operations
|
opt02.c
|
| Large errors: Catastrophic cancellation
| |
|---|
Select any/all of the sample codes. After reviewing the optimization technique being used, compile each of your selected codes. Use the xlf and xlc compiler as appropriate, for your compilations.
Run your executables and compare your results against those shown in the Optimization Tutorial.
If you have an application or program of your own, and time permits, try employing any of the optimization techniques with it. The instructor is available for assistance should you decide to do this.
This concludes the Optimization Topics lab exercise.