Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Matrix Multiplication in C language: This project is designed to show the perfor

ID: 3721587 • Letter: M

Question

Matrix Multiplication in C language:

This project is designed to show the performance improvement and overhead of multi-threading with OpenMP APIs for the matrix multiplication application. There are multiple ways to calculate matrix multiplication [1]. Only straightforward calculation algorithms are required for memory reference locality purposes. More advanced algorithm such as Strassen’s algorithm is not required.

You need to:

1) use at least two direct methods (refer to [2] for more details) to implement matrix multiplication (mmul) in C language;

2) calculate the execution time of matrix multiplication for certain number of for-loops;

3) use OpenMP with multi-threading to speed up each method of matrix multiplication;

4) change the number of threads, matrix size and number of for-loops, to show the overhead of multi-threading;

[1] https://en.wikipedia.org/wiki/Matrix_multiplication_algorithm

[2] https://en.wikipedia.org/wiki/Locality_of_reference#Matrix_multiplication

Explanation / Answer

#include int main() { int m, n, p, q, c, d, k, sum = 0; int first[10][10], second[10][10], multiply[10][10]; printf("Enter number of rows and columns of first matrix "); scanf("%d%d", &m, &n); printf("Enter elements of first matrix "); for (c = 0; c