Activity 2, Does the Compiler/Language/Programmer Matter.
Short Description:
In a group, perform the following activities related to a matrix multiplication program..
Goals
When you finish this homework, you should have:- Understood the importance of the compiler in determining the CPI of a program.
- Understood the importance of the language in determining the CPI of a program.
- Understood the importance of the programmer in determining the CPI of a program.
Formal Description
For this group activity you will construct a document that explains your explorations into the impact of different features on a matrix multiplication program.Please start a word document and record the following, one per group
- Record the names of all members of the group.
- Only one group member need submit this homework, but at least one must.
- Record if you employed any outside sources to solve this problem, including all AI use.
- Set up your environment for the experiment
- Log into prog1.cs.pennwest.edu and download the following files:
- Makefile
- MatrixT.h
- MatrixT.cpp
- matrixTest.cpp
- matrixTime.cpp
-
MatrixBenchmark.java(Never Mind, prog1 does not support java and devweb1 has an old compiler)
- The makefile is somewhat complex and will build four different versions of the c++ program
- matrixNoOptV - a non-optimized vector based version of the program.
- matrixNoOptD - a non-optimized dynamic memory based version of the program.
- matrixOptV - an optimized vector based version of the program.
- matrixOptD - an optimized dynamic memory based version of the program.
- Type
maketo compile these, do not run them yet. - Note any problems you have at this stage in your document.
- Log into prog1.cs.pennwest.edu and download the following files:
- Take a look at MatrixT.h.
- In your document describe the difference between
MatrixDTandMatrixVT. Focus on the member data.
- In your document describe the difference between
- Take a look at MatrixT.cpp.
- Convince yourself that the matrix-matrix multiply code is
- Correct
- The same for both classes
- Describe the performance (Big-O) of this operator.
- BEFORE you run anything, provide an prediction if there will be a difference in the performance of these two classes. Record this in your document.
- Convince yourself that the matrix-matrix multiply code is
- Run
matrixNoOptVandmatrixNoOptD- Record your results, and comment.
- Provide a prediction of how effective the optimizer might be
- Run
matrixOptVandmatrixOptD- Record your results, and comment.
- Run
java MatrixBenchmark.java- Record your results
- Interpret your results.
- run
perf stat -e instructions,cycles prognameon each program.- Set up a spreadsheet, record your results.
- Compute CPI for each.
- Compute IPS (instructions/second)
- I am not sure I trust the results from this, but include the table and record your thoughts.
- Perform an experiment where you only compute the time for the matrix matrix multiplication, not the setup.
- Record, interpret and discuss your results.
- Summarize your discoveries about the impact of library/language/compiler choice on program performance.
Note:
I designed this experiment, then asked ChatGPT for refinements.I used Gemini for a search engine.