Accumulation in matrix. MPI+OpenMP version

We have a square matrix of integer numbers (A) of size NxN, initialized to zero, and a list (L) of M quintuples (v,r1,c1,r2,c2), where v is an integer number, and (r1,c1) and (r2,c2) represents positions in the matrix (values between 0 and N-1), with r1<r2 and c1<c2. For each (v,r1,c1,r2,c2) the value v is accumulated in A[r,c] for each r1<=r<=r2 and c1<=c<=c2.


A number of problems is solved. For each problem the function to parallelize has:

Input parameters:

-int n: the size of the matrix

-int m: the number of quintuples

-int *v: the values

-int *r1: the initial rows

-int *c1: the initial columns

-int *r2: the final rows

-int *c2: the final columns

Input-output parameter:

-int *a: the matrix nxn

Parallelism parameters:

-int node: MPI process identifier

-int np: number of MPI processes.


Files

For more instructions: general instructions.