Assignment2 Part 1: Due on Feb 28

In this assignment, you are supposed to calculate the product of two matrices A (of size N*32) and B (of size 32*N), which should be an N*N matrix. Specifically, you are supposed to

Programming tasks

Step 1: Install MPI libraries on your computer and make sure it works.

Step 2: Create a function, Multiply_serial() to perform multiplication without parallelism. Example code (assuming that matrix elements are row-major stored in an array):
void Matrix_Multiply(float *A, float *B, float *C, int m, int n, int p){
	int i, j, k;
	for (i = 0; i < m; i++i){
		for (j = 0; j < p; j++){
			C[i*p + j] = 0;
			for (k = 0; k < n; k++)
				C[i*p + j] += A[i*n + k] * B[k*p + j];
		}
	}
}		
Create a function, IsEqual(), that examines if two matrices are exactly the same. The function should have the form:
int IsEqual(float *A, float *B, int m, int n)
In the function, we need to check if every pair of corresponding elements in A and B are the same. Once a discrepancy is found, the program can instantly return 0 (false). Return 1(true) if A and B are equal (no discrepancy is found). Later the function will be used to verify the results of your MPI programs. You can write a simple main() function to make sure IsEqual() works.

Step 3: Implement your parallel algorithm in main() function, using blocking P2P communication (MPI_Send/MPI_Recv) between processes. main() should at least:

Step 4: Compile and run your program. You can use 2 or 4 or 8 processes (according to how many cores your computer CPU has). Take down the running time for serial, blocking communication, collective communication and non-blocking communication.

Report

Your report should have the following:

Submission

Please submit a zip package including: