Objective: In this project we will design and implement a C program that perform
ID: 3831629 • Letter: O
Question
Objective:
In this project we will design and implement a C program that performs computations on large matrices. The size of a matrix is large enough so that the execution of program causes paging.
Purpose:
Different choices of copying the matrix may have different impacts on the program runtime. You are required notice such impacts and eventually propose a design that efficiently leverages the mechanisms described below to achieve the best performance.
Requirements:
Complete the given C program and use multiple optimization mechanisms to improve the execution runtime.
You are required to use all the mechanisms discussed in the class
You are only allowed to use standard libraries and intrinsic library to implement your program
You are not allowed to create new threads in your implementation.
When using gcc to compile your code, you are allowed to use optimization level3(-O3).
Mechanisms:
Caching: You are required to try different cache block size in your code and use the block size that gives you minimum runtime when integrated with other techniques (SIMD and superscalar mechanism)
SIMD: You are required to make use of Single Instruction Multiple Data (SIMD). It means performing a single operation on multiple data points simultaneously.
Superscalar mechanisms: A superscalar processor executes more than one instruction during a clock cycle by simultaneously dispatching multiple instructions to different components on the processor.
Grading Rubrics:
If your code does not run, you will not receive any credits
You are required to combine at least two technique of optimization, otherwise will not receive any credits
Combining two methods can enable you to have at most 60%
Combining all 3 techniques can earn you at most 75%
Explanation / Answer
#include #include #include #include #include #include #include #include #define ALIGN __attribute__ ((aligned (32))) double ALIGN a[1024 * 1024]; double ALIGN b[1024 * 1024]; double ALIGN c[1024 * 1024]; double ALIGN c1[1024 * 1024]; void dgemm(int n) { int i,j,k; for(i=0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.