Exercise 4: Optimize some simple codes

EXERCISE DESCRIPTION:

In this exercise you will apply optimization techniques and/or compiler flags presented in lecture on small chunks of code and measure the gain/loss in performance of each of them. There are several small examples you can play with using different compilers and different options.

NOTE

Although it should not affect the results very much, it is always a good idea when measuring performances and running times to make sure that the CPU is running at maximum speed (by keeping any power-save feature disabled).

In order to do that, run the following commands (as root):

# cpufreq-selector -g performance

EXERCISE GUIDE

All the small programs can be downloaded from svn repository server:

$ svn checkout --username anonsvn https://www.qe-forge.it/svn/hpc-2008/trunk/week1/exercise4/ 

password: anonsvn

$ cd exercise4

$ ls
blocked.f90   loop_interchange2.f90  loop_interchange.f90  unrolling.f90
improved.f90  loop_interchange.c     to_be_improved.f90

You may also use democritos web server with wget command:

$ wget http://nexus/hpc/exercises/week1/exercise4.tgz
$ tar -xvzf exercise4.tgz
$ cd exercise4

Here below you can find all the information how to use these programs

  1. loop interchange
  2. unroll techniques
  3. a small program that could be improved
  4. tiling algorithm (optional for eklund)