hwkOptimizations

  < Previous  Next >

Due Date

See the calendar for due date. Do not use the UNIX command time (it will add in the time to allocate memory, etc.)

Description:

For this assignment, you will experiment with several of the code tuning techniques we covered in class. The timing results should be done using Fortran, the system clock and / or a profiler (not the Unix command time ).
  1. Create two very short programs or functions for four of the optimizations presented in lecture (8 programs / functions in total). Some of these optimizations include the following techniques:
    1. Rearranging loop order
    2. Unrolling loops
    3. Eliminating branches in loops
    4. Sentinel values
    5. Testing by the order of frequency
    6. Minimize page faults and cache misses
    7. Eliminate loops with low trip counts
    8. Better algorithms
    9. Stop testing when you know the answer
    10. Strengthen reduction
    11. Caching answers
    12. Eliminating / replacing system calls
    13. Pre-compute results
    14. Reduce the dimensions of arrays
    15. Minimize array references
    16. Exploit algebraic identities
    17. ...
    Two of the four, must correspond to a lecture number that you took notes for. For the other two, you can choose other techniques (except #1 which is covered in timing.f90). For each of the techniques, compare the performance with and without the optimization for a simple problem. Isolate the different optimizations so that the effects of each are distinguishable. 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 plagiarism which is an act of academic misconduct.
  2. Use a profiler to examine the change in execution time between the two codes. To use the profiler, compile the code using
    gfortran -p -g program.f90 -o executable
    ./executable
    gprof -l -b executable
    NOTE: Generally, you would not use both -g and -O3 compiler flags at the same time. Aside from the profiling, don't use a program compiled with -g for timing results.
  3. For each optimization, summarize the results of the two options.
  4. Time the execution for the original and optimized codes with and without compiler optimization flags (e.g., -O3). Report the timings.
    In summary, you should report something like the following:
    Technique Original Hand-optimized Original w/ -O3 Hand-optimized w/ -O3
    technique1        
    technique2        
    technique3        
    technique4        
  5. Turn in the codes and a report with at least the following:
    1. Which techniques you choose
    2. The timing for each code (labeled if it was the original or improved version and whether or not a compiler optimization flag was used
    3. Information about the machine(s) you ran the tests on and the commands used
    4. Conclusions about the optimizations
    Note: You must have non-zero timing results!
Please submit your codes and the report into the appropriate folder in the dropbox for COMS 6100 at https://elearn.mtsu.edu.

Rubric:

Points      Item
----------  --------------------------------------------------------------
_____ / 32  Programs (eight of them)
            Report
_____ /  0  + Techniques listed
_____ / 10  + Timing
_____ /  2  + Computer Specifications
_____ /  6  + Conclusions

_____ / 50  Total

_____  Approximate number of hours spent
      

Submission

Compress your program(s) and report with either tar or zip and submit your compressed file into the appropriate folder in the dropbox for COMS 6100 at https://elearn.mtsu.edu. To make a tarball, do something like the following:
tar -czf hwkOptimizations-USER.tar.gz  hwkOptimizations-USER/*.pl
To use zip, do something like the following:
zip -r hwkOptimizations-USER.zip  hwkOptimizations-USER/*.pl