code is called void matmultrec(int mf, int ml, int nf, int nl, int pf, int pl, double **A, double **B, double **C) // Dimensions: A[mf..ml][pf..pl] B[pf..pl][nf..nl] C[mf..ml][nf..nl] { if ((ml-mf)*(nl-nf)*(pl-pf) < THRESHOLD) matmult (mf, ml, nf, nl, pf, pl, A, B, C); else { #pragma omp task { matmultrec(mf, mf+(ml-mf)/2, nf, nf+(nl-nf)/2, pf, pf+(pl-pf)/2, A, B, C); // C11 += A11*B11 matmultrec(mf, mf+(ml-mf)/2, nf, nf+(nl-nf)/2, pf+(pl-pf)/2, pl, A, B, C); // C11 += A12*B21 } #pragma omp task { matmultrec(mf, mf+(ml-mf)/2, nf+(nl-nf)/2, nl, pf, pf+(pl-pf)/2, A, B, C); // C12 += A11*B12 matmultrec(mf, mf+(ml-mf)/2, nf+(nl-nf)/2, nl, pf+(pl-pf)/2, pl, A, B, C); // C12 += A12*B22 } #pragma omp task { matmultrec(mf+(ml-mf)/2, ml, nf, nf+(nl-nf)/2, pf, pf+(pl-pf)/2, A, B, C); // C21 += A21*B11 matmultrec(mf+(ml-mf)/2, ml, nf, nf+(nl-nf)/2, pf+(pl-pf)/2, pl, A, B, C); // C21 += A22*B21 } #pragma omp task { matmultrec(mf+(ml-mf)/2, ml, nf+(nl-nf)/2, nl, pf, pf+(pl-pf)/2, A, B, C); // C22 += A21*B12 matmultrec(mf+(ml-mf)/2, ml, nf+(nl-nf)/2, nl, pf+(pl-pf)/2, pl, A, B, C); // C22 += A22*B22 } #pragma omp taskwait } } Recursive Solution 215 Could be executed in parallel as 4 tasks Each task executes the two calls for the same output submatrix of C However, the same number of multiplication operations needed