CSI 702 Optimization Assignment - Fall 2008 - Prof. John Wallin, Assignments of Computer Science

An assignment for the csi 702 optimization course in fall 2008. Students are required to write short codes demonstrating various optimization techniques, including rearranging loop order, unrolling loops, eliminating branches in loops, and using sentinel values. The assignment also includes instructions for using profilers to measure performance improvements. An optional part offers extra credit for creating codes with different execution times for assigning unique integers to elements of a large two-dimensional array.

Typology: Assignments

Pre 2010

Uploaded on 02/10/2009

koofers-user-gs3
koofers-user-gs3 🇺🇸

5

(1)

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Optimization
CSI 702- Fall 2008 - Assignment 1 Due: Monday September 17
For this assignment, you will experiment with several of the code tuning techinques we covered
in class. You may write your codes in C, C++, or Fortran. The timing results should be done using
the profilers for the appropriate compiler. The final assignment will be turned in at the beginning of
class on Monday September 17. Electronic submissions will not be allowed for this assignment, and
there will be a penalty for late submission.
1. Create two very short codes to demonstrate each of the following optimization techinques-
Rearranging Loop order
Unrolling loops
Eliminating branches in loops
Sentinal values
Testing by the order of frequency
For each item above, compare the performance with and without the optmization for a simple
problem. You must write these programs yourself and NOT use someone else’s
code. If you use someone else’s code without attribution, this will be considered
plagurism and reported to the honor committee.
Use a profiler to examine the speed change between the two codes. To use the profiler, compile
the code using
gfortran -pg -o outputfile program.f90
./outputfile
gprof -l -b outputfile
OR if you use c/c++
gcc -pg -o outputfile program.f90
./outputfile
gprof -l -b outputfile
You should also compile the codes without the “-pg” option and use the timing command to
get real and user times.
For each optimization, summarize the results of the two options. Compare compilers, machines,
and other compilations flags IF time permits.
At the end of the assignment, you will turn in the following-
(a) A listing of versions of the codes you wrote
(b) A summary for each code of the timing tests. This should include information about the
machine you ran the tests on, the commands used to run the tests, and your conclusions
about the optmizations.
2. Optional 10% extra credit: Create two codes that assign a unique integer to each element of a
large two dimensional array. Both codes should be in the same language (C, C++, Fortran),
but the one should execute in the shortest possible time and the other should execute in the
longest possible time while still doing useful work. You can’t add functions that slow the code
without
1

Partial preview of the text

Download CSI 702 Optimization Assignment - Fall 2008 - Prof. John Wallin and more Assignments Computer Science in PDF only on Docsity!

Optimization

CSI 702- Fall 2008 - Assignment 1 Due: Monday September 17

For this assignment, you will experiment with several of the code tuning techinques we covered in class. You may write your codes in C, C++, or Fortran. The timing results should be done using the profilers for the appropriate compiler. The final assignment will be turned in at the beginning of class on Monday September 17. Electronic submissions will not be allowed for this assignment, and there will be a penalty for late submission.

  1. Create two very short codes to demonstrate each of the following optimization techinques-
    • Rearranging Loop order
    • Unrolling loops
    • Eliminating branches in loops
    • Sentinal values
    • Testing by the order of frequency

For each item above, compare the performance with and without the optmization for a simple problem. You must write these programs yourself and NOT use someone else’s code. If you use someone else’s code without attribution, this will be considered plagurism and reported to the honor committee. Use a profiler to examine the speed change between the two codes. To use the profiler, compile the code using

gfortran -pg -o outputfile program.f ./outputfile gprof -l -b outputfile

OR if you use c/c++

gcc -pg -o outputfile program.f ./outputfile gprof -l -b outputfile

You should also compile the codes without the “-pg” option and use the timing command to get real and user times. For each optimization, summarize the results of the two options. Compare compilers, machines, and other compilations flags IF time permits. At the end of the assignment, you will turn in the following-

(a) A listing of versions of the codes you wrote (b) A summary for each code of the timing tests. This should include information about the machine you ran the tests on, the commands used to run the tests, and your conclusions about the optmizations.

  1. Optional 10% extra credit: Create two codes that assign a unique integer to each element of a large two dimensional array. Both codes should be in the same language (C, C++, Fortran), but the one should execute in the shortest possible time and the other should execute in the longest possible time while still doing useful work. You can’t add functions that slow the code without