# Exercise 1: Vectorization

Implement a vectorized FORTRAN program for the "All Pairs Shortest Paths" problem on the Convex C3440 (convex.edvz.uni-linz.ac.at):
1. You can find a FORTRAN solution to this problem on the Convex as `~risc/path/path.f`. Use this source code as the basis of your own work. You may change the problem size (N, L) to an appropriate value.
2. Compile the program in optimized scalar mode (`-O1`) and measure the runtime of the program (man time). Compare this value with the runtimes of all following variants of the program.
3. Compile the program in vector mode (`-O2`) and analyze the generated compilation information. What does it say? To which extent has the program been vectorized and why? Which transformations has the compiler applied and why? Please answer these questions also for all following program variants.
4. Reformulate the procedure `square` such that the compiler is able to vectorize the loop in a better way (hint: get rid of the auxiliary variable) and analyze the changes.
5. Reformulate the procedure `square` by replacing the intrinsic function `MIN` by an `IF` statement and analyze the changes.
6. Reformulate the procedure `square` by applying the function SMIN (man smin) of VECLIB (man veclib) and analyze the changes. Do not forget to link this library to your program using the option `-lveclib`.
The result of this exercise is a small paper that describes your program modifications (include the code for each variant of the procedure `square`), the messages generated by the compiler (redirect it into a file), your interpretations of these messages, the program timings, and your conclusions. If you have any ideas how to improve the program, go on!

You can print a file from the Convex on the central line printer of the university using lpr on the default printer. Use ftp to transfer files from/to the Convex.

If there are major problems, drop me an email.

Have fun!

You can tell how far we have to go, when FORTRAN is the language of supercomputers. - Steven Feiner

Real programmers don't write in FORTRAN. FORTRAN is for pipe stress freaks and crystallography weenies. FORTRAN is for wimp engineers who wear white socks.

Maintained by: Wolfgang Schreiner
Last Modification: March 7, 1997

[Up] [RISC-Linz] [University] [Search]