We have a square matrix A of size NxN of double precision numbers, and consider submatrices of size MxM in the diagonal of A (the submatrix beginning at position (i,i) consists of M rows and columns beginning in row i and column i: A[i:i+M-1,i:i+M-1]). The last L rows and columns of a submatrix overlap with the initial L rows and columns of the following submatrix. Given N, M and L, the submatrices are those beginning in the first row and column, row and column M-L, row and colum 2*M-2*L..., and only submatrices with all the data in A are considered (the final submatrix will be of size MxM). For example, if N=13, M=5 and L=2, the structure of the submatrices is:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The squares of the matrices are calculated in the order: first matrix beginning in the first row and column is substituted by its square, then the matrix beginning in row and column M-L is substituted by its square, and so on until the square of all the submatrices is calculated. The whole process is performed S times.
A number of problems is solved. For each problem the function to parallelize has:
Input parameters:
-int N: the size of matrix A, NxN
-int M: the size of the submatrices, MxM
-int L: the number of rows and columns where the submatrices overlap
-int S: the number of computations
Input-output parameter:
-double *A: the matrix NxN of double precision numbers. It is updated by dividing each element by 10, so that the numbers do not become very high after the multiplications
Parallelism parameters:
-int node: identification of the MPI process
-int np: total number of MPI processes
For more instructions: general instructions.